Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support ESLint 7.x #64

Merged
merged 1 commit into from Sep 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
16 changes: 2 additions & 14 deletions best-practices.js
Expand Up @@ -8,6 +8,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 @@ -81,7 +82,7 @@ module.exports = {
// variables
'no-delete-var': 'error',
'no-label-var': 'error',
'no-restricted-globals': ['error', 'event', 'fdescribe'],
'no-restricted-globals': ['error', 'event', 'describe'],
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'no-undef': 'error',
Expand All @@ -96,18 +97,5 @@ module.exports = {
ignoreRestSiblings: true,
},
],

// 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',
},
}
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
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -38,7 +38,7 @@
"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-react": "^7.20.6",
Expand All @@ -49,12 +49,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 +69,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}