From 5155aa5fc1ea9bb2c6493a06ddbd5c7a05414c86 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 8 Aug 2022 21:56:10 +0800 Subject: [PATCH 01/61] [eslint config] [base] disable the deprecated `no-spaced-func` rule This rule was deprecated since ESLint v3.3.0 and replaced by the `func-call-spacing` rule. https://eslint.org/docs/latest/rules/no-spaced-func `func-call-spacing` was enabled in this package long ago: https://github.com/airbnb/javascript/commit/27dcb99c6d80718946d10017144b2aa68bed8b9e So there's no need for it to stay in the ruleset. Besides, it is causing some tricky issues when overriding the rules for TypeScript support (https://github.com/iamturns/eslint-config-airbnb-typescript/issues/246) --- packages/eslint-config-airbnb-base/rules/style.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb-base/rules/style.js b/packages/eslint-config-airbnb-base/rules/style.js index 4fad26be00..bc83e858e1 100644 --- a/packages/eslint-config-airbnb-base/rules/style.js +++ b/packages/eslint-config-airbnb-base/rules/style.js @@ -351,7 +351,8 @@ module.exports = { ], // disallow space between function identifier and application - 'no-spaced-func': 'error', + // deprecated in favor of func-call-spacing + 'no-spaced-func': 'off', // disallow tab characters entirely 'no-tabs': 'error', From 3cbf96de7cde974aab99f4ca85bd23ea0556c34a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Sep 2022 22:08:04 -0700 Subject: [PATCH 02/61] [eslint config] [base] `no-alert`: add TODO comment --- 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 31f74b51c0..90c34ccfa1 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -67,6 +67,7 @@ module.exports = { // disallow the use of alert, confirm, and prompt // https://eslint.org/docs/rules/no-alert + // TODO: enable, semver-major 'no-alert': 'warn', // disallow use of arguments.caller or arguments.callee From 5143a7a97a6969dd690fb905acee54d9f753667c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Sep 2022 22:16:08 -0700 Subject: [PATCH 03/61] [Dev Deps] update `markdownlint`, `markdownlint-cli` --- README.md | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3b1af22597..b2fc7d9d2c 100644 --- a/README.md +++ b/README.md @@ -3739,7 +3739,7 @@ Other Style Guides - Be cautious about stubs and mocks - they can make your tests more brittle. - We primarily use [`mocha`](https://www.npmjs.com/package/mocha) and [`jest`](https://www.npmjs.com/package/jest) at Airbnb. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules. - 100% test coverage is a good goal to strive for, even if it’s not always practical to reach it. - - Whenever you fix a bug, _write a regression test_. A bug fixed without a regression test is almost certainly going to break again in the future. + - Whenever you fix a bug, *write a regression test*. A bug fixed without a regression test is almost certainly going to break again in the future. **[⬆ back to top](#table-of-contents)** diff --git a/package.json b/package.json index 77adc2e32d..04e7d56121 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "markdownlint": "^0.20.4", - "markdownlint-cli": "^0.23.2" + "markdownlint": "^0.26.2", + "markdownlint-cli": "^0.32.2" } } From 866f441d05ae07fccdd7e6c3946125875594d6f3 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Sep 2022 22:18:17 -0700 Subject: [PATCH 04/61] [eslint config] [*] update `@babel/runtime`, `tape` --- 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 8dc7924fa5..91d032ed76 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -68,7 +68,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "@babel/runtime": "^7.18.0", + "@babel/runtime": "^7.19.0", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", @@ -77,7 +77,7 @@ "eslint-plugin-import": "^2.26.0", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.5.3" + "tape": "^5.6.0" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index fdb9073ad5..8fc0f7dcf8 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -71,7 +71,7 @@ "object.entries": "^1.1.5" }, "devDependencies": { - "@babel/runtime": "^7.18.0", + "@babel/runtime": "^7.19.0", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", @@ -84,7 +84,7 @@ "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", - "tape": "^5.5.3" + "tape": "^5.6.0" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", From f6f63b89f602006278eff0ba4ad3cae617705cc3 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Sep 2022 22:18:57 -0700 Subject: [PATCH 05/61] [eslint config] [*] [deps] update `object.assign` --- 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 91d032ed76..f758c7eebb 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -88,7 +88,7 @@ }, "dependencies": { "confusing-browser-globals": "^1.0.11", - "object.assign": "^4.1.2", + "object.assign": "^4.1.4", "object.entries": "^1.1.5" } } diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 8fc0f7dcf8..8b99aa420a 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -67,7 +67,7 @@ "homepage": "https://github.com/airbnb/javascript", "dependencies": { "eslint-config-airbnb-base": "^15.0.0", - "object.assign": "^4.1.2", + "object.assign": "^4.1.4", "object.entries": "^1.1.5" }, "devDependencies": { From 75a908aacfe9ad86a18f3930cfff9c4636ffd644 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Sep 2022 22:21:48 -0700 Subject: [PATCH 06/61] [eslint config] [deps] update `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `eslint-plugin-react-hooks` --- packages/eslint-config-airbnb/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 8b99aa420a..ef4cd9632b 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -78,9 +78,9 @@ "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-react": "^7.30.0", - "eslint-plugin-react-hooks": "^4.5.0", + "eslint-plugin-jsx-a11y": "^6.6.1", + "eslint-plugin-react": "^7.31.8", + "eslint-plugin-react-hooks": "^4.6.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", @@ -89,9 +89,9 @@ "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-react": "^7.30.0", - "eslint-plugin-react-hooks": "^4.5.0" + "eslint-plugin-jsx-a11y": "^6.6.1", + "eslint-plugin-react": "^7.31.8", + "eslint-plugin-react-hooks": "^4.6.0" }, "engines": { "node": "^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0" From 7dbb7b154ffe38297f451440e7f59e3876a18ef7 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 25 Oct 2022 09:42:25 -0700 Subject: [PATCH 07/61] [eslint config] [base] add disabled `logical-assignment-operators` rule --- packages/eslint-config-airbnb-base/rules/style.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/eslint-config-airbnb-base/rules/style.js b/packages/eslint-config-airbnb-base/rules/style.js index bc83e858e1..2e7f6fed44 100644 --- a/packages/eslint-config-airbnb-base/rules/style.js +++ b/packages/eslint-config-airbnb-base/rules/style.js @@ -191,6 +191,13 @@ module.exports = { after: 'always', }], + // Require or disallow logical assignment logical operator shorthand + // https://eslint.org/docs/latest/rules/logical-assignment-operators + // TODO, semver-major: enable + 'logical-assignment-operators': ['off', 'always', { + enforceForIfStatements: true, + }], + // specify the maximum depth that blocks can be nested 'max-depth': ['off', 4], From 0b1f62372ee0ce9e228a1a9a98d948d323d1737f Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Tue, 25 Oct 2022 16:03:37 +0300 Subject: [PATCH 08/61] [editorial] convert example to use single instead of double quotes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2fc7d9d2c..b351fda1c6 100644 --- a/README.md +++ b/README.md @@ -3131,7 +3131,7 @@ Other Style Guides }); // good - const reaction = "No! That’s impossible!"; + const reaction = 'No! That’s impossible!'; (async function meanwhileOnTheFalcon() { // handle `leia`, `lando`, `chewie`, `r2`, `c3p0` // ... From ca0ff97f17f355d10afc7ccd4f5ae11815d62637 Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Tue, 25 Oct 2022 23:26:56 +0300 Subject: [PATCH 09/61] [guide] add Nullish Coalescing operator --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b351fda1c6..422d6ad79c 100644 --- a/README.md +++ b/README.md @@ -2096,11 +2096,13 @@ Other Style Guides const foo = a ? a : b; const bar = c ? true : false; const baz = c ? false : true; + const quux = a != null ? a : b; // good const foo = a || b; const bar = !!c; const baz = !c; + const quux = a ?? b; ``` From 6fb4f8e878264f7b913dc29bc6919520eb6be6c8 Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Wed, 26 Oct 2022 00:06:26 +0300 Subject: [PATCH 10/61] [guide] add Optional Chaining --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 422d6ad79c..f3daaa8860 100644 --- a/README.md +++ b/README.md @@ -2852,6 +2852,14 @@ Other Style Guides && jsonData.foo.bar.baz.quux && jsonData.foo.bar.baz.quux.xyzzy; + // better + const foo = jsonData + ?.foo + ?.bar + ?.baz + ?.quux + ?.xyzzy; + // good $.ajax({ method: 'POST', From 6947138ee34319133da0e28a0e59abad987f1586 Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Wed, 26 Oct 2022 16:17:38 +0300 Subject: [PATCH 11/61] [guide] add comma to the end of the property --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f3daaa8860..a37f14536e 100644 --- a/README.md +++ b/README.md @@ -2509,7 +2509,7 @@ Other Style Guides } // bad - dog.set('attr',{ + dog.set('attr', { age: '1 year', breed: 'Bernese Mountain Dog', }); @@ -2609,7 +2609,7 @@ Other Style Guides // bad const leds = stage.selectAll('.led').data(data).enter().append('svg:svg').classed('led', true) .attr('width', (radius + margin) * 2).append('svg:g') - .attr('transform', `translate(${radius + margin},${radius + margin})`) + .attr('transform', `translate(${radius + margin}, ${radius + margin})`) .call(tron.led); // good @@ -2619,7 +2619,7 @@ Other Style Guides .classed('led', true) .attr('width', (radius + margin) * 2) .append('svg:g') - .attr('transform', `translate(${radius + margin},${radius + margin})`) + .attr('transform', `translate(${radius + margin}, ${radius + margin})`) .call(tron.led); // good @@ -2627,7 +2627,7 @@ Other Style Guides const svg = leds.enter().append('svg:svg'); svg.classed('led', true).attr('width', (radius + margin) * 2); const g = svg.append('svg:g'); - g.attr('transform', `translate(${radius + margin},${radius + margin})`).call(tron.led); + g.attr('transform', `translate(${radius + margin}, ${radius + margin})`).call(tron.led); ``` @@ -3481,7 +3481,7 @@ Other Style Guides // good export const MAPPING = { - key: 'value' + key: 'value', }; ``` From c6b1a43c489d2c242f9c6c6d12966c95d27d9dfa Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Wed, 26 Oct 2022 13:44:17 +0300 Subject: [PATCH 12/61] [guide] rename `qux` to `quux` Fixes #2661 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a37f14536e..5dd908f954 100644 --- a/README.md +++ b/README.md @@ -2702,7 +2702,7 @@ Other Style Guides // bad if (baz) { - console.log(qux); + console.log(quux); } else { console.log(foo); @@ -2723,7 +2723,7 @@ Other Style Guides // good if (baz) { - console.log(qux); + console.log(quux); } else { console.log(foo); } From 38f1488918ef19f56191e855f624fa5da988d547 Mon Sep 17 00:00:00 2001 From: Maksim Ploski <50287455+plplmax@users.noreply.github.com> Date: Mon, 31 Oct 2022 21:57:59 +0300 Subject: [PATCH 13/61] [guide] fix typo in `space-before-blocks` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5dd908f954..94da6593ab 100644 --- a/README.md +++ b/README.md @@ -2509,7 +2509,7 @@ Other Style Guides } // bad - dog.set('attr', { + dog.set('attr',{ age: '1 year', breed: 'Bernese Mountain Dog', }); From 1fb7d76adde6f0822471c924bfda4ccd49879bc0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 17 Nov 2022 13:56:33 -0800 Subject: [PATCH 14/61] [eslint config] [patch] add new disabled core rules --- packages/eslint-config-airbnb-base/rules/best-practices.js | 5 +++++ packages/eslint-config-airbnb-base/rules/errors.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/eslint-config-airbnb-base/rules/best-practices.js b/packages/eslint-config-airbnb-base/rules/best-practices.js index 90c34ccfa1..944fe71a05 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -104,6 +104,11 @@ module.exports = { // https://eslint.org/docs/rules/no-empty-pattern 'no-empty-pattern': 'error', + // Disallow empty static blocks + // https://eslint.org/docs/latest/rules/no-empty-static-block + // TODO: semver-major, enable + 'no-empty-static-block': 'off', + // disallow comparisons to null without a type-checking operator // https://eslint.org/docs/rules/no-eq-null 'no-eq-null': 'off', diff --git a/packages/eslint-config-airbnb-base/rules/errors.js b/packages/eslint-config-airbnb-base/rules/errors.js index 7770d5cb86..a3dda4e510 100644 --- a/packages/eslint-config-airbnb-base/rules/errors.js +++ b/packages/eslint-config-airbnb-base/rules/errors.js @@ -105,6 +105,11 @@ module.exports = { // disallow the use of object properties of the global object (Math and JSON) as functions 'no-obj-calls': 'error', + // Disallow new operators with global non-constructor functions + // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor + // TODO: semver-major, enable + 'no-new-native-nonconstructor': 'off', + // Disallow returning values from Promise executor functions // https://eslint.org/docs/rules/no-promise-executor-return 'no-promise-executor-return': 'error', From 0d747c6d96f94e54d24d8c005da0c87105bf0fd5 Mon Sep 17 00:00:00 2001 From: Pushpendra Pal <94526347+Pushpendra100@users.noreply.github.com> Date: Mon, 14 Nov 2022 04:54:20 +0530 Subject: [PATCH 15/61] [readme] add space before code blocks --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 94da6593ab..1bc228da5d 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ Other Style Guides - `symbol` - `bigint` +
+ ```javascript const foo = 1; let bar = foo; @@ -91,6 +93,8 @@ Other Style Guides - `array` - `function` +
+ ```javascript const foo = [1, 2]; const bar = foo; From 49d08a2f134f4d6524e99aacce57914b8957994e Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Sat, 29 Oct 2022 23:49:43 +0300 Subject: [PATCH 16/61] [readme] prefer `const`/`let` over `var` in examples 2.1 Use const for all of your references; avoid using var. eslint: prefer-const, no-const-assign --- README.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 1bc228da5d..59c1aaf3e9 100644 --- a/README.md +++ b/README.md @@ -778,7 +778,7 @@ Other Style Guides > Why? They are confusing to reason about. ```javascript - var b = 1; + let b = 1; // bad function count(a = b++) { console.log(a); @@ -811,10 +811,10 @@ Other Style Guides ```javascript // bad - var add = new Function('a', 'b', 'return a + b'); + const add = new Function('a', 'b', 'return a + b'); // still bad - var subtract = Function('a', 'b', 'return a - b'); + const subtract = Function('a', 'b', 'return a - b'); ``` @@ -1830,14 +1830,14 @@ Other Style Guides ```javascript // bad - var some_unused_var = 42; + const some_unused_var = 42; // Write-only variables are not considered as used. - var y = 10; + let y = 10; y = 5; // A read for a modification of itself is not considered as used. - var z = 0; + let z = 0; z = z + 1; // Unused function arguments. @@ -1851,14 +1851,14 @@ Other Style Guides return x + y; } - var x = 1; - var y = a + 2; + const x = 1; + const y = a + 2; alert(getXPlusY(x, y)); // 'type' is ignored even if unused because it has a rest property sibling. // This is a form of extracting an object that omits the specified keys. - var { type, ...coords } = data; + const { type, ...coords } = data; // 'coords' is now the 'data' object without its 'type' property. ``` @@ -2892,12 +2892,12 @@ Other Style Guides ```javascript // bad - var foo = 1,bar = 2; - var arr = [1 , 2]; + const foo = 1,bar = 2; + const arr = [1 , 2]; // good - var foo = 1, bar = 2; - var arr = [1, 2]; + const foo = 1, bar = 2; + const arr = [1, 2]; ``` @@ -2907,13 +2907,13 @@ Other Style Guides // bad obj[foo ] obj[ 'foo'] - var x = {[ b ]: a} + const x = {[ b ]: a} obj[foo[ bar ]] // good obj[foo] obj['foo'] - var x = { [b]: a } + const x = { [b]: a } obj[foo[bar]] ``` @@ -2936,11 +2936,11 @@ Other Style Guides ```javascript // bad - var obj = { foo : 42 }; - var obj2 = { foo:42 }; + const obj = { foo : 42 }; + const obj2 = { foo:42 }; // good - var obj = { foo: 42 }; + const obj = { foo: 42 }; ``` @@ -2952,24 +2952,24 @@ Other Style Guides ```javascript // bad - multiple empty lines - var x = 1; + const x = 1; - var y = 2; + const y = 2; // bad - 2+ newlines at end of file - var x = 1; - var y = 2; + const x = 1; + const y = 2; // bad - 1+ newline(s) at beginning of file - var x = 1; - var y = 2; + const x = 1; + const y = 2; // good - var x = 1; - var y = 2; + const x = 1; + const y = 2; ``` From d60170173096486bde4eff320a22148e79acff48 Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Sun, 30 Oct 2022 02:00:29 +0300 Subject: [PATCH 17/61] [readme] wayback machine, or remove, broken links --- README.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 59c1aaf3e9..273cb92542 100644 --- a/README.md +++ b/README.md @@ -3213,7 +3213,7 @@ Other Style Guides ``` - - [22.4](#coercion--comment-deviations) If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](https://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you’re doing. + - [22.4](#coercion--comment-deviations) If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](https://web.archive.org/web/20200414205431/https://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you’re doing. ```javascript // good @@ -3636,7 +3636,7 @@ Other Style Guides ``` - - [26.3](#jquery--queries) For DOM queries use Cascading `$('.sidebar ul')` or parent > child `$('.sidebar > ul')`. [jsPerf](https://jsperf.com/jquery-find-vs-context-sel/16) + - [26.3](#jquery--queries) For DOM queries use Cascading `$('.sidebar ul')` or parent > child `$('.sidebar > ul')`. [jsPerf](https://web.archive.org/web/20200414183810/https://jsperf.com/jquery-find-vs-context-sel/16) - [26.4](#jquery--find) Use `find` with scoped jQuery object queries. @@ -3760,12 +3760,12 @@ Other Style Guides ## Performance - [On Layout & Web Performance](https://www.kellegous.com/j/2013/01/26/layout-performance/) - - [String vs Array Concat](https://jsperf.com/string-vs-array-concat/2) - - [Try/Catch Cost In a Loop](https://jsperf.com/try-catch-in-loop-cost/12) - - [Bang Function](https://jsperf.com/bang-function) - - [jQuery Find vs Context, Selector](https://jsperf.com/jquery-find-vs-context-sel/164) - - [innerHTML vs textContent for script text](https://jsperf.com/innerhtml-vs-textcontent-for-script-text) - - [Long String Concatenation](https://jsperf.com/ya-string-concat/38) + - [String vs Array Concat](https://web.archive.org/web/20200414200857/https://jsperf.com/string-vs-array-concat/2) + - [Try/Catch Cost In a Loop](https://web.archive.org/web/20200414190827/https://jsperf.com/try-catch-in-loop-cost/12) + - [Bang Function](https://web.archive.org/web/20200414205426/https://jsperf.com/bang-function) + - [jQuery Find vs Context, Selector](https://web.archive.org/web/20200414200850/https://jsperf.com/jquery-find-vs-context-sel/164) + - [innerHTML vs textContent for script text](https://web.archive.org/web/20200414205428/https://jsperf.com/innerhtml-vs-textcontent-for-script-text) + - [Long String Concatenation](https://web.archive.org/web/20200414203914/https://jsperf.com/ya-string-concat/38) - [Are JavaScript functions like `map()`, `reduce()`, and `filter()` optimized for traversing arrays?](https://www.quora.com/JavaScript-programming-language-Are-Javascript-functions-like-map-reduce-and-filter-already-optimized-for-traversing-array/answer/Quildreen-Motta) - Loading... @@ -3829,7 +3829,7 @@ Other Style Guides - [Superhero.js](http://superherojs.com/) - Kim Joar Bekkelund, Mads Mobæk, & Olav Bjorkoy - [JSBooks](https://jsbooks.revolunet.com/) - Julien Bouquillon - [Third Party JavaScript](https://www.manning.com/books/third-party-javascript) - Ben Vinegar and Anton Kovalyov - - [Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript](https://amzn.com/0321812182) - David Herman + - [Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript](https://amzn.com/dp/0321812182) - David Herman - [Eloquent JavaScript](https://eloquentjavascript.net/) - Marijn Haverbeke - [You Don’t Know JS: ES6 & Beyond](https://shop.oreilly.com/product/0636920033769.do) - Kyle Simpson @@ -3911,16 +3911,15 @@ Other Style Guides - **MinnPost**: [MinnPost/javascript](https://github.com/MinnPost/javascript) - **MitocGroup**: [MitocGroup/javascript](https://github.com/MitocGroup/javascript) - **Muber**: [muber](https://github.com/muber/) - - **National Geographic**: [natgeo](https://github.com/natgeo/) + - **National Geographic Society**: [natgeosociety](https://github.com/natgeosociety/) - **NullDev**: [NullDevCo/JavaScript-Styleguide](https://github.com/NullDevCo/JavaScript-Styleguide) - **Nulogy**: [nulogy/javascript](https://github.com/nulogy/javascript) - **Orange Hill Development**: [orangehill/javascript](https://github.com/orangehill/javascript) - **Orion Health**: [orionhealth/javascript](https://github.com/orionhealth/javascript) - - **OutBoxSoft**: [OutBoxSoft/javascript](https://github.com/OutBoxSoft/javascript) - **Peerby**: [Peerby/javascript](https://github.com/Peerby/javascript) - **Pier 1**: [Pier1/javascript](https://github.com/pier1/javascript) - **Qotto**: [Qotto/javascript-style-guide](https://github.com/Qotto/javascript-style-guide) - - **React**: [facebook.github.io/react/contributing/how-to-contribute.html#style-guide](https://facebook.github.io/react/contributing/how-to-contribute.html#style-guide) + - **React**: [reactjs.org/docs/how-to-contribute.html#style-guide](https://reactjs.org/docs/how-to-contribute.html#style-guide) - **REI**: [reidev/js-style-guide](https://github.com/rei/code-style-guides/) - **Ripple**: [ripple/javascript-style-guide](https://github.com/ripple/javascript-style-guide) - **Sainsbury’s Supermarkets**: [jsainsburyplc](https://github.com/jsainsburyplc) From 4ef69edc633972a559cb7418e8aee8172cc9fbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Sun, 4 Dec 2022 00:32:01 +0300 Subject: [PATCH 18/61] [Tests] refactor test paths --- packages/eslint-config-airbnb-base/test/test-base.js | 5 +++-- packages/eslint-config-airbnb/test/test-base.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-airbnb-base/test/test-base.js b/packages/eslint-config-airbnb-base/test/test-base.js index 181e04f453..4380bf5567 100644 --- a/packages/eslint-config-airbnb-base/test/test-base.js +++ b/packages/eslint-config-airbnb-base/test/test-base.js @@ -6,9 +6,10 @@ import index from '..'; const files = { ...{ index } }; // object spread is to test parsing -fs.readdirSync(path.join(__dirname, '../rules')).forEach((name) => { +const rulesDir = path.join(__dirname, '../rules'); +fs.readdirSync(rulesDir).forEach((name) => { // eslint-disable-next-line import/no-dynamic-require - files[name] = require(`../rules/${name}`); // eslint-disable-line global-require + files[name] = require(path.join(rulesDir, name)); // eslint-disable-line global-require }); Object.keys(files).forEach(( diff --git a/packages/eslint-config-airbnb/test/test-base.js b/packages/eslint-config-airbnb/test/test-base.js index c283c3410c..8f3f054d29 100644 --- a/packages/eslint-config-airbnb/test/test-base.js +++ b/packages/eslint-config-airbnb/test/test-base.js @@ -6,13 +6,14 @@ const base = require('../base'); const files = { base }; -fs.readdirSync(path.join(__dirname, '../rules')).forEach((name) => { +const rulesDir = path.join(__dirname, '../rules'); +fs.readdirSync(rulesDir).forEach((name) => { if (name === 'react.js' || name === 'react-a11y.js') { return; } // eslint-disable-next-line import/no-dynamic-require - files[name] = require(`../rules/${name}`); // eslint-disable-line global-require + files[name] = require(path.join(rulesDir, name)); // eslint-disable-line global-require }); Object.keys(files).forEach((name) => { From 81157eec2309449b31f36bf8940493623f2530c6 Mon Sep 17 00:00:00 2001 From: Mustafa UZUN Date: Thu, 17 Nov 2022 20:15:09 +0300 Subject: [PATCH 19/61] [guide] add `Object.hasOwn` --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 273cb92542..db3bc6f31d 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,8 @@ Other Style Guides /* or */ import has from 'has'; // https://www.npmjs.com/package/has console.log(has(object, key)); + /* or */ + console.log(Object.hasOwn(object, key)); // https://www.npmjs.com/package/object.hasown ``` From fd96a4fd57be26d4d9d2f2d24b373a2df7c23548 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 30 Dec 2022 14:48:36 -0800 Subject: [PATCH 20/61] [eslint config] [*] [refactor] use object spread instead of `Object.assign` --- packages/eslint-config-airbnb-base/package.json | 1 - packages/eslint-config-airbnb-base/whitespace-async.js | 3 +-- packages/eslint-config-airbnb-base/whitespace.js | 3 +-- packages/eslint-config-airbnb/package.json | 1 - packages/eslint-config-airbnb/rules/react.js | 6 +++--- packages/eslint-config-airbnb/whitespace-async.js | 3 +-- packages/eslint-config-airbnb/whitespace.js | 3 +-- 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index f758c7eebb..25bcb9cfd3 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -88,7 +88,6 @@ }, "dependencies": { "confusing-browser-globals": "^1.0.11", - "object.assign": "^4.1.4", "object.entries": "^1.1.5" } } diff --git a/packages/eslint-config-airbnb-base/whitespace-async.js b/packages/eslint-config-airbnb-base/whitespace-async.js index 55c5161235..d6742fb7c4 100755 --- a/packages/eslint-config-airbnb-base/whitespace-async.js +++ b/packages/eslint-config-airbnb-base/whitespace-async.js @@ -1,6 +1,5 @@ #!/usr/bin/env node -const assign = require('object.assign'); const entries = require('object.entries'); const { ESLint } = require('eslint'); @@ -20,7 +19,7 @@ function getSeverity(ruleConfig) { } async function onlyErrorOnRules(rulesToError, config) { - const errorsOnly = assign({}, config); + const errorsOnly = { ...config }; const cli = new ESLint({ useEslintrc: false, baseConfig: config diff --git a/packages/eslint-config-airbnb-base/whitespace.js b/packages/eslint-config-airbnb-base/whitespace.js index dfdf95a18e..f4b93bb492 100644 --- a/packages/eslint-config-airbnb-base/whitespace.js +++ b/packages/eslint-config-airbnb-base/whitespace.js @@ -4,7 +4,6 @@ const { CLIEngine } = require('eslint'); if (CLIEngine) { /* eslint no-inner-declarations: 0 */ - const assign = require('object.assign'); const entries = require('object.entries'); const whitespaceRules = require('./whitespaceRules'); @@ -23,7 +22,7 @@ if (CLIEngine) { } function onlyErrorOnRules(rulesToError, config) { - const errorsOnly = assign({}, config); + const errorsOnly = { ...config }; const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); const baseRules = cli.getConfigForFile(require.resolve('./')).rules; diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index ef4cd9632b..0ad2313195 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -67,7 +67,6 @@ "homepage": "https://github.com/airbnb/javascript", "dependencies": { "eslint-config-airbnb-base": "^15.0.0", - "object.assign": "^4.1.4", "object.entries": "^1.1.5" }, "devDependencies": { diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index f1dfd20788..447576d18a 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -1,4 +1,3 @@ -const assign = require('object.assign'); const baseStyleRules = require('eslint-config-airbnb-base/rules/style').rules; const dangleRules = baseStyleRules['no-underscore-dangle']; @@ -17,9 +16,10 @@ module.exports = { // View link below for react rules documentation // https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules rules: { - 'no-underscore-dangle': [dangleRules[0], assign({}, dangleRules[1], { + 'no-underscore-dangle': [dangleRules[0], { + ...dangleRules[1], allow: dangleRules[1].allow.concat(['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__']), - })], + }], // Specify whether double or single quotes should be used in JSX attributes // https://eslint.org/docs/rules/jsx-quotes diff --git a/packages/eslint-config-airbnb/whitespace-async.js b/packages/eslint-config-airbnb/whitespace-async.js index 55c5161235..d6742fb7c4 100755 --- a/packages/eslint-config-airbnb/whitespace-async.js +++ b/packages/eslint-config-airbnb/whitespace-async.js @@ -1,6 +1,5 @@ #!/usr/bin/env node -const assign = require('object.assign'); const entries = require('object.entries'); const { ESLint } = require('eslint'); @@ -20,7 +19,7 @@ function getSeverity(ruleConfig) { } async function onlyErrorOnRules(rulesToError, config) { - const errorsOnly = assign({}, config); + const errorsOnly = { ...config }; const cli = new ESLint({ useEslintrc: false, baseConfig: config diff --git a/packages/eslint-config-airbnb/whitespace.js b/packages/eslint-config-airbnb/whitespace.js index dfdf95a18e..f4b93bb492 100644 --- a/packages/eslint-config-airbnb/whitespace.js +++ b/packages/eslint-config-airbnb/whitespace.js @@ -4,7 +4,6 @@ const { CLIEngine } = require('eslint'); if (CLIEngine) { /* eslint no-inner-declarations: 0 */ - const assign = require('object.assign'); const entries = require('object.entries'); const whitespaceRules = require('./whitespaceRules'); @@ -23,7 +22,7 @@ if (CLIEngine) { } function onlyErrorOnRules(rulesToError, config) { - const errorsOnly = assign({}, config); + const errorsOnly = { ...config }; const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); const baseRules = cli.getConfigForFile(require.resolve('./')).rules; From 8091e39343b86ccc8524ed068cd218a3fd928105 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 8 Feb 2023 22:11:42 -0800 Subject: [PATCH 21/61] [*] [dev deps] update `@babel/runtime`, `tape` --- 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 25bcb9cfd3..9b71edda09 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -68,7 +68,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "@babel/runtime": "^7.19.0", + "@babel/runtime": "^7.20.13", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", @@ -77,7 +77,7 @@ "eslint-plugin-import": "^2.26.0", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.0" + "tape": "^5.6.3" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 0ad2313195..31af4bae6d 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -70,7 +70,7 @@ "object.entries": "^1.1.5" }, "devDependencies": { - "@babel/runtime": "^7.19.0", + "@babel/runtime": "^7.20.13", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", @@ -83,7 +83,7 @@ "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.0" + "tape": "^5.6.3" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", From 917c8d92a30db5bc35ddef85ec417f1aad0dc2c1 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 8 Feb 2023 22:19:53 -0800 Subject: [PATCH 22/61] [*] [deps] update `eslint-plugin-import` --- packages/eslint-config-airbnb-base/package.json | 4 ++-- packages/eslint-config-airbnb-base/rules/imports.js | 10 ++++++++++ packages/eslint-config-airbnb/package.json | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 9b71edda09..95e6dec90a 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -74,14 +74,14 @@ "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.26.0", + "eslint-plugin-import": "^2.27.5", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", "tape": "^5.6.3" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.26.0" + "eslint-plugin-import": "^2.27.5" }, "engines": { "node": "^10.12.0 || >=12.0.0" diff --git a/packages/eslint-config-airbnb-base/rules/imports.js b/packages/eslint-config-airbnb-base/rules/imports.js index 5f7f1bd470..70bc95a838 100644 --- a/packages/eslint-config-airbnb-base/rules/imports.js +++ b/packages/eslint-config-airbnb-base/rules/imports.js @@ -269,5 +269,15 @@ module.exports = { // Use this rule to prevent importing packages through relative paths. // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md 'import/no-relative-packages': 'error', + + // enforce a consistent style for type specifiers (inline or top-level) + // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md + // TODO, semver-major: enable (just in case) + 'import/consistent-type-specifier-style': ['off', 'prefer-inline'], + + // Reports the use of empty named import blocks. + // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md + // TODO, semver-minor: enable + 'import/no-empty-named-blocks': 'off', }, }; diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 31af4bae6d..7985899643 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -76,7 +76,7 @@ "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.26.0", + "eslint-plugin-import": "^2.27.5", "eslint-plugin-jsx-a11y": "^6.6.1", "eslint-plugin-react": "^7.31.8", "eslint-plugin-react-hooks": "^4.6.0", @@ -87,7 +87,7 @@ }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.26.0", + "eslint-plugin-import": "^2.27.5", "eslint-plugin-jsx-a11y": "^6.6.1", "eslint-plugin-react": "^7.31.8", "eslint-plugin-react-hooks": "^4.6.0" From bf536566cee0b7f239e00f105ca422bb95be2d62 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 8 Feb 2023 22:59:18 -0800 Subject: [PATCH 23/61] [eslint config] [deps] update `eslint-plugin-react`, `eslint-plugin-jsx-a11y` --- packages/eslint-config-airbnb/package.json | 8 ++++---- packages/eslint-config-airbnb/rules/react-a11y.js | 15 +++++++++++++++ packages/eslint-config-airbnb/rules/react.js | 12 ++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 7985899643..c1d11d44e9 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -77,8 +77,8 @@ "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsx-a11y": "^6.6.1", - "eslint-plugin-react": "^7.31.8", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", @@ -88,8 +88,8 @@ "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsx-a11y": "^6.6.1", - "eslint-plugin-react": "^7.31.8", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0" }, "engines": { diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js index f7bf7c79e6..713a997b28 100644 --- a/packages/eslint-config-airbnb/rules/react-a11y.js +++ b/packages/eslint-config-airbnb/rules/react-a11y.js @@ -247,5 +247,20 @@ module.exports = { }, allowChildren: false, }], + + // Ensures anchor text is not ambiguous + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/anchor-ambiguous-text.md + // TODO: semver-major, enable + 'jsx-a11y/anchor-ambiguous-text': 'off', + + // Enforce that aria-hidden="true" is not set on focusable elements. + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/no-aria-hidden-on-focusable.md + // TODO: semver-major, enable + 'jsx-a11y/no-aria-hidden-on-focusable': 'off', + + // Enforces using semantic DOM elements over the ARIA role property. + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/prefer-tag-over-role.md + // TODO: semver-major, enable + 'jsx-a11y/prefer-tag-over-role': 'off', }, }; diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index 447576d18a..ac4e4e29d3 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -575,6 +575,18 @@ module.exports = { // https://github.com/jsx-eslint/eslint-plugin-react/blob/c42b624d0fb9ad647583a775ab9751091eec066f/docs/rules/jsx-no-leaked-render.md // TODO: semver-major, enable 'react/jsx-no-leaked-render': 'off', + + // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/no-object-type-as-default-prop.md + // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/no-object-type-as-default-prop.md + // TODO: semver-major, enable + 'react/no-object-type-as-default-prop': 'off', + + // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/sort-default-props.md + // https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/sort-default-props.md + // TODO: semver-major, enable? + 'react/sort-default-props': ['off', { + ignoreCase: false + }], }, settings: { From 5c01a1094986c4dd50a6ee4d9f7617abdfabb58a Mon Sep 17 00:00:00 2001 From: syedmouaazfarrukh <97732099+syedmouaazfarrukh@users.noreply.github.com> Date: Tue, 7 Feb 2023 11:17:51 -0800 Subject: [PATCH 24/61] [readme] added JavaScript Roadmap link --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index db3bc6f31d..a9964bcac6 100644 --- a/README.md +++ b/README.md @@ -3781,6 +3781,7 @@ Other Style Guides - [ExploringJS](https://exploringjs.com/) - [ES6 Compatibility Table](https://kangax.github.io/compat-table/es6/) - [Comprehensive Overview of ES6 Features](http://es6-features.org/) + - [JavaScript Roadmap](https://roadmap.sh/javascript) **Read This** From 69fc1bf1953a9113f30f07ef93b69caaf498c689 Mon Sep 17 00:00:00 2001 From: Felipe Garcia Diaz <41710468+felipeGarciaDiaz@users.noreply.github.com> Date: Fri, 28 Apr 2023 03:33:28 -0400 Subject: [PATCH 25/61] spell checking, fixed grammar error. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a9964bcac6..fbed6641ba 100644 --- a/README.md +++ b/README.md @@ -464,7 +464,7 @@ Other Style Guides ``` - - [4.8](#arrays--bracket-newline) Use line breaks after open and before close array brackets if an array has multiple lines + - [4.8](#arrays--bracket-newline) Use line breaks after opening array brackets and before closing array brackets, if an array has multiple lines ```javascript // bad From 7982931ba745c0f57ba6934fc7e6cc43901dac76 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Tue, 2 May 2023 19:45:36 +0200 Subject: [PATCH 26/61] [readme] Updates ESLint rule in section 12.3 (exponentiation-operator) The change itself has already been made in f3d3a075cda2acc02011e71991c10bb5b4a15278 (tracked in/acording to https://github.com/airbnb/javascript/issues/2421#issuecomment-1371305010). #2421 Remove Math.pow from `no-restricted-properties` and use `prefer-exponentiation-operator` instead. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fbed6641ba..916a6c875d 100644 --- a/README.md +++ b/README.md @@ -1621,7 +1621,7 @@ Other Style Guides ``` - - [12.3](#es2016-properties--exponentiation-operator) Use exponentiation operator `**` when calculating exponentiations. eslint: [`no-restricted-properties`](https://eslint.org/docs/rules/no-restricted-properties). + - [12.3](#es2016-properties--exponentiation-operator) Use exponentiation operator `**` when calculating exponentiations. eslint: [`prefer-exponentiation-operator`](https://eslint.org/docs/rules/prefer-exponentiation-operator). ```javascript // bad From 0e627e2fa32e16296e309af314eb3cdaae00de66 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 15 May 2023 10:15:59 -0700 Subject: [PATCH 27/61] [readme] update eslint plugin repo URLs --- README.md | 10 +-- .../eslint-config-airbnb-base/rules/es6.js | 2 +- .../rules/imports.js | 86 +++++++++---------- .../eslint-config-airbnb/rules/react-a11y.js | 70 +++++++-------- react/README.md | 44 +++++----- 5 files changed, 106 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index 916a6c875d..660909e9a5 100644 --- a/README.md +++ b/README.md @@ -1373,7 +1373,7 @@ Other Style Guides - [10.5](#modules--no-mutable-exports) Do not export mutable bindings. - eslint: [`import/no-mutable-exports`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md) + eslint: [`import/no-mutable-exports`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md) > Why? Mutation should be avoided in general, but in particular when exporting mutable bindings. While this technique may be needed for some special cases, in general, only constant references should be exported. ```javascript @@ -1388,7 +1388,7 @@ Other Style Guides - [10.6](#modules--prefer-default-export) In modules with a single export, prefer default export over named export. - eslint: [`import/prefer-default-export`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md) + eslint: [`import/prefer-default-export`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md) > Why? To encourage more files that only ever export one thing, which is better for readability and maintainability. ```javascript @@ -1401,7 +1401,7 @@ Other Style Guides - [10.7](#modules--imports-first) Put all `import`s above non-import statements. - eslint: [`import/first`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md) + eslint: [`import/first`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md) > Why? Since `import`s are hoisted, keeping them all at the top prevents surprising behavior. ```javascript @@ -1440,7 +1440,7 @@ Other Style Guides - [10.9](#modules--no-webpack-loader-syntax) Disallow Webpack loader syntax in module import statements. - eslint: [`import/no-webpack-loader-syntax`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md) + eslint: [`import/no-webpack-loader-syntax`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md) > Why? Since using Webpack syntax in the imports couples the code to a module bundler. Prefer using the loader syntax in `webpack.config.js`. ```javascript @@ -1455,7 +1455,7 @@ Other Style Guides - [10.10](#modules--import-extensions) Do not include JavaScript filename extensions - eslint: [`import/extensions`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md) + eslint: [`import/extensions`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md) > Why? Including extensions inhibits refactoring, and inappropriately hardcodes implementation details of the module you're importing in every consumer. ```javascript diff --git a/packages/eslint-config-airbnb-base/rules/es6.js b/packages/eslint-config-airbnb-base/rules/es6.js index 79a4cdcc25..5e59cbebf4 100644 --- a/packages/eslint-config-airbnb-base/rules/es6.js +++ b/packages/eslint-config-airbnb-base/rules/es6.js @@ -53,7 +53,7 @@ module.exports = { // disallow importing from the same path more than once // https://eslint.org/docs/rules/no-duplicate-imports - // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md + // replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md 'no-duplicate-imports': 'off', // disallow symbol constructor diff --git a/packages/eslint-config-airbnb-base/rules/imports.js b/packages/eslint-config-airbnb-base/rules/imports.js index 70bc95a838..d36e4908fa 100644 --- a/packages/eslint-config-airbnb-base/rules/imports.js +++ b/packages/eslint-config-airbnb-base/rules/imports.js @@ -33,40 +33,40 @@ module.exports = { // Static analysis: // ensure imports point to files/modules that can be resolved - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }], // ensure named imports coupled with named exports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it 'import/named': 'error', // ensure default import coupled with default export - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it 'import/default': 'off', - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/namespace.md 'import/namespace': 'off', // Helpful warnings: // disallow invalid exports, e.g. multiple defaults - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md 'import/export': 'error', // do not allow a default import name to match a named export - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md 'import/no-named-as-default': 'error', // warn on accessing default export property names that are also named exports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md 'import/no-named-as-default-member': 'error', // disallow use of jsdoc-marked-deprecated imports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md 'import/no-deprecated': 'off', // Forbid the use of extraneous packages - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md // paths are treated both as absolute paths, and relative to process.cwd() 'import/no-extraneous-dependencies': ['error', { devDependencies: [ @@ -97,46 +97,46 @@ module.exports = { }], // Forbid mutable exports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md 'import/no-mutable-exports': 'error', // Module systems: // disallow require() - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md 'import/no-commonjs': 'off', // disallow AMD require/define - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md 'import/no-amd': 'error', // No Node.js builtin modules - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md // TODO: enable? 'import/no-nodejs-modules': 'off', // Style guide: // disallow non-import statements appearing before import statements - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md 'import/first': 'error', // disallow non-import statements appearing before import statements - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/imports-first.md // deprecated: use `import/first` 'import/imports-first': 'off', // disallow duplicate imports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md 'import/no-duplicates': 'error', // disallow namespace imports // TODO: enable? - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-namespace.md 'import/no-namespace': 'off', // Ensure consistent use of file extension within the import path - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md 'import/extensions': ['error', 'ignorePackages', { js: 'never', mjs: 'never', @@ -144,62 +144,62 @@ module.exports = { }], // ensure absolute imports are above relative imports and that unassigned imports are ignored - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md // TODO: enforce a stricter convention in module import order? 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }], // Require a newline after the last import/require in a group - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md 'import/newline-after-import': 'error', // Require modules with a single export to use a default export - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md 'import/prefer-default-export': 'error', // Restrict which files can be imported in a given folder - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md 'import/no-restricted-paths': 'off', // Forbid modules to have too many dependencies - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md 'import/max-dependencies': ['off', { max: 10 }], // Forbid import of modules using absolute paths - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md 'import/no-absolute-path': 'error', // Forbid require() calls with expressions - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md 'import/no-dynamic-require': 'error', // prevent importing the submodules of other modules - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md 'import/no-internal-modules': ['off', { allow: [], }], // Warn if a module could be mistakenly parsed as a script by a consumer // leveraging Unambiguous JavaScript Grammar - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/unambiguous.md // this should not be enabled until this proposal has at least been *presented* to TC39. // At the moment, it's not a thing. 'import/unambiguous': 'off', // Forbid Webpack loader syntax in imports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md 'import/no-webpack-loader-syntax': 'error', // Prevent unassigned imports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md // importing for side effects is perfectly acceptable, if you need side effects. 'import/no-unassigned-import': 'off', // Prevent importing the default as if it were named - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md + // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md 'import/no-named-default': 'error', // Reports if a module's default export is unnamed - // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md + // https://github.com/import-js/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md 'import/no-anonymous-default-export': ['off', { allowArray: false, allowArrowFunction: false, @@ -210,49 +210,49 @@ module.exports = { }], // This rule enforces that all exports are declared at the bottom of the file. - // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md + // https://github.com/import-js/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md // TODO: enable? 'import/exports-last': 'off', // Reports when named exports are not grouped together in a single export declaration // or when multiple assignments to CommonJS module.exports or exports object are present // in a single file. - // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md + // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md 'import/group-exports': 'off', // forbid default exports. this is a terrible rule, do not use it. - // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md + // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md 'import/no-default-export': 'off', // Prohibit named exports. this is a terrible rule, do not use it. - // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md + // https://github.com/import-js/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md 'import/no-named-export': 'off', // Forbid a module from importing itself - // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md + // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md 'import/no-self-import': 'error', // Forbid cyclical dependencies between modules - // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md + // https://github.com/import-js/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md '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 + // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md 'import/no-useless-path-segments': ['error', { commonjs: true }], // dynamic imports require a leading comment with a webpackChunkName - // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md + // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md 'import/dynamic-import-chunkname': ['off', { importFunctions: [], webpackChunknameFormat: '[0-9a-zA-Z-_/.]+', }], // Use this rule to prevent imports to folders in relative parent paths. - // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md + // https://github.com/import-js/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md 'import/no-relative-parent-imports': 'off', // Reports modules without any exports, or with unused exports - // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md + // https://github.com/import-js/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md // TODO: enable once it supports CJS 'import/no-unused-modules': ['off', { ignoreExports: [], @@ -261,13 +261,13 @@ module.exports = { }], // Reports the use of import declarations with CommonJS exports in any module except for the main module. - // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md + // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md 'import/no-import-module-exports': ['error', { exceptions: [], }], // Use this rule to prevent importing packages through relative paths. - // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md + // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md 'import/no-relative-packages': 'error', // enforce a consistent style for type specifiers (inline or top-level) diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js index 713a997b28..643cf64407 100644 --- a/packages/eslint-config-airbnb/rules/react-a11y.js +++ b/packages/eslint-config-airbnb/rules/react-a11y.js @@ -12,12 +12,12 @@ module.exports = { rules: { // ensure emoji are accessible - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md // disabled; rule is deprecated 'jsx-a11y/accessible-emoji': 'off', // Enforce that all elements that require alternative text have meaningful information - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md 'jsx-a11y/alt-text': ['error', { elements: ['img', 'object', 'area', 'input[type="image"]'], img: [], @@ -27,11 +27,11 @@ module.exports = { }], // Enforce that anchors have content - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md 'jsx-a11y/anchor-has-content': ['error', { components: [] }], // ensure tags are valid - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md 'jsx-a11y/anchor-is-valid': ['error', { components: ['Link'], specialLink: ['to'], @@ -39,24 +39,24 @@ module.exports = { }], // elements with aria-activedescendant must be tabbable - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md 'jsx-a11y/aria-activedescendant-has-tabindex': 'error', // Enforce all aria-* props are valid. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md 'jsx-a11y/aria-props': 'error', // Enforce ARIA state and property values are valid. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md 'jsx-a11y/aria-proptypes': 'error', // Require ARIA roles to be valid and non-abstract - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md 'jsx-a11y/aria-role': ['error', { ignoreNonDOM: false }], // Enforce that elements that do not support ARIA roles, states, and // properties do not have those attributes. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md 'jsx-a11y/aria-unsupported-elements': 'error', // Ensure the autocomplete attribute is correct and suitable for the form field it is used with @@ -66,11 +66,11 @@ module.exports = { }], // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md 'jsx-a11y/click-events-have-key-events': 'error', // Enforce that a control (an interactive element) has a text label. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md 'jsx-a11y/control-has-associated-label': ['error', { labelAttributes: ['label'], controlComponents: [], @@ -99,27 +99,27 @@ module.exports = { }], // ensure tags have content and are not aria-hidden - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md 'jsx-a11y/heading-has-content': ['error', { components: [''] }], // require HTML elements to have a "lang" prop - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md 'jsx-a11y/html-has-lang': 'error', // ensure iframe elements have a unique title - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md 'jsx-a11y/iframe-has-title': 'error', // Prevent img alt text from containing redundant words like "image", "picture", or "photo" - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md 'jsx-a11y/img-redundant-alt': 'error', // Elements with an interactive role and interaction handlers must be focusable - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md 'jsx-a11y/interactive-supports-focus': 'error', // Enforce that a label tag has a text label and an associated control. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md 'jsx-a11y/label-has-associated-control': ['error', { labelComponents: [], labelAttributes: [], @@ -129,11 +129,11 @@ module.exports = { }], // require HTML element's lang prop to be valid - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md 'jsx-a11y/lang': 'error', // media elements must have captions - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md 'jsx-a11y/media-has-caption': ['error', { audio: [], video: [], @@ -141,31 +141,31 @@ module.exports = { }], // require that mouseover/out come with focus/blur, for keyboard-only users - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md 'jsx-a11y/mouse-events-have-key-events': 'error', // Prevent use of `accessKey` - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md 'jsx-a11y/no-access-key': 'error', // prohibit autoFocus prop - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md 'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }], // prevent distracting elements, like and - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md 'jsx-a11y/no-distracting-elements': ['error', { elements: ['marquee', 'blink'], }], // WAI-ARIA roles should not be used to convert an interactive element to non-interactive - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md 'jsx-a11y/no-interactive-element-to-noninteractive-role': ['error', { tr: ['none', 'presentation'], }], // A non-interactive element does not support event handlers (mouse and key handlers) - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md 'jsx-a11y/no-noninteractive-element-interactions': ['error', { handlers: [ 'onClick', @@ -178,7 +178,7 @@ module.exports = { }], // WAI-ARIA roles should not be used to convert a non-interactive element to interactive - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md 'jsx-a11y/no-noninteractive-element-to-interactive-role': ['error', { ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], @@ -188,22 +188,22 @@ module.exports = { }], // Tab key navigation should be limited to elements on the page that can be interacted with. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md 'jsx-a11y/no-noninteractive-tabindex': ['error', { tags: [], roles: ['tabpanel'], }], // require onBlur instead of onChange - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md 'jsx-a11y/no-onchange': 'off', // ensure HTML elements do not specify redundant ARIA roles - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md 'jsx-a11y/no-redundant-roles': 'error', // Enforce that DOM elements without semantic behavior not have interaction handlers - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md 'jsx-a11y/no-static-element-interactions': ['error', { handlers: [ 'onClick', @@ -217,20 +217,20 @@ module.exports = { // Enforce that elements with ARIA roles must have all required attributes // for that role. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md 'jsx-a11y/role-has-required-aria-props': 'error', // Enforce that elements with explicit or implicit roles defined contain // only aria-* properties supported by that role. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md 'jsx-a11y/role-supports-aria-props': 'error', // only allow to have the "scope" attr - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md 'jsx-a11y/scope': 'error', // Enforce tabIndex value is not greater than zero. - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md 'jsx-a11y/tabindex-no-positive': 'error', // ---------------------------------------------------- @@ -238,7 +238,7 @@ module.exports = { // ---------------------------------------------------- // require that JSX labels use "htmlFor" - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md // deprecated: replaced by `label-has-associated-control` rule 'jsx-a11y/label-has-for': ['off', { components: [], diff --git a/react/README.md b/react/README.md index e7679d26da..a590a19672 100644 --- a/react/README.md +++ b/react/README.md @@ -25,14 +25,14 @@ This style guide is mostly based on the standards that are currently prevalent i ## Basic Rules - Only include one React component per file. - - However, multiple [Stateless, or Pure, Components](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions) are allowed per file. eslint: [`react/no-multi-comp`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md#ignorestateless). + - However, multiple [Stateless, or Pure, Components](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions) are allowed per file. eslint: [`react/no-multi-comp`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md#ignorestateless). - Always use JSX syntax. - Do not use `React.createElement` unless you’re initializing the app from a file that is not JSX. - - [`react/forbid-prop-types`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md) will allow `arrays` and `objects` only if it is explicitly noted what `array` and `object` contains, using `arrayOf`, `objectOf`, or `shape`. + - [`react/forbid-prop-types`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md) will allow `arrays` and `objects` only if it is explicitly noted what `array` and `object` contains, using `arrayOf`, `objectOf`, or `shape`. ## Class vs `React.createClass` vs stateless - - If you have internal state and/or refs, prefer `class extends React.Component` over `React.createClass`. eslint: [`react/prefer-es6-class`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md) [`react/prefer-stateless-function`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md) + - If you have internal state and/or refs, prefer `class extends React.Component` over `React.createClass`. eslint: [`react/prefer-es6-class`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md) [`react/prefer-stateless-function`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md) ```jsx // bad @@ -81,9 +81,9 @@ This style guide is mostly based on the standards that are currently prevalent i ## Naming - - **Extensions**: Use `.jsx` extension for React components. eslint: [`react/jsx-filename-extension`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md) + - **Extensions**: Use `.jsx` extension for React components. eslint: [`react/jsx-filename-extension`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md) - **Filename**: Use PascalCase for filenames. E.g., `ReservationCard.jsx`. - - **Reference Naming**: Use PascalCase for React components and camelCase for their instances. eslint: [`react/jsx-pascal-case`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md) + - **Reference Naming**: Use PascalCase for React components and camelCase for their instances. eslint: [`react/jsx-pascal-case`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md) ```jsx // bad @@ -172,7 +172,7 @@ This style guide is mostly based on the standards that are currently prevalent i ## Alignment - - Follow these alignment styles for JSX syntax. eslint: [`react/jsx-closing-bracket-location`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md) [`react/jsx-closing-tag-location`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md) + - Follow these alignment styles for JSX syntax. eslint: [`react/jsx-closing-bracket-location`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md) [`react/jsx-closing-tag-location`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md) ```jsx // bad @@ -259,7 +259,7 @@ This style guide is mostly based on the standards that are currently prevalent i ## Spacing - - Always include a single space in your self-closing tag. eslint: [`no-multi-spaces`](https://eslint.org/docs/rules/no-multi-spaces), [`react/jsx-tag-spacing`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md) + - Always include a single space in your self-closing tag. eslint: [`no-multi-spaces`](https://eslint.org/docs/rules/no-multi-spaces), [`react/jsx-tag-spacing`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md) ```jsx // bad @@ -276,7 +276,7 @@ This style guide is mostly based on the standards that are currently prevalent i ``` - - Do not pad JSX curly braces with spaces. eslint: [`react/jsx-curly-spacing`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md) + - Do not pad JSX curly braces with spaces. eslint: [`react/jsx-curly-spacing`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md) ```jsx // bad @@ -305,7 +305,7 @@ This style guide is mostly based on the standards that are currently prevalent i /> ``` - - Omit the value of the prop when it is explicitly `true`. eslint: [`react/jsx-boolean-value`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md) + - Omit the value of the prop when it is explicitly `true`. eslint: [`react/jsx-boolean-value`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md) ```jsx // bad @@ -322,7 +322,7 @@ This style guide is mostly based on the standards that are currently prevalent i