diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index b912f003..1a320e6b 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 - name: Install Packages run: npm install - name: Lint @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x, 17.x] + node-version: [14.x, 16.x, 17.x] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} @@ -39,19 +39,19 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 16 - name: Install Target Packages run: |+ - npm i -D eslint@6 + npm i -D eslint@6 --legacy-peer-deps npx rimraf node_modules - npm install + npm install --legacy-peer-deps - name: Test run: npm test test-with-eslint7: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x] + node-version: [16] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} diff --git a/README.md b/README.md index 772ab06e..9adecc57 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ npm install --save-dev eslint eslint-plugin-yml > **Requirements** > > - ESLint v6.0.0 and above -> - Node.js v12.22.x, v14.17.x, v16.x and above +> - Node.js v14.17.x, v16.x and above diff --git a/docs/user-guide/README.md b/docs/user-guide/README.md index 23d76435..3ad7fd5b 100644 --- a/docs/user-guide/README.md +++ b/docs/user-guide/README.md @@ -9,7 +9,7 @@ npm install --save-dev eslint eslint-plugin-yml ::: tip Requirements - ESLint v6.0.0 and above -- Node.js v12.22.x, v14.17.x, v16.x and above +- Node.js v14.17.x, v16.x and above ::: diff --git a/package.json b/package.json index fe60309b..a93ffe5a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lib" ], "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^14.17.0 || >=16.0.0" }, "scripts": { "prebuild": "npm run -s clean", @@ -52,7 +52,7 @@ "debug": "^4.3.2", "lodash": "^4.17.21", "natural-compare": "^1.4.0", - "yaml-eslint-parser": "^0.5.0" + "yaml-eslint-parser": "^1.0.0" }, "peerDependencies": { "eslint": ">=6.0.0" diff --git a/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-asc/2XXW-override-config.json b/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-asc/2XXW-override-config.json new file mode 100644 index 00000000..187d729b --- /dev/null +++ b/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-asc/2XXW-override-config.json @@ -0,0 +1 @@ +{ "skipOutputTest": true } diff --git a/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-default/2XXW-override-config.json b/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-default/2XXW-override-config.json new file mode 100644 index 00000000..187d729b --- /dev/null +++ b/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-default/2XXW-override-config.json @@ -0,0 +1 @@ +{ "skipOutputTest": true } diff --git a/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-desc/2XXW-override-config.json b/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-desc/2XXW-override-config.json new file mode 100644 index 00000000..187d729b --- /dev/null +++ b/tests/fixtures/rules/sort-keys/invalid/yaml-test-suite-for-desc/2XXW-override-config.json @@ -0,0 +1 @@ +{ "skipOutputTest": true } diff --git a/tests/fixtures/rules/vue-custom-block/no-parsing-error/invalid/sfc-custom-block01-errors.json b/tests/fixtures/rules/vue-custom-block/no-parsing-error/invalid/sfc-custom-block01-errors.json index 41004461..7cd10492 100644 --- a/tests/fixtures/rules/vue-custom-block/no-parsing-error/invalid/sfc-custom-block01-errors.json +++ b/tests/fixtures/rules/vue-custom-block/no-parsing-error/invalid/sfc-custom-block01-errors.json @@ -1,7 +1,7 @@ [ { - "message": "Expected flow map to end with }", - "line": 3, - "column": 6 + "message": "Flow map must end with a }", + "line": 4, + "column": 1 } ] diff --git a/tests/utils/utils.ts b/tests/utils/utils.ts index 9f1881fe..c8f33c70 100644 --- a/tests/utils/utils.ts +++ b/tests/utils/utils.ts @@ -140,8 +140,9 @@ export function loadTestCases( } if (invalid.some((test) => test.output) && !options?.skipOutputTest) { describe(`Output test for ${ruleName}`, () => { - for (const test of invalid.filter(({ filename }) => - isYaml(filename), + for (const test of invalid.filter( + ({ filename, skipOutputTest }) => + isYaml(filename) && !skipOutputTest, )) { it(test.filename || test.code, () => { const input = yamlESLintParser.parseForESLint(test.code) @@ -154,6 +155,10 @@ export function loadTestCases( } }) } + for (const test of invalid) { + delete test.skipOutputTest + } + return { valid, invalid, @@ -184,15 +189,7 @@ function* itrListupInput(rootDir: string): IterableIterator { } function exists(f: string) { - try { - fs.statSync(f) - return true - } catch (error: any) { - if (error.code === "ENOENT") { - return false - } - throw error - } + return fs.existsSync(f) } export function makeSuiteTests( @@ -372,6 +369,13 @@ function getLinter(ruleName: string) { function getConfig(ruleName: string, inputFile: string) { const filename = inputFile.slice(inputFile.indexOf(ruleName)) const code0 = fs.readFileSync(inputFile, "utf8") + const overrideConfigFile: string = inputFile.replace( + /input\.(?:ya?ml|vue)$/u, + "override-config.json", + ) + const overrideConfig = exists(overrideConfigFile) + ? JSON.parse(fs.readFileSync(overrideConfigFile, "utf8")) + : {} let code, config let configFile: string = inputFile.replace( /input\.(?:ya?ml|vue)$/u, @@ -392,6 +396,7 @@ function getConfig(ruleName: string, inputFile: string) { ? { parser: require.resolve("vue-eslint-parser") } : {}, config, + overrideConfig, { code, filename }, ) }