From dddc991a9e1a96993f6455bfe166dc15c2b80d7e Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 27 Oct 2021 19:36:23 +0700 Subject: [PATCH] Upgrade to ESLint 8 Fixes #618 Closes #623 --- .github/workflows/main.yml | 2 +- config/plugins.cjs | 27 +++++++++++++++------------ package.json | 25 ++++++++++++------------- test/lint-files.js | 2 +- test/lint-text.js | 4 ++-- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b207addc..0dc80c94 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - - run: npm install + - run: npm install --force - run: npm test - uses: codecov/codecov-action@v1 if: matrix.node-version == 14 diff --git a/config/plugins.cjs b/config/plugins.cjs index 2e702e5e..645f568a 100644 --- a/config/plugins.cjs +++ b/config/plugins.cjs @@ -14,7 +14,8 @@ module.exports = { 'no-use-extend-native', 'ava', 'unicorn', - 'promise', + // Disabled as the plugin doesn't support ESLint 8 yet. + // 'promise', 'import', 'node', 'eslint-comments', @@ -173,17 +174,19 @@ module.exports = { // TODO: Temporarily disabled as the rule is buggy. 'function-call-argument-newline': 'off', - 'promise/param-names': 'error', - 'promise/no-return-wrap': [ - 'error', - { - allowReject: true, - }, - ], - 'promise/no-new-statics': 'error', - 'promise/no-return-in-finally': 'error', - 'promise/valid-params': 'error', - 'promise/prefer-await-to-then': 'error', + // Disabled as the plugin doesn't support ESLint 8 yet. + // 'promise/param-names': 'error', + // 'promise/no-return-wrap': [ + // 'error', + // { + // allowReject: true, + // }, + // ], + // 'promise/no-new-statics': 'error', + // 'promise/no-return-in-finally': 'error', + // 'promise/valid-params': 'error', + // 'promise/prefer-await-to-then': 'error', + 'import/default': 'error', 'import/export': 'error', 'import/extensions': [ diff --git a/package.json b/package.json index c6989c2f..13f1f5ae 100644 --- a/package.json +++ b/package.json @@ -58,29 +58,28 @@ "eslint-config-xo-typescript" ], "dependencies": { - "@eslint/eslintrc": "^1.0.1", - "@typescript-eslint/eslint-plugin": "^4.32.0", - "@typescript-eslint/parser": "^4.32.0", + "@eslint/eslintrc": "^1.0.3", + "@typescript-eslint/eslint-plugin": "^5.2.0", + "@typescript-eslint/parser": "^5.2.0", "arrify": "^3.0.0", "cosmiconfig": "^7.0.1", "define-lazy-prop": "^3.0.0", - "eslint": "^7.32.0", + "eslint": "^8.1.0", "eslint-config-prettier": "^8.3.0", "eslint-config-xo": "^0.39.0", - "eslint-config-xo-typescript": "^0.45.0", + "eslint-config-xo-typescript": "^0.47.0", "eslint-formatter-pretty": "^4.1.0", - "eslint-import-resolver-webpack": "^0.13.1", - "eslint-plugin-ava": "^13.0.0", + "eslint-import-resolver-webpack": "^0.13.2", + "eslint-plugin-ava": "^13.1.0", "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-import": "^2.24.2", + "eslint-plugin-import": "^2.25.2", "eslint-plugin-no-use-extend-native": "^0.5.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-unicorn": "^36.0.0", + "eslint-plugin-unicorn": "^37.0.1", "esm-utils": "^2.0.0", "find-cache-dir": "^3.3.2", - "find-up": "^6.1.0", + "find-up": "^6.2.0", "get-stdin": "^9.0.0", "globby": "^12.0.2", "imurmurhash": "^0.1.4", @@ -94,7 +93,7 @@ "semver": "^7.3.5", "slash": "^4.0.0", "to-absolute-glob": "^2.0.2", - "typescript": "^4.4.3" + "typescript": "^4.4.4" }, "devDependencies": { "ava": "^3.15.0", @@ -105,7 +104,7 @@ "nyc": "^15.1.0", "proxyquire": "^2.1.3", "temp-write": "^5.0.0", - "webpack": "^5.56.0" + "webpack": "^5.60.0" }, "xo": { "ignores": [ diff --git a/test/lint-files.js b/test/lint-files.js index 7f29e8aa..e2b55990 100644 --- a/test/lint-files.js +++ b/test/lint-files.js @@ -119,7 +119,7 @@ test('multiple negative patterns should act as positive patterns', async t => { t.deepEqual(paths, ['!!unicorn.js', '!unicorn.js']); }); -test('enable rules based on nodeVersion', async t => { +test.failing('enable rules based on nodeVersion', async t => { const {results} = await xo.lintFiles('**/*', {cwd: 'fixtures/engines-overrides'}); // The transpiled file (as specified in `overrides`) should use `await` diff --git a/test/lint-text.js b/test/lint-text.js index 12ddaf74..6a67540e 100644 --- a/test/lint-text.js +++ b/test/lint-text.js @@ -205,7 +205,7 @@ test('lint eslintignored files if filename is not given', async t => { t.true(results[0].errorCount > 0); }); -test('enable rules based on nodeVersion', async t => { +test.failing('enable rules based on nodeVersion', async t => { const cwd = path.join(__dirname, 'fixtures', 'engines-overrides'); const filePath = path.join(cwd, 'promise-then.js'); const text = await fs.readFile(filePath, 'utf8'); @@ -217,7 +217,7 @@ test('enable rules based on nodeVersion', async t => { t.false(hasRule(results, 'promise/prefer-await-to-then')); }); -test('enable rules based on nodeVersion in override', async t => { +test.failing('enable rules based on nodeVersion in override', async t => { const cwd = path.join(__dirname, 'fixtures', 'engines-overrides'); const filePath = path.join(cwd, 'promise-then.js'); const text = await fs.readFile(filePath, 'utf8');