Skip to content

Commit

Permalink
Upgrade to ESLint 8
Browse files Browse the repository at this point in the history
Fixes #618
Closes #623
  • Loading branch information
sindresorhus committed Oct 27, 2021
1 parent 431887d commit dddc991
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 15 additions & 12 deletions config/plugins.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = {
'no-use-extend-native',
'ava',
'unicorn',
'promise',
// Disabled as the plugin doesn't support ESLint 8 yet.
// 'promise',

This comment has been minimized.

Copy link
@fregante

This comment has been minimized.

Copy link
@sindresorhus

sindresorhus Mar 3, 2022

Author Member

I'm not yet sure I want to enable it. The plugin is clearly lacking in maintenance and it's quite buggy.

'import',
'node',
'eslint-comments',
Expand Down Expand Up @@ -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': [
Expand Down
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion test/lint-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions test/lint-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down

0 comments on commit dddc991

Please sign in to comment.