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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint config] [*] [new] add eslint v7 #2240

Merged
merged 1 commit into from
Jun 10, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ node_js:
- "14"
- "12"
- "10"
- "8"
before_install:
- 'nvm install-latest-npm'
install:
Expand All @@ -16,6 +15,11 @@ script:
sudo: false
env:
matrix:
- 'TEST=true ESLINT=7 PACKAGE=eslint-config-airbnb-base'
- 'TEST=true ESLINT=7 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=7 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=7 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=7 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=6 PACKAGE=eslint-config-airbnb-base'
- 'TEST=true ESLINT=6 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=6 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb'
Expand All @@ -29,6 +33,17 @@ env:
matrix:
fast_finish: true
include:
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=7 PACKAGE=eslint-config-airbnb-base
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=7 PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=7 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=7 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=7 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=6 PACKAGE=eslint-config-airbnb-base
- node_js: "lts/*"
Expand All @@ -55,6 +70,26 @@ matrix:
env: LINT=true PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
env: LINT=true PACKAGE=eslint-config-airbnb-base
- node_js: "8"
env: TEST=true ESLINT=6 PACKAGE=eslint-config-airbnb-base
- node_js: "8"
env: TEST=true ESLINT=6 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=6 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=6 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=6 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
- node_js: "8"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=5 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=5 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb
- node_js: "8"
env: TEST=true ESLINT=5 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb
- node_js: "6"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
- node_js: "6"
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
"babel-preset-airbnb": "^4.5.0",
"babel-tape-runner": "^3.0.0",
"eclint": "^2.8.1",
"eslint": "^5.16.0 || ^6.8.0",
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0",
"eslint-find-rules": "^3.5.0",
"eslint-plugin-import": "^2.21.2",
"in-publish": "^2.0.1",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.1"
},
"peerDependencies": {
"eslint": "^5.16.0 || ^6.8.0",
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0",
"eslint-plugin-import": "^2.21.2"
},
"engines": {
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-config-airbnb-base/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ module.exports = {
// require default case in switch statements
'default-case': ['error', { commentPattern: '^no default$' }],

// Enforce default clauses in switch statements to be last
// https://eslint.org/docs/rules/default-case-last
// TODO: enable, semver-minor, when eslint v7 is required (which is a major)
'default-case-last': 'off',

// https://eslint.org/docs/rules/default-param-last
// TODO: enable, semver-minor, when eslint v6.4 is required (which is a major)
'default-param-last': 'off',
Expand Down
13 changes: 12 additions & 1 deletion packages/eslint-config-airbnb-base/rules/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ module.exports = {
// disallow irregular whitespace outside of strings and comments
'no-irregular-whitespace': 'error',

// Disallow Number Literals That Lose Precision
// https://eslint.org/docs/rules/no-loss-of-precision
// TODO: enable, semver-minor, once eslint v7.1 is required (which is major)
'no-loss-of-precision': 'off',

// Disallow characters which are made with multiple code points in character class syntax
// https://eslint.org/docs/rules/no-misleading-character-class
'no-misleading-character-class': 'error',
Expand Down Expand Up @@ -131,13 +136,19 @@ module.exports = {
// disallow negating the left operand of relational operators
// https://eslint.org/docs/rules/no-unsafe-negation
'no-unsafe-negation': 'error',

// Disallow useless backreferences in regular expressions
// https://eslint.org/docs/rules/no-useless-backreference
// TODO: enable, semver-minor, once eslint v7 is required (which is major)
'no-useless-backreference': 'off',

// disallow negation of the left operand of an in expression
// deprecated in favor of no-unsafe-negation
'no-negated-in-lhs': 'off',

// Disallow assignments that can lead to race conditions due to usage of await or yield
// https://eslint.org/docs/rules/require-atomic-updates
// TODO: enable, semver-major
// note: not enabled because it is very buggy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @ljharb !

Would you mind to share some cases where you faced bugs in this rule?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a couple threads on eslint core that are full of examples; i don’t have any off hand.

Copy link

@keann keann Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, might have guessed myself to look there. thx

'require-atomic-updates': 'off',

// disallow comparisons with the value NaN
Expand Down
10 changes: 10 additions & 0 deletions packages/eslint-config-airbnb-base/rules/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ module.exports = {
// https://eslint.org/docs/rules/no-new-symbol
'no-new-symbol': 'error',

// Disallow specified names in exports
// https://eslint.org/docs/rules/no-restricted-exports
// TODO enable, semver-minor, once eslint v7 is required (which is major)
'no-restricted-exports': ['off', {
restrictedNamedExports: [
'default', // use `export default` to provide a default export
'then', // this will cause tons of confusion when your module is dynamically `import()`ed
],
}],

// disallow specific imports
// https://eslint.org/docs/rules/no-restricted-imports
'no-restricted-imports': ['off', {
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"babel-preset-airbnb": "^4.5.0",
"babel-tape-runner": "^3.0.0",
"eclint": "^2.8.1",
"eslint": "^5.16.0 || ^6.8.0",
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0",
"eslint-find-rules": "^3.5.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
Expand All @@ -75,7 +75,7 @@
"tape": "^5.0.1"
},
"peerDependencies": {
"eslint": "^5.16.0 || ^6.8.0",
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
Expand Down