diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a053ffb..ff7cbbc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -35,10 +35,18 @@ jobs: eslint-version: - 7 - 8 + - 9 node-version: - 14 - 16 - 18 + - 20 + exclude: + # eslint@9 requires node 18+ + - eslint-version: 9 + node-version: 14 + - eslint-version: 9 + node-version: 16 steps: - uses: actions/checkout@v4 diff --git a/lib/ignore-all.js b/lib/ignore-all.js index 9138114..6ce1a1d 100644 --- a/lib/ignore-all.js +++ b/lib/ignore-all.js @@ -52,11 +52,16 @@ module.exports = async function ignoreAll(cwd = process.cwd()) { const eslint = importCwd('eslint'); - if (semver.intersects(eslintVersion, '8')) { + if ( + semver.intersects(eslintVersion, '8') || + semver.intersects(eslintVersion, '9') + ) { // this won't use the version in the repo but it will still use v8 because // that is installed in this repo const { ESLint } = eslint; - cli = new ESLint(); + cli = new ESLint({ + cwd, + }); results = await cli.lintFiles([cwd]); // remove warnings diff --git a/package.json b/package.json index 525e6b0..e580bfa 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "devDependencies": { "@babel/core": "^7.25.2", "@babel/eslint-parser": "^7.19.1", + "@eslint/js": "^9.13.0", "chai": "^4.3.4", "eslint": "^8.0.0", "eslint-config-prettier": "^9.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc4c04d..e408433 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,7 @@ patchedDependencies: specifiers: '@babel/core': ^7.25.2 '@babel/eslint-parser': ^7.19.1 + '@eslint/js': ^9.13.0 chai: ^4.3.4 eslint: ^8.0.0 eslint-config-prettier: ^9.1.0 @@ -34,6 +35,7 @@ dependencies: devDependencies: '@babel/core': 7.25.2 '@babel/eslint-parser': 7.25.1_uhszjnyxpp3ff7nctzrrdj6llq + '@eslint/js': 9.13.0 chai: 4.5.0 eslint: 8.57.1 eslint-config-prettier: 9.1.0_eslint@8.57.1 @@ -294,6 +296,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@eslint/js/9.13.0: + resolution: {integrity: sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true + /@gar/promisify/1.1.3: resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==} dev: true @@ -1075,16 +1082,16 @@ packages: isexe: 2.0.0 dev: true - /acorn-jsx/5.3.2_acorn@8.12.1: + /acorn-jsx/5.3.2_acorn@8.14.0: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.12.1 + acorn: 8.14.0 dev: true - /acorn/8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + /acorn/8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -2083,6 +2090,7 @@ packages: /eslint/8.57.1: resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true dependencies: '@eslint-community/eslint-utils': 4.4.0_eslint@8.57.1 @@ -2131,8 +2139,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2_acorn@8.12.1 + acorn: 8.14.0 + acorn-jsx: 5.3.2_acorn@8.14.0 eslint-visitor-keys: 3.4.3 dev: true @@ -4877,7 +4885,7 @@ packages: resolution: {directory: '', type: directory} id: 'file:' name: lint-to-the-future-eslint - version: 2.0.1 + version: 2.1.3 engines: {node: 10.* || >= 12.*} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 diff --git a/test/ignore.mjs b/test/ignore.mjs index 1a01fa6..4783961 100644 --- a/test/ignore.mjs +++ b/test/ignore.mjs @@ -9,6 +9,12 @@ async function ignoreTestFile(input, files) { const project = new Project({ files: { '.eslintrc.json': '{"extends": "eslint:recommended"}', + //only for eslint 9 + 'eslint.config.js': `const js = require("@eslint/js"); + +module.exports = [ + js.configs.recommended, +];`, 'index.js': input, 'package.json': `{ "devDependencies": { @@ -20,6 +26,7 @@ async function ignoreTestFile(input, files) { }); project.linkDevDependency('eslint', { baseDir: process.cwd() }); + project.linkDevDependency('@eslint/js', { baseDir: process.cwd() }); await project.write(); await ignoreAll(project.baseDir); @@ -82,6 +89,13 @@ if (10 === 'false') { { '.eslintrc.json': '{"extends": "eslint:recommended", "rules": { "no-constant-condition": "warn" }}', + //only for eslint 9 + 'eslint.config.js': `const js = require("@eslint/js"); + + module.exports = [ + js.configs.recommended, + { rules: { "no-constant-condition": "warn" }} + ];`, }, ), ).to.equal(`/* eslint-disable no-debugger */