From c48a060aff9a4ba66003b18e6a27fd899581f95a Mon Sep 17 00:00:00 2001 From: Severiano Badajoz Date: Fri, 5 Jun 2020 15:09:12 -0700 Subject: [PATCH 001/171] [eslint config] [patch] set `explicitSpread` to ignore for `react/jsx-props-no-spreading` --- packages/eslint-config-airbnb/rules/react.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index e712f0d77f..84bbf6c162 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -494,6 +494,7 @@ module.exports = { 'react/jsx-props-no-spreading': ['error', { html: 'enforce', custom: 'enforce', + explicitSpread: 'ignore', exceptions: [], }], From d34f8074590e1497a9a90947181339435ce335d4 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 7 Jun 2020 20:05:48 -0700 Subject: [PATCH 002/171] [Deps] update `object.entries` --- packages/eslint-config-airbnb-base/package.json | 2 +- packages/eslint-config-airbnb/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index f5bdc3a5bf..5ef97f70b5 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -74,6 +74,6 @@ "dependencies": { "confusing-browser-globals": "^1.0.9", "object.assign": "^4.1.0", - "object.entries": "^1.1.1" + "object.entries": "^1.1.2" } } diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index baebcb04f5..4e0ad31f90 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -56,7 +56,7 @@ "dependencies": { "eslint-config-airbnb-base": "^14.1.0", "object.assign": "^4.1.0", - "object.entries": "^1.1.1" + "object.entries": "^1.1.2" }, "devDependencies": { "@babel/runtime": "^7.8.7", From 7aa0fa14d65d10e7bf259089d9964d41eb8ca5e0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 7 Jun 2020 20:50:43 -0700 Subject: [PATCH 003/171] [eslint config] [*] [deps] update `eslint-plugin-import`, `eslint-plugin-react`, `babel-preset-airbnb`, `eslint-find-rules`, `in-publish`, `tape` --- packages/eslint-config-airbnb-base/package.json | 12 ++++++------ packages/eslint-config-airbnb/package.json | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 5ef97f70b5..494b1aa879 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -54,19 +54,19 @@ "homepage": "https://github.com/airbnb/javascript", "devDependencies": { "@babel/runtime": "^7.8.7", - "babel-preset-airbnb": "^4.4.0", + "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0", - "eslint-find-rules": "^3.4.0", - "eslint-plugin-import": "^2.20.1", - "in-publish": "^2.0.0", + "eslint-find-rules": "^3.5.0", + "eslint-plugin-import": "^2.21.1", + "in-publish": "^2.0.1", "safe-publish-latest": "^1.1.4", - "tape": "^5.0.0-next.4" + "tape": "^5.0.1" }, "peerDependencies": { "eslint": "^5.16.0 || ^6.8.0", - "eslint-plugin-import": "^2.20.1" + "eslint-plugin-import": "^2.21.1" }, "engines": { "node": ">= 6" diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 4e0ad31f90..7f56732360 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -60,25 +60,25 @@ }, "devDependencies": { "@babel/runtime": "^7.8.7", - "babel-preset-airbnb": "^4.4.0", + "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0", - "eslint-find-rules": "^3.4.0", - "eslint-plugin-import": "^2.20.1", + "eslint-find-rules": "^3.5.0", + "eslint-plugin-import": "^2.21.1", "eslint-plugin-jsx-a11y": "^6.2.3", - "eslint-plugin-react": "^7.19.0", + "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^2.3.0 || ^1.7.0", - "in-publish": "^2.0.0", + "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^1.1.4", - "tape": "^5.0.0-next.4" + "tape": "^5.0.1" }, "peerDependencies": { "eslint": "^5.16.0 || ^6.8.0", - "eslint-plugin-import": "^2.20.1", + "eslint-plugin-import": "^2.21.1", "eslint-plugin-jsx-a11y": "^6.2.3", - "eslint-plugin-react": "^7.19.0", + "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^2.3.0 || ^1.7.0" }, "engines": { From cad3db31695631a7877cece8903eea1f41d59e03 Mon Sep 17 00:00:00 2001 From: Vlad Shcherbin Date: Sun, 7 Jun 2020 00:01:51 +0300 Subject: [PATCH 004/171] [eslint config] [base] [minor] Disallow multiple empty lines --- packages/eslint-config-airbnb-base/rules/style.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb-base/rules/style.js b/packages/eslint-config-airbnb-base/rules/style.js index cf5a7b5dd5..05f687171e 100644 --- a/packages/eslint-config-airbnb-base/rules/style.js +++ b/packages/eslint-config-airbnb-base/rules/style.js @@ -313,7 +313,7 @@ module.exports = { // disallow multiple empty lines, only one newline at the end, and no new lines at the beginning // https://eslint.org/docs/rules/no-multiple-empty-lines - 'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 0, maxEOF: 0 }], + 'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }], // disallow negated conditions // https://eslint.org/docs/rules/no-negated-condition From 8aee3e160053d07b4c156f0885fb5a6da4e19603 Mon Sep 17 00:00:00 2001 From: Vlad Shcherbin Date: Wed, 20 May 2020 13:21:10 +0300 Subject: [PATCH 005/171] [eslint config] [base] [patch] Include 'context' exception for `no-param-reassign` --- packages/eslint-config-airbnb-base/rules/best-practices.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-config-airbnb-base/rules/best-practices.js b/packages/eslint-config-airbnb-base/rules/best-practices.js index 4cf2de48d9..0307c64345 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -194,6 +194,7 @@ module.exports = { 'accumulator', // for reduce accumulators 'e', // for e.returnvalue 'ctx', // for Koa routing + 'context', // for Koa routing 'req', // for Express requests 'request', // for Express requests 'res', // for Express responses From b58700607707c7e280e5e266a884115cbcea806c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 10 Jun 2020 14:49:21 -0700 Subject: [PATCH 006/171] [eslint config] [*] [deps] update `eslint-plugin-import` --- packages/eslint-config-airbnb-base/package.json | 4 ++-- packages/eslint-config-airbnb/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 494b1aa879..2957b06427 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -59,14 +59,14 @@ "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0", "eslint-find-rules": "^3.5.0", - "eslint-plugin-import": "^2.21.1", + "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-plugin-import": "^2.21.1" + "eslint-plugin-import": "^2.21.2" }, "engines": { "node": ">= 6" diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 7f56732360..3d96a8a55e 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -65,7 +65,7 @@ "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0", "eslint-find-rules": "^3.5.0", - "eslint-plugin-import": "^2.21.1", + "eslint-plugin-import": "^2.21.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^2.3.0 || ^1.7.0", @@ -76,7 +76,7 @@ }, "peerDependencies": { "eslint": "^5.16.0 || ^6.8.0", - "eslint-plugin-import": "^2.21.1", + "eslint-plugin-import": "^2.21.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^2.3.0 || ^1.7.0" From fe2e451ba75b2ebfedc1cf4f9bf217f104b06a1d Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 10 Jun 2020 14:58:23 -0700 Subject: [PATCH 007/171] [Tests] add `node` `v14`; remove `v9`, `v11` --- .travis.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 458da3173f..a240129152 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: node_js node_js: + - "14" - "12" - - "11" - "10" - - "9" - "8" before_install: - 'nvm install-latest-npm' @@ -44,12 +43,6 @@ matrix: env: LINT=true PACKAGE=eslint-config-airbnb - node_js: "lts/*" env: LINT=true PACKAGE=eslint-config-airbnb-base - - node_js: "7" - env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base - - node_js: "7" - env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb - - node_js: "7" - 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" @@ -58,9 +51,6 @@ matrix: env: TEST=true ESLINT=5 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb exclude: allow_failures: - - node_js: "11" - - node_js: "9" - - node_js: "7" - env: PREPUBLISH=true ESLINT=6 PACKAGE=eslint-config-airbnb-base - env: PREPUBLISH=true ESLINT=6 PACKAGE=eslint-config-airbnb - env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb-base From 22adc06f56a94437a533c4935d6706a511b3dc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Poduszl=C3=B3?= Date: Fri, 10 Apr 2020 00:47:18 +0200 Subject: [PATCH 008/171] [eslint config] [minor] Allow using `eslint-plugin-react-hooks` v3 and v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kristóf Poduszló Co-authored-by: Jordan Harband --- .travis.yml | 16 ++++++++++++++++ packages/eslint-config-airbnb/package.json | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a240129152..ee392c7703 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,9 +18,13 @@ env: matrix: - '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' + - 'TEST=true ESLINT=6 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb' - 'TEST=true ESLINT=6 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb' - 'TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base' - 'TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb' + - 'TEST=true ESLINT=5 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb' + - 'TEST=true ESLINT=5 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb' - 'TEST=true ESLINT=5 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb' matrix: fast_finish: true @@ -29,12 +33,20 @@ matrix: env: PREPUBLISH=true ESLINT=6 PACKAGE=eslint-config-airbnb-base - node_js: "lts/*" env: PREPUBLISH=true ESLINT=6 PACKAGE=eslint-config-airbnb + - node_js: "lts/*" + env: PREPUBLISH=true ESLINT=6 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb + - node_js: "lts/*" + env: PREPUBLISH=true ESLINT=6 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb - node_js: "lts/*" env: PREPUBLISH=true ESLINT=6 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb - node_js: "lts/*" env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb-base - node_js: "lts/*" env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb + - node_js: "lts/*" + env: PREPUBLISH=true ESLINT=5 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb + - node_js: "lts/*" + env: PREPUBLISH=true ESLINT=5 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb - node_js: "lts/*" env: PREPUBLISH=true ESLINT=5 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb - node_js: "lts/*" @@ -47,6 +59,10 @@ matrix: env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base - node_js: "6" env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb + - node_js: "6" + env: TEST=true ESLINT=5 REACT_HOOKS=3 PACKAGE=eslint-config-airbnb + - node_js: "6" + env: TEST=true ESLINT=5 REACT_HOOKS=2.3 PACKAGE=eslint-config-airbnb - node_js: "6" env: TEST=true ESLINT=5 REACT_HOOKS=1.7 PACKAGE=eslint-config-airbnb exclude: diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 3d96a8a55e..0e08d078fc 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -68,7 +68,7 @@ "eslint-plugin-import": "^2.21.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.20.0", - "eslint-plugin-react-hooks": "^2.3.0 || ^1.7.0", + "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^1.1.4", @@ -79,7 +79,7 @@ "eslint-plugin-import": "^2.21.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.20.0", - "eslint-plugin-react-hooks": "^2.3.0 || ^1.7.0" + "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0" }, "engines": { "node": ">= 6" From 5b462a04cdfebba712a3df18926edfcb4103d2a9 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 10 Jun 2020 15:43:13 -0700 Subject: [PATCH 009/171] [eslint config] [*] [new] add `eslint` `v7` --- .travis.yml | 37 ++++++++++++++++++- .../eslint-config-airbnb-base/package.json | 4 +- .../rules/best-practices.js | 5 +++ .../eslint-config-airbnb-base/rules/errors.js | 13 ++++++- .../eslint-config-airbnb-base/rules/es6.js | 10 +++++ packages/eslint-config-airbnb/package.json | 4 +- 6 files changed, 67 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee392c7703..b7eb96d7ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ node_js: - "14" - "12" - "10" - - "8" before_install: - 'nvm install-latest-npm' install: @@ -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' @@ -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/*" @@ -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" diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 2957b06427..b691e1a3b2 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -57,7 +57,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", "in-publish": "^2.0.1", @@ -65,7 +65,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" }, "engines": { diff --git a/packages/eslint-config-airbnb-base/rules/best-practices.js b/packages/eslint-config-airbnb-base/rules/best-practices.js index 0307c64345..8e1d991304 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -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', diff --git a/packages/eslint-config-airbnb-base/rules/errors.js b/packages/eslint-config-airbnb-base/rules/errors.js index e4cd542683..15b6130a20 100644 --- a/packages/eslint-config-airbnb-base/rules/errors.js +++ b/packages/eslint-config-airbnb-base/rules/errors.js @@ -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', @@ -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 'require-atomic-updates': 'off', // disallow comparisons with the value NaN diff --git a/packages/eslint-config-airbnb-base/rules/es6.js b/packages/eslint-config-airbnb-base/rules/es6.js index bfdc6d29e4..02c616dad5 100644 --- a/packages/eslint-config-airbnb-base/rules/es6.js +++ b/packages/eslint-config-airbnb-base/rules/es6.js @@ -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', { diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 0e08d078fc..97703e59b0 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -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", @@ -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", From 78457af2c55cc62cf4379c190b7621a341814692 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 10 Jun 2020 23:25:49 -0700 Subject: [PATCH 010/171] [eslint config] [base] v14.2.0 --- packages/eslint-config-airbnb-base/CHANGELOG.md | 10 ++++++++++ packages/eslint-config-airbnb-base/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb-base/CHANGELOG.md b/packages/eslint-config-airbnb-base/CHANGELOG.md index 3d31c2426b..2dd956f691 100644 --- a/packages/eslint-config-airbnb-base/CHANGELOG.md +++ b/packages/eslint-config-airbnb-base/CHANGELOG.md @@ -1,3 +1,13 @@ +14.2.0 / 2020-06-10 +================== + - [new] add `eslint` `v7` + - [minor] Disallow multiple empty lines (#2238) + - [minor] Fix typo in no-multiple-empty-lines rule (#2168) + - [patch] Include 'context' exception for `no-param-reassign` (#2230) + - [patch] Allow triple-slash (///) comments (#2197) + - [patch] Disable `prefer-object-spread` for `airbnb-base/legacy` (#2198) + - [deps] update `eslint-plugin-import`, `eslint-plugin-react`, `babel-preset-airbnb`, `eslint-find-rules`, `in-publish`, `tape`, `object.entries` + 14.1.0 / 2020-03-12 ================== - [minor] add new disabled rules, update eslint diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index b691e1a3b2..cea08e9df9 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-airbnb-base", - "version": "14.1.0", + "version": "14.2.0", "description": "Airbnb's base JS ESLint config, following our styleguide", "main": "index.js", "scripts": { From 562e3519b874d91b369c5c6fe8a94408a380758b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 18 Jun 2020 11:53:53 -0700 Subject: [PATCH 011/171] [Dev Deps] update `markdownlint`, `markdownlint-cli` --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 36b4e19fab..e4fe0f3dea 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "markdownlint": "^0.19.0", - "markdownlint-cli": "^0.21.0" + "markdownlint": "^0.20.3", + "markdownlint-cli": "^0.23.1" } } From f550ded6dab8dac9d42f2dfa5f2ed9858f0fe045 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 18 Jun 2020 12:03:46 -0700 Subject: [PATCH 012/171] [eslint config] [tests] fix for eslint 7 --- packages/eslint-config-airbnb/test/test-react-order.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-config-airbnb/test/test-react-order.js b/packages/eslint-config-airbnb/test/test-react-order.js index 15dd8da2f6..d45cac8ae1 100644 --- a/packages/eslint-config-airbnb/test/test-react-order.js +++ b/packages/eslint-config-airbnb/test/test-react-order.js @@ -1,10 +1,10 @@ import test from 'tape'; -import { CLIEngine } from 'eslint'; +import { CLIEngine, ESLint } from 'eslint'; import eslintrc from '..'; import reactRules from '../rules/react'; import reactA11yRules from '../rules/react-a11y'; -const cli = new CLIEngine({ +const cli = new (CLIEngine || ESLint)({ useEslintrc: false, baseConfig: eslintrc, @@ -19,7 +19,7 @@ const cli = new CLIEngine({ function lint(text) { // @see https://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles // @see https://eslint.org/docs/developer-guide/nodejs-api.html#executeontext - const linter = cli.executeOnText(text); + const linter = CLIEngine ? cli.executeOnText(text) : cli.lintText(text); return linter.results[0]; } From 197b50c07627863e5b3524504bf4f3240a0e2537 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 18 Jun 2020 11:57:41 -0700 Subject: [PATCH 013/171] [eslint config] [deps] update `eslint-config-airbnb-base`, `eslint-plugin-jsx-a11y` --- packages/eslint-config-airbnb/package.json | 6 +++--- packages/eslint-config-airbnb/rules/react-a11y.js | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 97703e59b0..e66cc67033 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "dependencies": { - "eslint-config-airbnb-base": "^14.1.0", + "eslint-config-airbnb-base": "^14.2.0", "object.assign": "^4.1.0", "object.entries": "^1.1.2" }, @@ -66,7 +66,7 @@ "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", + "eslint-plugin-jsx-a11y": "^6.3.0", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0", "in-publish": "^2.0.1", @@ -77,7 +77,7 @@ "peerDependencies": { "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-jsx-a11y": "^6.3.0", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0" }, diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js index 69cf63b01f..85485b03bb 100644 --- a/packages/eslint-config-airbnb/rules/react-a11y.js +++ b/packages/eslint-config-airbnb/rules/react-a11y.js @@ -236,5 +236,11 @@ module.exports = { specialLink: ['to'], aspects: ['noHref', 'invalidHref', 'preferButton'], }], + + // Ensure the autocomplete attribute is correct and suitable for the form field it is used with + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md + 'jsx-a11y/autocomplete-valid': ['off', { + inputComponents: [], + }], }, }; From 54955410ee53fd82e6caa5879ccd0c413640706a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 18 Jun 2020 13:11:38 -0700 Subject: [PATCH 014/171] [eslint config] v18.2.0 --- packages/eslint-config-airbnb/CHANGELOG.md | 11 +++++++++++ packages/eslint-config-airbnb/package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb/CHANGELOG.md b/packages/eslint-config-airbnb/CHANGELOG.md index 4bb3083e8b..11595f01a6 100644 --- a/packages/eslint-config-airbnb/CHANGELOG.md +++ b/packages/eslint-config-airbnb/CHANGELOG.md @@ -1,3 +1,14 @@ +18.2.0 / 2020-06-18 +================== + - [new] add `eslint` `v7` (#2240) + - [minor] Allow using `eslint-plugin-react-hooks` v3 and v4 (#2235, #2207) + - [minor] Fix typo in no-multiple-empty-lines rule (#2168) + - [patch] set `explicitSpread` to ignore for `react/jsx-props-no-spreading` (#2237) + - [patch] relax `eslint-plugin-react-hooks` down to v2.3, due to a controversial change in v2.5 + - [readme] fix typo (#2194) + - [deps] update `eslint-config-airbnb-base`, `eslint-plugin-jsx-a11y`, `eslint-plugin-import`, `eslint-plugin-react`, `babel-preset-airbnb`, `eslint-find-rules`, `in-publish`, `tape`, `object.entries` + - [tests] fix for eslint 7 + 18.1.0 / 2020-03-12 ================== - [minor] Support eslint-plugin-react-hooks@2 (#2090) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index e66cc67033..2b4be69fdb 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-airbnb", - "version": "18.1.0", + "version": "18.2.0", "description": "Airbnb's ESLint config, following our styleguide", "main": "index.js", "scripts": { From 5124de23da0190b686850c9582e5a0960a607ae6 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 27 Jun 2020 13:22:33 -0700 Subject: [PATCH 015/171] [eslint config] [base] add new rules from v7.3 --- packages/eslint-config-airbnb-base/rules/errors.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/eslint-config-airbnb-base/rules/errors.js b/packages/eslint-config-airbnb-base/rules/errors.js index 15b6130a20..fa54905ef8 100644 --- a/packages/eslint-config-airbnb-base/rules/errors.js +++ b/packages/eslint-config-airbnb-base/rules/errors.js @@ -103,6 +103,11 @@ module.exports = { // disallow the use of object properties of the global object (Math and JSON) as functions 'no-obj-calls': 'error', + // Disallow returning values from Promise executor functions + // https://eslint.org/docs/rules/no-promise-executor-return + // TODO: enable, semver-minor, once eslint v7.3 is required (which is major) + 'no-promise-executor-return': 'off', + // disallow use of Object.prototypes builtins directly // https://eslint.org/docs/rules/no-prototype-builtins 'no-prototype-builtins': 'error', @@ -129,6 +134,13 @@ module.exports = { // disallow unreachable statements after a return, throw, continue, or break statement 'no-unreachable': 'error', + // Disallow loops with a body that allows only one iteration + // https://eslint.org/docs/rules/no-unreachable-loop + // TODO: enable, semver-minor, once eslint v7.3 is required (which is major) + 'no-unreachable-loop': ['off', { + ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement + }], + // disallow return/throw/break/continue inside finally blocks // https://eslint.org/docs/rules/no-unsafe-finally 'no-unsafe-finally': 'error', From c5bee75b1b358a3749f1a6d38ee6fad73de28e29 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 22 Jun 2020 22:55:52 -0700 Subject: [PATCH 016/171] [eslint config] [*] [deps] update `eslint-plugin-import`, use valid `import/no-cycle` `maxDepth` option --- packages/eslint-config-airbnb-base/package.json | 4 ++-- packages/eslint-config-airbnb-base/rules/imports.js | 2 +- packages/eslint-config-airbnb/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index cea08e9df9..146b7d5035 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -59,14 +59,14 @@ "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", "eslint-find-rules": "^3.5.0", - "eslint-plugin-import": "^2.21.2", + "eslint-plugin-import": "^2.22.0", "in-publish": "^2.0.1", "safe-publish-latest": "^1.1.4", "tape": "^5.0.1" }, "peerDependencies": { "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", - "eslint-plugin-import": "^2.21.2" + "eslint-plugin-import": "^2.22.0" }, "engines": { "node": ">= 6" diff --git a/packages/eslint-config-airbnb-base/rules/imports.js b/packages/eslint-config-airbnb-base/rules/imports.js index b88ace540f..95568d6103 100644 --- a/packages/eslint-config-airbnb-base/rules/imports.js +++ b/packages/eslint-config-airbnb-base/rules/imports.js @@ -233,7 +233,7 @@ module.exports = { // Forbid cyclical dependencies between modules // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md - 'import/no-cycle': ['error', { maxDepth: Infinity }], + 'import/no-cycle': ['error', { maxDepth: '∞' }], // Ensures that there are no useless path segments // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 2b4be69fdb..02c702ca76 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -65,7 +65,7 @@ "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", "eslint-find-rules": "^3.5.0", - "eslint-plugin-import": "^2.21.2", + "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsx-a11y": "^6.3.0", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0", @@ -76,7 +76,7 @@ }, "peerDependencies": { "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", - "eslint-plugin-import": "^2.21.2", + "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsx-a11y": "^6.3.0", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0" From 3dcc59112308211b6ac8478a4ad997ed3f17d9b1 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 5 Aug 2020 22:04:10 -0700 Subject: [PATCH 017/171] [eslint config] [base] add `id-denylist` rule --- packages/eslint-config-airbnb-base/rules/style.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/eslint-config-airbnb-base/rules/style.js b/packages/eslint-config-airbnb-base/rules/style.js index 05f687171e..8403ebb75b 100644 --- a/packages/eslint-config-airbnb-base/rules/style.js +++ b/packages/eslint-config-airbnb-base/rules/style.js @@ -107,8 +107,13 @@ module.exports = { // Blacklist certain identifiers to prevent them being used // https://eslint.org/docs/rules/id-blacklist + // TODO: semver-major, remove once eslint v7.4+ is required 'id-blacklist': 'off', + // disallow specified identifiers + // https://eslint.org/docs/rules/id-denylist + 'id-denylist': 'off', + // this option enforces minimum and maximum identifier lengths // (variable names, property names etc.) 'id-length': 'off', From 973384be1b4ec2c58c5d9ba113a54a10cb757b96 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 5 Aug 2020 22:06:20 -0700 Subject: [PATCH 018/171] [eslint config] [*] [dev deps] update `@babel/runtime`, `eslint-find-rules`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react` --- packages/eslint-config-airbnb-base/package.json | 4 ++-- packages/eslint-config-airbnb/package.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 146b7d5035..7bb31343e5 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -53,12 +53,12 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "@babel/runtime": "^7.8.7", + "@babel/runtime": "^7.11.2", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", - "eslint-find-rules": "^3.5.0", + "eslint-find-rules": "^3.6.0", "eslint-plugin-import": "^2.22.0", "in-publish": "^2.0.1", "safe-publish-latest": "^1.1.4", diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 02c702ca76..105b3811a6 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -59,15 +59,15 @@ "object.entries": "^1.1.2" }, "devDependencies": { - "@babel/runtime": "^7.8.7", + "@babel/runtime": "^7.11.2", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", - "eslint-find-rules": "^3.5.0", + "eslint-find-rules": "^3.6.0", "eslint-plugin-import": "^2.22.0", - "eslint-plugin-jsx-a11y": "^6.3.0", - "eslint-plugin-react": "^7.20.0", + "eslint-plugin-jsx-a11y": "^6.3.1", + "eslint-plugin-react": "^7.20.5", "eslint-plugin-react-hooks": "^4 || ^3 || ^2.3.0 || ^1.7.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", From 1dc71d38395633f9f9099614765bd4361c9a9c64 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 3 Aug 2020 09:36:24 -0700 Subject: [PATCH 019/171] [guide] [react] add missing PascalCase guidance for prop names --- react/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/react/README.md b/react/README.md index 99518e5a75..d964d17a30 100644 --- a/react/README.md +++ b/react/README.md @@ -267,7 +267,7 @@ This style guide is mostly based on the standards that are currently prevalent i ## Props - - Always use camelCase for prop names. + - Always use camelCase for prop names, or PascalCase if the prop value is a React component. ```jsx // bad @@ -280,6 +280,7 @@ This style guide is mostly based on the standards that are currently prevalent i ``` From a24dc34a4a2748c99006a48e997aa0a06b1d4d94 Mon Sep 17 00:00:00 2001 From: Akshath Sivaprasad Date: Wed, 5 Aug 2020 21:38:20 -0700 Subject: [PATCH 020/171] [guide] [react] Add examples for formatting multiline conditional components --- react/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/react/README.md b/react/README.md index d964d17a30..4811ddaf70 100644 --- a/react/README.md +++ b/react/README.md @@ -214,6 +214,27 @@ This style guide is mostly based on the standards that are currently prevalent i // good {showButton &&