Skip to content

Commit 4f47e53

Browse files
committed
feat: Support ESLint 7.x
BREAKING CHANGE: Requires Node@^10.12.x || 12.x BREAKING CHANGE: Requires ESLint@^7.x
1 parent a75feb8 commit 4f47e53

11 files changed

+66
-42
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ cache: npm
33
notifications:
44
email: false
55
node_js:
6+
- 10.12
67
- 10
8+
- 12.0
79
- 12
810
- 14
911
- node

best-practices.js

+2-14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
complexity: ['error', 14],
99
'consistent-return': 'error',
1010
'default-case': 'error',
11+
'default-case-last': 'error',
1112
'default-param-last': 'off',
1213
'dot-notation': 'error',
1314
eqeqeq: 'off',
@@ -81,7 +82,7 @@ module.exports = {
8182
// variables
8283
'no-delete-var': 'error',
8384
'no-label-var': 'error',
84-
'no-restricted-globals': ['error', 'event', 'fdescribe'],
85+
'no-restricted-globals': ['error', 'event', 'describe'],
8586
'no-shadow': 'error',
8687
'no-shadow-restricted-names': 'error',
8788
'no-undef': 'error',
@@ -96,18 +97,5 @@ module.exports = {
9697
ignoreRestSiblings: true,
9798
},
9899
],
99-
100-
// CommonJS
101-
'callback-return': 'off', // see known limitations: http://eslint.org/docs/rules/callback-return it's just annoying...
102-
'global-require': 'warn', // sometimes this is ok. We shouldn't break a build
103-
'handle-callback-err': 'error',
104-
'no-buffer-constructor': 'error',
105-
'no-mixed-requires': ['error', {grouping: true, allowCall: false}],
106-
'no-new-require': 'error',
107-
'no-path-concat': 'error',
108-
'no-process-env': 'off',
109-
'no-process-exit': 'error',
110-
'no-restricted-modules': 'off',
111-
'no-sync': 'off',
112100
},
113101
}

deprecated-rules.js

+27-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1+
const {mapDeprecatedRules} = require('./utils')
2+
13
module.exports = {
24
extends: './non-rules-config.js',
3-
rules: {
4-
'lines-around-directive': 'off',
5-
'newline-after-var': 'off',
6-
'newline-before-return': 'off',
7-
'no-catch-shadow': 'off',
8-
'no-native-reassign': 'off',
9-
'no-negated-in-lhs': 'off',
10-
'require-jsdoc': 'off',
11-
'valid-jsdoc': 'off',
12-
},
5+
rules: mapDeprecatedRules([
6+
'callback-return',
7+
'global-require',
8+
'handle-callback-err',
9+
'id-blacklist',
10+
'indent-legacy',
11+
'lines-around-directive',
12+
'newline-after-var',
13+
'newline-before-return',
14+
'no-buffer-constructor',
15+
'no-catch-shadow',
16+
'no-mixed-requires',
17+
'no-native-reassign',
18+
'no-negated-in-lhs',
19+
'no-new-require',
20+
'no-path-concat',
21+
'no-process-env',
22+
'no-process-exit',
23+
'no-restricted-modules',
24+
'no-spaced-func',
25+
'no-sync',
26+
'prefer-reflect',
27+
'require-jsdoc',
28+
'valid-jsdoc',
29+
]),
1330
}

es6/best-practices.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
rules: {
44
'no-class-assign': 'error',
55
'no-duplicate-imports': 'error',
6+
'no-restricted-exports': 'off', // not applicable for a config preset (should be configured only in projects)
67
'no-restricted-imports': 'off', // not applicable for a config preset (should be configured only in projects)
78
'no-useless-computed-key': 'error',
89
'no-useless-constructor': 'error',

es6/deprecated-rules.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
const {mapDeprecatedRules} = require('../utils')
2+
13
module.exports = {
24
extends: './non-rules-config.js',
3-
rules: {
4-
'prefer-reflect': 'off',
5-
'babel/array-bracket-spacing': 'off',
6-
'babel/arrow-parens': 'off',
7-
'babel/flow-object-type': 'off',
8-
'babel/func-params-comma-dangle': 'off',
9-
'babel/generator-star-spacing': 'off',
10-
'babel/no-await-in-loop': 'off',
11-
'babel/object-shorthand': 'off',
12-
},
5+
rules: mapDeprecatedRules([
6+
'babel/array-bracket-spacing',
7+
'babel/arrow-parens',
8+
'babel/flow-object-type',
9+
'babel/func-params-comma-dangle',
10+
'babel/generator-star-spacing',
11+
'babel/no-await-in-loop',
12+
'babel/object-shorthand',
13+
]),
1314
}

import/deprecated-rules.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
const {mapDeprecatedRules} = require('../utils')
2+
13
module.exports = {
24
extends: './non-rules-config.js',
3-
rules: {
4-
'import/imports-first': 'off',
5-
},
5+
rules: mapDeprecatedRules(['import/imports-first']),
66
}

jest.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
].filter(Boolean),
3434
rules: {
3535
'jest/consistent-test-it': 'off',
36+
'jest/no-done-callback': 'error',
3637
'jest/expect-expect': 'off',
3738
'jest/lowercase-name': 'off',
3839
'jest/no-alias-methods': 'off',

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"eslint-import-resolver-webpack": "^0.12.2",
3939
"eslint-plugin-babel": "^5.3.1",
4040
"eslint-plugin-import": "^2.22.0",
41-
"eslint-plugin-jest": "^23.20.0",
41+
"eslint-plugin-jest": "^24.0.2",
4242
"eslint-plugin-jest-dom": "^3.2.3",
4343
"eslint-plugin-jsx-a11y": "^6.3.1",
4444
"eslint-plugin-react": "^7.20.6",
@@ -49,12 +49,12 @@
4949
"webpack": "^4.44.2"
5050
},
5151
"peerDependencies": {
52-
"eslint": ">=6"
52+
"eslint": "^7.0.0"
5353
},
5454
"devDependencies": {
5555
"@testing-library/dom": "^7.24.2",
5656
"@testing-library/jest-dom": "^5.11.4",
57-
"eslint": "^6.8.0",
57+
"eslint": "^7.9.0",
5858
"eslint-find-rules": "^3.6.1",
5959
"kcd-scripts": "^6.3.0",
6060
"npm-run-all": "^4.1.5",
@@ -69,7 +69,7 @@
6969
"dist"
7070
],
7171
"engines": {
72-
"node": ">=10",
72+
"node": "^10.12.0 || >=12.0.0",
7373
"npm": ">=6",
7474
"yarn": ">=1"
7575
}

possible-errors.js

+4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ module.exports = {
2424
'no-inner-declarations': 'error',
2525
'no-invalid-regexp': 'error',
2626
'no-irregular-whitespace': 'error',
27+
'no-loss-of-precision': 'error',
2728
'no-misleading-character-class': 'off',
2829
'no-obj-calls': 'error',
30+
'no-promise-executor-return': 'error',
2931
'no-prototype-builtins': 'off',
3032
'no-regex-spaces': 'error',
3133
'no-setter-return': 'error',
3234
'no-sparse-arrays': 'error',
3335
'no-template-curly-in-string': 'error',
3436
'no-unreachable': 'error',
37+
'no-unreachable-loop': 'error',
3538
'no-unsafe-finally': 'error',
3639
'no-unsafe-negation': 'error',
40+
'no-useless-backreference': 'error',
3741
'require-atomic-updates': 'off',
3842
'use-isnan': 'error',
3943
'valid-typeof': 'error',

stylistic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
'func-name-matching': 'error',
99
'func-names': 'error',
1010
'func-style': 'off',
11-
'id-blacklist': 'error',
11+
'id-denylist': 'error',
1212
'id-length': 'off', // when using short composable functions, using single-letter variables is fine
1313
'id-match': [
1414
'error',

utils.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const mapDeprecatedRules = deprecatedRules =>
2+
deprecatedRules.reduce(
3+
(allRules, rule) => ({
4+
...allRules,
5+
[rule]: 'off',
6+
}),
7+
{},
8+
)
9+
10+
module.exports = {mapDeprecatedRules}

0 commit comments

Comments
 (0)