Skip to content

Commit d2736d4

Browse files
committed
ci: run tests and linting once
1 parent 1deb5bc commit d2736d4

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ jobs:
2222
uses: actions/setup-node@v4
2323
with:
2424
node-version: 20.x
25-
- name: Install Packages
26-
run: npm install
27-
- name: Lint
28-
run: npm run -s lint
25+
- run: npm install
26+
- run: npm run -s lint
27+
- run: npm run -s test:types
2928

3029
test:
3130
name: Test
@@ -64,7 +63,6 @@ jobs:
6463
- name: Install Packages
6564
run: npm install
6665
- name: Install ESLint ${{ matrix.eslint }}
67-
run: |
68-
npm install --no-save --force eslint@${{ matrix.eslint }}
66+
run: npm install --no-save --force eslint@${{ matrix.eslint }}
6967
- name: Test
70-
run: npm run -s test
68+
run: npm run -s test:tests

lib/util/get-configured-node-version.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
*/
55
"use strict"
66

7-
const { Range } = require("semver") // eslint-disable-line no-unused-vars
87
const getPackageJson = require("./get-package-json")
98
const getSemverRange = require("./get-semver-range")
109

1110
/**
1211
* Gets `version` property from a given option object.
1312
*
1413
* @param {Record<string, string>|undefined} option - An option object to get.
15-
* @returns {Range|undefined} The `allowModules` value, or `null`.
14+
* @returns {import("semver").Range|undefined} The `allowModules` value, or `null`.
1615
*/
1716
function getVersionRange(option) {
1817
if (option?.version) {
@@ -25,7 +24,7 @@ function getVersionRange(option) {
2524
/**
2625
* Get the `engines.node` field of package.json.
2726
* @param {import('eslint').Rule.RuleContext} context The path to the current linting file.
28-
* @returns {Range|undefined} The range object of the `engines.node` field.
27+
* @returns {import("semver").Range|undefined} The range object of the `engines.node` field.
2928
*/
3029
function getEnginesNode(context) {
3130
const filename = context.filename ?? context.getFilename()
@@ -45,15 +44,15 @@ function getEnginesNode(context) {
4544
*
4645
* @param {import('eslint').Rule.RuleContext} context The version range text.
4746
* This will be used to look package.json up if `version` is not a valid version range.
48-
* @returns {Range} The configured version range.
47+
* @returns {import("semver").Range} The configured version range.
4948
*/
5049
module.exports = function getConfiguredNodeVersion(context) {
5150
return (
5251
getVersionRange(context.options?.[0]) ??
5352
getVersionRange(context.settings?.n) ??
5453
getVersionRange(context.settings?.node) ??
5554
getEnginesNode(context) ??
56-
/** @type {Range} */ (getSemverRange(">=16.0.0"))
55+
/** @type {import("semver").Range} */ (getSemverRange(">=16.0.0"))
5756
)
5857
}
5958

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@
6767
"prepack": "tsc --emitDeclarationOnly",
6868
"prepare": "husky",
6969
"preversion": "npm test",
70-
"test": "run-p test:types test:lint test:tests",
71-
"test:lint": "npm run -s lint",
70+
"test": "run-p lint:* test:types test:lint test:tests",
71+
"test:mocha": "_mocha --reporter progress --timeout 4000",
7272
"test:tests": "npm run test:mocha \"tests/lib/**/*.js\"",
7373
"test:types": "tsc --noEmit --emitDeclarationOnly false",
74-
"test:mocha": "_mocha --reporter progress --timeout 4000",
7574
"update:eslint-docs": "eslint-doc-generator",
7675
"version": "npm run -s build && eslint lib/rules --fix && git add .",
7776
"watch": "npm run test:_mocha -- --watch --growl"

0 commit comments

Comments
 (0)