Skip to content

Commit

Permalink
feat: Support ESLint 7.x
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires Node@^10.12.x || 12.x
BREAKING CHANGE: Requires ESLint@^7.x
  • Loading branch information
MichaelDeBoey committed Sep 20, 2020
1 parent a75feb8 commit fc02180
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -3,7 +3,9 @@ cache: npm
notifications:
email: false
node_js:
- 10.12
- 10
- 12.0
- 12
- 14
- node
Expand Down
23 changes: 12 additions & 11 deletions best-practices.js
@@ -1,5 +1,6 @@
module.exports = {
extends: './non-rules-config.js',
plugins: ['node'],
rules: {
'accessor-pairs': 'error',
'array-callback-return': 'error',
Expand All @@ -8,6 +9,7 @@ module.exports = {
complexity: ['error', 14],
'consistent-return': 'error',
'default-case': 'error',
'default-case-last': 'error',
'default-param-last': 'off',
'dot-notation': 'error',
eqeqeq: 'off',
Expand Down Expand Up @@ -98,16 +100,15 @@ module.exports = {
],

// CommonJS
'callback-return': 'off', // see known limitations: http://eslint.org/docs/rules/callback-return it's just annoying...
'global-require': 'warn', // sometimes this is ok. We shouldn't break a build
'handle-callback-err': 'error',
'no-buffer-constructor': 'error',
'no-mixed-requires': ['error', {grouping: true, allowCall: false}],
'no-new-require': 'error',
'no-path-concat': 'error',
'no-process-env': 'off',
'no-process-exit': 'error',
'no-restricted-modules': 'off',
'no-sync': 'off',
'node/callback-return': 'off', // see known limitations: http://eslint.org/docs/rules/callback-return it's just annoying...
'node/global-require': 'warn', // sometimes this is ok. We shouldn't break a build
'node/handle-callback-err': 'error',
'node/no-mixed-requires': ['error', {grouping: true, allowCall: false}],
'node/no-new-require': 'error',
'node/no-path-concat': 'error',
'node/no-process-env': 'off',
'node/no-process-exit': 'error',
'node/no-restricted-modules': 'off',
'node/no-sync': 'off',
},
}
37 changes: 27 additions & 10 deletions deprecated-rules.js
@@ -1,13 +1,30 @@
const {mapDeprecatedRules} = require('./utils')

module.exports = {
extends: './non-rules-config.js',
rules: {
'lines-around-directive': 'off',
'newline-after-var': 'off',
'newline-before-return': 'off',
'no-catch-shadow': 'off',
'no-native-reassign': 'off',
'no-negated-in-lhs': 'off',
'require-jsdoc': 'off',
'valid-jsdoc': 'off',
},
rules: mapDeprecatedRules([
'callback-return',
'global-require',
'handle-callback-err',
'id-blacklist',
'indent-legacy',
'lines-around-directive',
'newline-after-var',
'newline-before-return',
'no-buffer-constructor',
'no-catch-shadow',
'no-mixed-requires',
'no-native-reassign',
'no-negated-in-lhs',
'no-new-require',
'no-path-concat',
'no-process-env',
'no-process-exit',
'no-restricted-modules',
'no-spaced-func',
'no-sync',
'prefer-reflect',
'require-jsdoc',
'valid-jsdoc',
]),
}
1 change: 1 addition & 0 deletions es6/best-practices.js
Expand Up @@ -3,6 +3,7 @@ module.exports = {
rules: {
'no-class-assign': 'error',
'no-duplicate-imports': 'error',
'no-restricted-exports': 'off', // not applicable for a config preset (should be configured only in projects)
'no-restricted-imports': 'off', // not applicable for a config preset (should be configured only in projects)
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
Expand Down
21 changes: 11 additions & 10 deletions es6/deprecated-rules.js
@@ -1,13 +1,14 @@
const {mapDeprecatedRules} = require('../utils')

module.exports = {
extends: './non-rules-config.js',
rules: {
'prefer-reflect': 'off',
'babel/array-bracket-spacing': 'off',
'babel/arrow-parens': 'off',
'babel/flow-object-type': 'off',
'babel/func-params-comma-dangle': 'off',
'babel/generator-star-spacing': 'off',
'babel/no-await-in-loop': 'off',
'babel/object-shorthand': 'off',
},
rules: mapDeprecatedRules([
'babel/array-bracket-spacing',
'babel/arrow-parens',
'babel/flow-object-type',
'babel/func-params-comma-dangle',
'babel/generator-star-spacing',
'babel/no-await-in-loop',
'babel/object-shorthand',
]),
}
6 changes: 3 additions & 3 deletions import/deprecated-rules.js
@@ -1,6 +1,6 @@
const {mapDeprecatedRules} = require('../utils')

module.exports = {
extends: './non-rules-config.js',
rules: {
'import/imports-first': 'off',
},
rules: mapDeprecatedRules(['import/imports-first']),
}
1 change: 1 addition & 0 deletions jest.js
Expand Up @@ -33,6 +33,7 @@ module.exports = {
].filter(Boolean),
rules: {
'jest/consistent-test-it': 'off',
'jest/no-done-callback': 'error',
'jest/expect-expect': 'off',
'jest/lowercase-name': 'off',
'jest/no-alias-methods': 'off',
Expand Down
9 changes: 5 additions & 4 deletions package.json
Expand Up @@ -38,9 +38,10 @@
"eslint-import-resolver-webpack": "^0.12.2",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jest-dom": "^3.2.3",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-testing-library": "^3.9.0",
Expand All @@ -49,12 +50,12 @@
"webpack": "^4.44.2"
},
"peerDependencies": {
"eslint": ">=6"
"eslint": "^7.0.0"
},
"devDependencies": {
"@testing-library/dom": "^7.24.2",
"@testing-library/jest-dom": "^5.11.4",
"eslint": "^6.8.0",
"eslint": "^7.9.0",
"eslint-find-rules": "^3.6.1",
"kcd-scripts": "^6.3.0",
"npm-run-all": "^4.1.5",
Expand All @@ -69,7 +70,7 @@
"dist"
],
"engines": {
"node": ">=10",
"node": "^10.12.0 || >=12.0.0",
"npm": ">=6",
"yarn": ">=1"
}
Expand Down
4 changes: 4 additions & 0 deletions possible-errors.js
Expand Up @@ -24,16 +24,20 @@ module.exports = {
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-loss-of-precision': 'error',
'no-misleading-character-class': 'off',
'no-obj-calls': 'error',
'no-promise-executor-return': 'error',
'no-prototype-builtins': 'off',
'no-regex-spaces': 'error',
'no-setter-return': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-useless-backreference': 'error',
'require-atomic-updates': 'off',
'use-isnan': 'error',
'valid-typeof': 'error',
Expand Down
2 changes: 1 addition & 1 deletion stylistic.js
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'func-name-matching': 'error',
'func-names': 'error',
'func-style': 'off',
'id-blacklist': 'error',
'id-denylist': 'error',
'id-length': 'off', // when using short composable functions, using single-letter variables is fine
'id-match': [
'error',
Expand Down
10 changes: 10 additions & 0 deletions utils.js
@@ -0,0 +1,10 @@
const mapDeprecatedRules = deprecatedRules =>
deprecatedRules.reduce(
(allRules, rule) => ({
...allRules,
[rule]: 'off',
}),
{},
)

module.exports = {mapDeprecatedRules}

0 comments on commit fc02180

Please sign in to comment.