From 01f046dc0567e4495762e8e4fc4dde7b87dd5eb8 Mon Sep 17 00:00:00 2001 From: zhesha Date: Tue, 23 May 2023 15:10:23 +0300 Subject: [PATCH 01/31] [guide] added second link to eslint rule for item 7.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 660909e9a5..61b7fb5bb9 100644 --- a/README.md +++ b/README.md @@ -657,7 +657,7 @@ Other Style Guides ## Functions - - [7.1](#functions--declarations) Use named function expressions instead of function declarations. eslint: [`func-style`](https://eslint.org/docs/rules/func-style) + - [7.1](#functions--declarations) Use named function expressions instead of function declarations. eslint: [`func-style`](https://eslint.org/docs/rules/func-style), [`func-names`](https://eslint.org/docs/latest/rules/func-names) > Why? Function declarations are hoisted, which means that it’s easy - too easy - to reference the function before it is defined in the file. This harms readability and maintainability. If you find that a function’s definition is large or complex enough that it is interfering with understanding the rest of the file, then perhaps it’s time to extract it to its own module! Don’t forget to explicitly name the expression, regardless of whether or not the name is inferred from the containing variable (which is often the case in modern browsers or when using compilers such as Babel). This eliminates any assumptions made about the Error’s call stack. ([Discussion](https://github.com/airbnb/javascript/issues/794)) From 7916d6f538028e91129e65fd5633b7d6fa85d000 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 15 May 2023 10:21:09 -0700 Subject: [PATCH 02/31] [guide] Add documentation for `no-use-before-define` rule under hoisting section --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/README.md b/README.md index 61b7fb5bb9..5732b91c59 100644 --- a/README.md +++ b/README.md @@ -1961,6 +1961,56 @@ Other Style Guides } ``` + + - [14.5](#no-use-before-define) Variables, classes, and functions should be defined before they can be used. eslint: [`no-use-before-define`](https://eslint.org/docs/latest/rules/no-use-before-define) + + > Why? When variables, classes, or functions are declared before being used, it can harm readability since a reader won't know what a thing that's referenced is. It's much clearer for a reader to first encounter the source of a thing (whether imported from another module, or defined in the file) before encountering a use of the thing. + + ```javascript + // bad + + // Variable a is being used before it is being defined. + console.log(a); // this will be undefined, since while the declaration is hoisted, the initialization is not + var a = 10; + + // Function fun is being called before being defined. + fun(); + function fun() {} + + // Class A is being used before being defined. + new A(); // ReferenceError: Cannot access 'A' before initialization + class A { + } + + // `let` and `const` are hoisted, but they don't have a default initialization. + // The variables 'a' and 'b' are in a Temporal Dead Zone where JavaScript + // knows they exist (declaration is hoisted) but they are not accessible + // (as they are not yet initialized). + + console.log(a); // ReferenceError: Cannot access 'a' before initialization + console.log(b); // ReferenceError: Cannot access 'b' before initialization + let a = 10; + const b = 5; + + + // good + + var a = 10; + console.log(a); // 10 + + function fun() {} + fun(); + + class A { + } + new A(); + + let a = 10; + const b = 5; + console.log(a); // 10 + console.log(b); // 5 + ``` + - For more information refer to [JavaScript Scoping & Hoisting](https://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting/) by [Ben Cherry](https://www.adequatelygood.com/). **[⬆ back to top](#table-of-contents)** From fd77bbebb77362ddecfef7aba3bf6abf7bdd81f2 Mon Sep 17 00:00:00 2001 From: Khadija-Batool Date: Sun, 2 Jul 2023 23:51:01 +0500 Subject: [PATCH 03/31] [guide] add nullish-coalescing-operator definition --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 5732b91c59..026c7ebe3e 100644 --- a/README.md +++ b/README.md @@ -2198,6 +2198,33 @@ Other Style Guides const bar = a + (b / c) * d; ``` + + - [15.9](#nullish-coalescing-operator) The nullish coalescing operator (`??`) is a logical operator that returns its right-hand side operand when its left-hand side operand is `null` or `undefined`. Otherwise, it returns the left-hand side operand. + + > Why? It provides precision by distinguishing null/undefined from other falsy values, enhancing code clarity and predictability. + + ```javascript + // bad + const value = 0 ?? 'default'; + // returns 0, not 'default' + + // bad + const value = '' ?? 'default'; + // returns '', not 'default' + + // good + const value = null ?? 'default'; + // returns 'default' + + // good + const user = { + name: 'John', + age: null + }; + const age = user.age ?? 18; + // returns 18 + ``` + **[⬆ back to top](#table-of-contents)** ## Blocks From 18a08b862b14ec8d8fd8bd70bcba2d8e9714c93b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 5 Aug 2023 11:55:23 +1200 Subject: [PATCH 04/31] [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 0fd14e961b..a78bc250d4 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "markdownlint": "^0.28.2", - "markdownlint-cli": "^0.34.0" + "markdownlint": "^0.29.0", + "markdownlint-cli": "^0.35.0" } } From 4aee38f1e794ec846aa2d1120b80a1ac7ad4db12 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 5 Aug 2023 12:05:40 +1200 Subject: [PATCH 05/31] [eslint config] [*] [deps] update `eslint-plugin-import`, `@babel/runtime`, `tape` --- packages/eslint-config-airbnb-base/package.json | 8 ++++---- packages/eslint-config-airbnb/package.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 2e2d7dba60..39c0fdf944 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -68,20 +68,20 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "@babel/runtime": "^7.21.5", + "@babel/runtime": "^7.22.6", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.27.5", + "eslint-plugin-import": "^2.28.0", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.3" + "tape": "^5.6.6" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.27.5" + "eslint-plugin-import": "^2.28.0" }, "engines": { "node": "^10.12.0 || >=12.0.0" diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index e924eda286..a9d800a773 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -70,24 +70,24 @@ "object.entries": "^1.1.6" }, "devDependencies": { - "@babel/runtime": "^7.21.5", + "@babel/runtime": "^7.22.6", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.27.5", + "eslint-plugin-import": "^2.28.0", "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", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.3" + "tape": "^5.6.6" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.27.5", + "eslint-plugin-import": "^2.28.0", "eslint-plugin-jsx-a11y": "^6.7.1", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0" From 749f4c2bd0e2e890fed7f421ac39b8689fe00d99 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 5 Aug 2023 12:06:55 +1200 Subject: [PATCH 06/31] [eslint config] [deps] update `eslint-plugin-react` --- packages/eslint-config-airbnb/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index a9d800a773..1ac7a902a2 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -78,7 +78,7 @@ "eslint-find-rules": "^4.1.0", "eslint-plugin-import": "^2.28.0", "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.32.2", + "eslint-plugin-react": "^7.33.1", "eslint-plugin-react-hooks": "^4.6.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", @@ -89,7 +89,7 @@ "eslint": "^7.32.0 || ^8.2.0", "eslint-plugin-import": "^2.28.0", "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.32.2", + "eslint-plugin-react": "^7.33.1", "eslint-plugin-react-hooks": "^4.6.0" }, "engines": { From 2fc5e2d52c48c1dfc76f52f704c41dcfd28a0de7 Mon Sep 17 00:00:00 2001 From: Joe Mornin <119512+morninj@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:16:48 -0700 Subject: [PATCH 07/31] [guide] fix grammar --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 026c7ebe3e..06d773c275 100644 --- a/README.md +++ b/README.md @@ -636,7 +636,7 @@ Other Style Guides ``` - - [6.4](#strings--eval) Never use `eval()` on a string, it opens too many vulnerabilities. eslint: [`no-eval`](https://eslint.org/docs/rules/no-eval) + - [6.4](#strings--eval) Never use `eval()` on a string; it opens too many vulnerabilities. eslint: [`no-eval`](https://eslint.org/docs/rules/no-eval) - [6.5](#strings--escaping) Do not unnecessarily escape characters in strings. eslint: [`no-useless-escape`](https://eslint.org/docs/rules/no-useless-escape) From cda44dad403979d313a4b02ce55f0bb6cc3a24b2 Mon Sep 17 00:00:00 2001 From: Joe Mornin <119512+morninj@users.noreply.github.com> Date: Tue, 1 Aug 2023 09:25:54 -0700 Subject: [PATCH 08/31] [guide] Add commas to Truth, Equality, and JavaScript Co-authored-by: Jordan Harband --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06d773c275..88b1d11ddf 100644 --- a/README.md +++ b/README.md @@ -2073,7 +2073,7 @@ Other Style Guides ``` - - [15.4](#comparison--moreinfo) For more information see [Truth Equality and JavaScript](https://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/#more-2108) by Angus Croll. + - [15.4](#comparison--moreinfo) For more information see [Truth, Equality, and JavaScript](https://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/#more-2108) by Angus Croll. - [15.5](#comparison--switch-blocks) Use braces to create blocks in `case` and `default` clauses that contain lexical declarations (e.g. `let`, `const`, `function`, and `class`). eslint: [`no-case-declarations`](https://eslint.org/docs/rules/no-case-declarations) From cb191776dbdd2c8674fc81a6850c4c1377af46e6 Mon Sep 17 00:00:00 2001 From: hamzahuda <116317495+hamzahuda@users.noreply.github.com> Date: Sat, 12 Aug 2023 12:19:30 +0100 Subject: [PATCH 09/31] [readme] correct no-use-before-define justification The recommendation is to declare the variables, classes and functions before. So the contrasting negative example should say after. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88b1d11ddf..e7ed4d29ae 100644 --- a/README.md +++ b/README.md @@ -1964,7 +1964,7 @@ Other Style Guides - [14.5](#no-use-before-define) Variables, classes, and functions should be defined before they can be used. eslint: [`no-use-before-define`](https://eslint.org/docs/latest/rules/no-use-before-define) - > Why? When variables, classes, or functions are declared before being used, it can harm readability since a reader won't know what a thing that's referenced is. It's much clearer for a reader to first encounter the source of a thing (whether imported from another module, or defined in the file) before encountering a use of the thing. + > Why? When variables, classes, or functions are declared after being used, it can harm readability since a reader won't know what a thing that's referenced is. It's much clearer for a reader to first encounter the source of a thing (whether imported from another module, or defined in the file) before encountering a use of the thing. ```javascript // bad From 46ae3e225673b6bbd52a49f78b9474cd282b8e4f Mon Sep 17 00:00:00 2001 From: savalaram-redkar Date: Tue, 15 Aug 2023 20:24:16 +0530 Subject: [PATCH 10/31] [readme] Add `Object.hasOwn` to section 3.7 --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e7ed4d29ae..9681aa4b51 100644 --- a/README.md +++ b/README.md @@ -296,7 +296,7 @@ Other Style Guides - [3.7](#objects--prototype-builtins) Do not call `Object.prototype` methods directly, such as `hasOwnProperty`, `propertyIsEnumerable`, and `isPrototypeOf`. eslint: [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins) - > Why? These methods may be shadowed by properties on the object in question - consider `{ hasOwnProperty: false }` - or, the object may be a null object (`Object.create(null)`). + > Why? These methods may be shadowed by properties on the object in question - consider `{ hasOwnProperty: false }` - or, the object may be a null object (`Object.create(null)`). In modern browsers that support ES2022, or with a polyfill such as , `Object.hasOwn` can also be used as an alternative to `Object.prototype.hasOwnProperty.call`. ```javascript // bad @@ -305,9 +305,13 @@ Other Style Guides // good console.log(Object.prototype.hasOwnProperty.call(object, key)); - // best + // better const has = Object.prototype.hasOwnProperty; // cache the lookup once, in module scope. console.log(has.call(object, key)); + + // best + console.log(Object.hasOwn(object, key)); // only supported in browsers that support ES2022 + /* or */ import has from 'has'; // https://www.npmjs.com/package/has console.log(has(object, key)); From 11ab37144b7f846f04f64a29b5beb6e00d74e84b Mon Sep 17 00:00:00 2001 From: Vahid Mohammadi Date: Mon, 21 Aug 2023 15:43:54 +0100 Subject: [PATCH 11/31] [eslint config] [base] [patch] Add a message for `confusing-browser-globals` --- packages/eslint-config-airbnb-base/rules/variables.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb-base/rules/variables.js b/packages/eslint-config-airbnb-base/rules/variables.js index 6fb98bcfb6..7d61989e6a 100644 --- a/packages/eslint-config-airbnb-base/rules/variables.js +++ b/packages/eslint-config-airbnb-base/rules/variables.js @@ -28,7 +28,10 @@ module.exports = { message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan', }, - ].concat(confusingBrowserGlobals), + ].concat(confusingBrowserGlobals.map((g) => ({ + name: g, + message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`, + }))), // disallow declaration of variables already declared in the outer scope 'no-shadow': 'error', From e95b1f2754258cf219ecfdfdf712b6de5657dd8a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 27 Jan 2024 21:07:02 -0800 Subject: [PATCH 12/31] [eslint config] [base] add new disabled rules --- packages/eslint-config-airbnb-base/rules/best-practices.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/eslint-config-airbnb-base/rules/best-practices.js b/packages/eslint-config-airbnb-base/rules/best-practices.js index 944fe71a05..09c247451a 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -217,6 +217,11 @@ module.exports = { // https://eslint.org/docs/rules/no-nonoctal-decimal-escape 'no-nonoctal-decimal-escape': 'error', + // Disallow calls to the Object constructor without an argument + // https://eslint.org/docs/latest/rules/no-object-constructor + // TODO: enable, semver-major + 'no-object-constructor': 'off', + // disallow use of (old style) octal literals // https://eslint.org/docs/rules/no-octal 'no-octal': 'error', From 55899b57a6de826d8d762693d6d4f999d652ae2d Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 27 Jan 2024 21:08:54 -0800 Subject: [PATCH 13/31] [eslint config] [*] [deps] update deps --- .../eslint-config-airbnb-base/package.json | 10 +++++----- packages/eslint-config-airbnb/package.json | 18 +++++++++--------- 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 39c0fdf944..683284f43e 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -68,26 +68,26 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "@babel/runtime": "^7.22.6", + "@babel/runtime": "^7.23.9", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.28.0", + "eslint-plugin-import": "^2.29.1", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.6" + "tape": "^5.7.4" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.28.0" + "eslint-plugin-import": "^2.29.1" }, "engines": { "node": "^10.12.0 || >=12.0.0" }, "dependencies": { "confusing-browser-globals": "^1.0.11", - "object.entries": "^1.1.6" + "object.entries": "^1.1.7" } } diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 1ac7a902a2..c99ef24811 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -67,29 +67,29 @@ "homepage": "https://github.com/airbnb/javascript", "dependencies": { "eslint-config-airbnb-base": "^15.0.0", - "object.entries": "^1.1.6" + "object.entries": "^1.1.7" }, "devDependencies": { - "@babel/runtime": "^7.22.6", + "@babel/runtime": "^7.23.9", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.28.0", - "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.33.1", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.6" + "tape": "^5.7.4" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.28.0", - "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.33.1", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0" }, "engines": { From 0681a43e0a0181e8cafd0d3004f967a238411ba2 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:14:38 +0000 Subject: [PATCH 14/31] [eslint config] [*] [refactor] remove `object.entries` dependency This removes the `object.entries` package and uses the widely available built-in native `Object.entries`. --- packages/eslint-config-airbnb-base/package.json | 3 +-- packages/eslint-config-airbnb-base/whitespace-async.js | 3 +-- packages/eslint-config-airbnb-base/whitespace.js | 3 +-- packages/eslint-config-airbnb/package.json | 3 +-- packages/eslint-config-airbnb/whitespace-async.js | 3 +-- packages/eslint-config-airbnb/whitespace.js | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/eslint-config-airbnb-base/package.json b/packages/eslint-config-airbnb-base/package.json index 683284f43e..92daf3c33b 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -87,7 +87,6 @@ "node": "^10.12.0 || >=12.0.0" }, "dependencies": { - "confusing-browser-globals": "^1.0.11", - "object.entries": "^1.1.7" + "confusing-browser-globals": "^1.0.11" } } diff --git a/packages/eslint-config-airbnb-base/whitespace-async.js b/packages/eslint-config-airbnb-base/whitespace-async.js index d6742fb7c4..f7994fca04 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 entries = require('object.entries'); const { ESLint } = require('eslint'); const baseConfig = require('.'); @@ -26,7 +25,7 @@ async function onlyErrorOnRules(rulesToError, config) { }); const baseRules = (await cli.calculateConfigForFile(require.resolve('./'))).rules; - entries(baseRules).forEach((rule) => { + Object.entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); diff --git a/packages/eslint-config-airbnb-base/whitespace.js b/packages/eslint-config-airbnb-base/whitespace.js index f4b93bb492..fcc5099af9 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 entries = require('object.entries'); const whitespaceRules = require('./whitespaceRules'); const baseConfig = require('.'); @@ -26,7 +25,7 @@ if (CLIEngine) { const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); const baseRules = cli.getConfigForFile(require.resolve('./')).rules; - entries(baseRules).forEach((rule) => { + Object.entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index c99ef24811..69a4670f8e 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -66,8 +66,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "dependencies": { - "eslint-config-airbnb-base": "^15.0.0", - "object.entries": "^1.1.7" + "eslint-config-airbnb-base": "^15.0.0" }, "devDependencies": { "@babel/runtime": "^7.23.9", diff --git a/packages/eslint-config-airbnb/whitespace-async.js b/packages/eslint-config-airbnb/whitespace-async.js index d6742fb7c4..f7994fca04 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 entries = require('object.entries'); const { ESLint } = require('eslint'); const baseConfig = require('.'); @@ -26,7 +25,7 @@ async function onlyErrorOnRules(rulesToError, config) { }); const baseRules = (await cli.calculateConfigForFile(require.resolve('./'))).rules; - entries(baseRules).forEach((rule) => { + Object.entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); diff --git a/packages/eslint-config-airbnb/whitespace.js b/packages/eslint-config-airbnb/whitespace.js index f4b93bb492..fcc5099af9 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 entries = require('object.entries'); const whitespaceRules = require('./whitespaceRules'); const baseConfig = require('.'); @@ -26,7 +25,7 @@ if (CLIEngine) { const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); const baseRules = cli.getConfigForFile(require.resolve('./')).rules; - entries(baseRules).forEach((rule) => { + Object.entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); From 51a37d0fa5f334fdfae9fea39711402fb6eb3b34 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 27 Jan 2024 21:02:05 -0800 Subject: [PATCH 15/31] [eslint config] [*] [robustness] cache static builtins --- packages/eslint-config-airbnb-base/whitespace-async.js | 8 +++++--- packages/eslint-config-airbnb-base/whitespace.js | 8 +++++--- packages/eslint-config-airbnb/whitespace-async.js | 8 +++++--- packages/eslint-config-airbnb/whitespace.js | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/eslint-config-airbnb-base/whitespace-async.js b/packages/eslint-config-airbnb-base/whitespace-async.js index f7994fca04..06f4f89075 100755 --- a/packages/eslint-config-airbnb-base/whitespace-async.js +++ b/packages/eslint-config-airbnb-base/whitespace-async.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +const { isArray } = Array; +const { entries } = Object; const { ESLint } = require('eslint'); const baseConfig = require('.'); @@ -8,7 +10,7 @@ const whitespaceRules = require('./whitespaceRules'); const severities = ['off', 'warn', 'error']; function getSeverity(ruleConfig) { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { return getSeverity(ruleConfig[0]); } if (typeof ruleConfig === 'number') { @@ -25,13 +27,13 @@ async function onlyErrorOnRules(rulesToError, config) { }); const baseRules = (await cli.calculateConfigForFile(require.resolve('./'))).rules; - Object.entries(baseRules).forEach((rule) => { + entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { errorsOnly.rules[ruleName] = ['warn'].concat(ruleConfig.slice(1)); } else if (typeof ruleConfig === 'number') { errorsOnly.rules[ruleName] = 1; diff --git a/packages/eslint-config-airbnb-base/whitespace.js b/packages/eslint-config-airbnb-base/whitespace.js index fcc5099af9..e896072154 100644 --- a/packages/eslint-config-airbnb-base/whitespace.js +++ b/packages/eslint-config-airbnb-base/whitespace.js @@ -1,5 +1,7 @@ /* eslint global-require: 0 */ +const { isArray } = Array; +const { entries } = Object; const { CLIEngine } = require('eslint'); if (CLIEngine) { @@ -11,7 +13,7 @@ if (CLIEngine) { const severities = ['off', 'warn', 'error']; function getSeverity(ruleConfig) { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { return getSeverity(ruleConfig[0]); } if (typeof ruleConfig === 'number') { @@ -25,13 +27,13 @@ if (CLIEngine) { const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); const baseRules = cli.getConfigForFile(require.resolve('./')).rules; - Object.entries(baseRules).forEach((rule) => { + entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { errorsOnly.rules[ruleName] = ['warn'].concat(ruleConfig.slice(1)); } else if (typeof ruleConfig === 'number') { errorsOnly.rules[ruleName] = 1; diff --git a/packages/eslint-config-airbnb/whitespace-async.js b/packages/eslint-config-airbnb/whitespace-async.js index f7994fca04..06f4f89075 100755 --- a/packages/eslint-config-airbnb/whitespace-async.js +++ b/packages/eslint-config-airbnb/whitespace-async.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +const { isArray } = Array; +const { entries } = Object; const { ESLint } = require('eslint'); const baseConfig = require('.'); @@ -8,7 +10,7 @@ const whitespaceRules = require('./whitespaceRules'); const severities = ['off', 'warn', 'error']; function getSeverity(ruleConfig) { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { return getSeverity(ruleConfig[0]); } if (typeof ruleConfig === 'number') { @@ -25,13 +27,13 @@ async function onlyErrorOnRules(rulesToError, config) { }); const baseRules = (await cli.calculateConfigForFile(require.resolve('./'))).rules; - Object.entries(baseRules).forEach((rule) => { + entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { errorsOnly.rules[ruleName] = ['warn'].concat(ruleConfig.slice(1)); } else if (typeof ruleConfig === 'number') { errorsOnly.rules[ruleName] = 1; diff --git a/packages/eslint-config-airbnb/whitespace.js b/packages/eslint-config-airbnb/whitespace.js index fcc5099af9..e896072154 100644 --- a/packages/eslint-config-airbnb/whitespace.js +++ b/packages/eslint-config-airbnb/whitespace.js @@ -1,5 +1,7 @@ /* eslint global-require: 0 */ +const { isArray } = Array; +const { entries } = Object; const { CLIEngine } = require('eslint'); if (CLIEngine) { @@ -11,7 +13,7 @@ if (CLIEngine) { const severities = ['off', 'warn', 'error']; function getSeverity(ruleConfig) { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { return getSeverity(ruleConfig[0]); } if (typeof ruleConfig === 'number') { @@ -25,13 +27,13 @@ if (CLIEngine) { const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); const baseRules = cli.getConfigForFile(require.resolve('./')).rules; - Object.entries(baseRules).forEach((rule) => { + entries(baseRules).forEach((rule) => { const ruleName = rule[0]; const ruleConfig = rule[1]; const severity = getSeverity(ruleConfig); if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') { - if (Array.isArray(ruleConfig)) { + if (isArray(ruleConfig)) { errorsOnly.rules[ruleName] = ['warn'].concat(ruleConfig.slice(1)); } else if (typeof ruleConfig === 'number') { errorsOnly.rules[ruleName] = 1; From 09adc22031e545ef818a57fee3e8a88de3afb0f0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 30 Jan 2024 10:59:23 -0800 Subject: [PATCH 16/31] [eslint config] [patch] `jsx-a11y/no-noninteractive-tabindex`: allow expression values --- packages/eslint-config-airbnb/rules/react-a11y.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js index 643cf64407..e83c5512ea 100644 --- a/packages/eslint-config-airbnb/rules/react-a11y.js +++ b/packages/eslint-config-airbnb/rules/react-a11y.js @@ -192,6 +192,7 @@ module.exports = { 'jsx-a11y/no-noninteractive-tabindex': ['error', { tags: [], roles: ['tabpanel'], + allowExpressionValues: true, }], // require onBlur instead of onChange From b23992033ce67ace887044140efb2df70aa1766d Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 30 Jan 2024 10:59:47 -0800 Subject: [PATCH 17/31] [eslint config] [patch] `jsx-a11y/no-redundant-roles`: allow `nav` to have `navigation` role --- packages/eslint-config-airbnb/rules/react-a11y.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb/rules/react-a11y.js b/packages/eslint-config-airbnb/rules/react-a11y.js index e83c5512ea..58065120a4 100644 --- a/packages/eslint-config-airbnb/rules/react-a11y.js +++ b/packages/eslint-config-airbnb/rules/react-a11y.js @@ -201,7 +201,9 @@ module.exports = { // ensure HTML elements do not specify redundant ARIA roles // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md - 'jsx-a11y/no-redundant-roles': 'error', + 'jsx-a11y/no-redundant-roles': ['error', { + nav: ['navigation'], + }], // Enforce that DOM elements without semantic behavior not have interaction handlers // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md From 5f019b1b11e69e7ee300ab15d5b0123c9c226bbe Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 25 Mar 2024 09:28:53 -0700 Subject: [PATCH 18/31] [eslint config] [*] [dev deps] update `tape` --- 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 92daf3c33b..6ae226d583 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -77,7 +77,7 @@ "eslint-plugin-import": "^2.29.1", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.7.4" + "tape": "^5.7.5" }, "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 69a4670f8e..622e30682f 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -82,7 +82,7 @@ "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", - "tape": "^5.7.4" + "tape": "^5.7.5" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", From 932951adc2d503d906c85b01179b4e1256c41896 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 25 Mar 2024 09:31:09 -0700 Subject: [PATCH 19/31] [eslint config] [deps] update `eslint-plugin-react` --- packages/eslint-config-airbnb/package.json | 4 ++-- packages/eslint-config-airbnb/rules/react.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 622e30682f..2b18a55f64 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -77,7 +77,7 @@ "eslint-find-rules": "^4.1.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", @@ -88,7 +88,7 @@ "eslint": "^7.32.0 || ^8.2.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0" }, "engines": { diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index ac4e4e29d3..b5ccc6ccf2 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -46,6 +46,13 @@ module.exports = { ], }], + // This rule enforces onChange or readonly attribute for checked property of input elements. + // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md + 'react/checked-requires-onchange-or-readonly': ['off', { + ignoreMissingProperties: false, + ignoreExclusiveCheckedAttribute: false + }], + // Prevent missing displayName in a React component definition // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md 'react/display-name': ['off', { ignoreTranspilerName: false }], From f20eca9f646954f2ebb0375e3a99b85e7b7161ad Mon Sep 17 00:00:00 2001 From: Riaz Date: Mon, 25 Mar 2024 13:00:44 +0400 Subject: [PATCH 20/31] [guide] fix compat table URL https://kangax.github.io/compat-table/es6/ hit a 404 error, URL: https://compat-table.github.io/compat-table/es6/ --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9681aa4b51..120057b062 100644 --- a/README.md +++ b/README.md @@ -3406,7 +3406,7 @@ Other Style Guides this.firstName = 'Panda'; // good, in environments where WeakMaps are available - // see https://kangax.github.io/compat-table/es6/#test-WeakMap + // see https://compat-table.github.io/compat-table/es6/#test-WeakMap const firstNames = new WeakMap(); firstNames.set(this, 'Panda'); ``` @@ -3860,7 +3860,7 @@ Other Style Guides - [Latest ECMA spec](https://tc39.github.io/ecma262/) - [ExploringJS](https://exploringjs.com/) - - [ES6 Compatibility Table](https://kangax.github.io/compat-table/es6/) + - [ES6 Compatibility Table](https://compat-table.github.io/compat-table/es6/) - [Comprehensive Overview of ES6 Features](http://es6-features.org/) - [JavaScript Roadmap](https://roadmap.sh/javascript) From c25bce83be4db06e6a221d79686c485cd2ed5d5d Mon Sep 17 00:00:00 2001 From: Hadi <104451011+khanhadi@users.noreply.github.com> Date: Sun, 7 Apr 2024 19:18:29 +0100 Subject: [PATCH 21/31] [readme] replace dead link with archive.org link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 120057b062..0f66720755 100644 --- a/README.md +++ b/README.md @@ -3861,7 +3861,7 @@ Other Style Guides - [Latest ECMA spec](https://tc39.github.io/ecma262/) - [ExploringJS](https://exploringjs.com/) - [ES6 Compatibility Table](https://compat-table.github.io/compat-table/es6/) - - [Comprehensive Overview of ES6 Features](http://es6-features.org/) + - [Comprehensive Overview of ES6 Features](https://web.archive.org/web/20240404212626/http://es6-features.org/) - [JavaScript Roadmap](https://roadmap.sh/javascript) **Read This** From 7a8f5687699bad856ca7bb7df0a731f0597a772a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 20 Sep 2024 22:36:49 -0700 Subject: [PATCH 22/31] [eslint config] [patch] add new disabled react rules --- packages/eslint-config-airbnb/rules/react.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index b5ccc6ccf2..c4d29e0b39 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -583,17 +583,23 @@ module.exports = { // 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 }], + + // https://github.com/jsx-eslint/eslint-plugin-react/blob/9668ee0762acd5c23f53cd3a372e2d8d9563944d/docs/rules/forward-ref-uses-ref.md + // TODO: semver-major, enable + 'react/forward-ref-uses-ref': 'off', + + // https://github.com/jsx-eslint/eslint-plugin-react/blob/9668ee0762acd5c23f53cd3a372e2d8d9563944d/docs/rules/jsx-props-no-spread-multi.md + // TODO: semver-major, enable + 'react/jsx-props-no-spread-multi': 'off', }, settings: { From e6f292286b1c03add35c98481337b5f26eebc06e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 20 Sep 2024 22:39:53 -0700 Subject: [PATCH 23/31] [eslint config] [*] [deps] update deps --- .../eslint-config-airbnb-base/package.json | 8 ++++---- packages/eslint-config-airbnb/package.json | 20 +++++++++---------- 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 6ae226d583..8f039d4d7c 100644 --- a/packages/eslint-config-airbnb-base/package.json +++ b/packages/eslint-config-airbnb-base/package.json @@ -68,20 +68,20 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { - "@babel/runtime": "^7.23.9", + "@babel/runtime": "^7.25.6", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.29.1", + "eslint-plugin-import": "^2.30.0", "in-publish": "^2.0.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.7.5" + "tape": "^5.9.0" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.29.1" + "eslint-plugin-import": "^2.30.0" }, "engines": { "node": "^10.12.0 || >=12.0.0" diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index 2b18a55f64..efa5be5cee 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -69,27 +69,27 @@ "eslint-config-airbnb-base": "^15.0.0" }, "devDependencies": { - "@babel/runtime": "^7.23.9", + "@babel/runtime": "^7.25.6", "babel-preset-airbnb": "^4.5.0", "babel-tape-runner": "^3.0.0", "eclint": "^2.8.1", "eslint": "^7.32.0 || ^8.2.0", "eslint-find-rules": "^4.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-react": "^7.34.1", - "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-import": "^2.30.0", + "eslint-plugin-jsx-a11y": "^6.10.0", + "eslint-plugin-react": "^7.36.1", + "eslint-plugin-react-hooks": "^4.6.2", "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", - "tape": "^5.7.5" + "tape": "^5.9.0" }, "peerDependencies": { "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-react": "^7.34.1", - "eslint-plugin-react-hooks": "^4.6.0" + "eslint-plugin-import": "^2.30.0", + "eslint-plugin-jsx-a11y": "^6.10.0", + "eslint-plugin-react": "^7.36.1", + "eslint-plugin-react-hooks": "^4.6.2" }, "engines": { "node": "^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0" From d1705c389ed3745f10139b32fca655c306dd56bb Mon Sep 17 00:00:00 2001 From: Ngene Arinzechukwu <120824375+emmanuel-455@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:47:10 +0100 Subject: [PATCH 24/31] [guide] [css] Added what BEM stands for (Block Element Modifier) --- css-in-javascript/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-in-javascript/README.md b/css-in-javascript/README.md index d6162df55d..2e6ab68a1b 100644 --- a/css-in-javascript/README.md +++ b/css-in-javascript/README.md @@ -34,7 +34,7 @@ - Use an underscore for modifiers to other styles. - > Why? Similar to BEM, this naming convention makes it clear that the styles are intended to modify the element preceded by the underscore. Underscores do not need to be quoted, so they are preferred over other characters, such as dashes. + > Why? Similar to [BEM](https://getbem.com/introduction/), this naming convention makes it clear that the styles are intended to modify the element preceded by the underscore. Underscores do not need to be quoted, so they are preferred over other characters, such as dashes. ```js // bad From 39b970f7024006d34d40d5afdf763b32c9a8a074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Minh=20Th=E1=BA=AFng?= Date: Tue, 24 Sep 2024 14:42:47 +0700 Subject: [PATCH 25/31] Add Zit Software to `In the Wild` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kim Minh Thắng --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0f66720755..e36a24265f 100644 --- a/README.md +++ b/README.md @@ -4028,6 +4028,7 @@ Other Style Guides - **WeBox Studio**: [weboxstudio/javascript](https://github.com/weboxstudio/javascript) - **Weggo**: [Weggo/javascript](https://github.com/Weggo/javascript) - **Zillow**: [zillow/javascript](https://github.com/zillow/javascript) + - **Zit Software**: [zit-software/javascript](https://github.com/zit-software/javascript) - **ZocDoc**: [ZocDoc/javascript](https://github.com/ZocDoc/javascript) **[⬆ back to top](#table-of-contents)** From b912288e4bf7fa46d9254d3cdfa190e9b59f36c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cnaandalist=E2=80=9D?= Date: Sun, 22 Sep 2024 05:00:08 +0700 Subject: [PATCH 26/31] [readme] Remove dead URLs --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index e36a24265f..342443625a 100644 --- a/README.md +++ b/README.md @@ -3952,7 +3952,6 @@ Other Style Guides - **Axept**: [axept/javascript](https://github.com/axept/javascript) - **Billabong**: [billabong/javascript](https://github.com/billabong/javascript) - **Bisk**: [bisk](https://github.com/Bisk/) - - **Bonhomme**: [bonhommeparis/javascript](https://github.com/bonhommeparis/javascript) - **Brainshark**: [brainshark/javascript](https://github.com/brainshark/javascript) - **CaseNine**: [CaseNine/javascript](https://github.com/CaseNine/javascript) - **Cerner**: [Cerner](https://github.com/cerner/) @@ -3965,7 +3964,6 @@ Other Style Guides - **Digitpaint** [digitpaint/javascript](https://github.com/digitpaint/javascript) - **Drupal**: [www.drupal.org](https://git.drupalcode.org/project/drupal/blob/8.6.x/core/.eslintrc.json) - **Ecosia**: [ecosia/javascript](https://github.com/ecosia/javascript) - - **Evernote**: [evernote/javascript-style-guide](https://github.com/evernote/javascript-style-guide) - **Evolution Gaming**: [evolution-gaming/javascript](https://github.com/evolution-gaming/javascript) - **EvozonJs**: [evozonjs/javascript](https://github.com/evozonjs/javascript) - **ExactTarget**: [ExactTarget/javascript](https://github.com/ExactTarget/javascript) @@ -3978,7 +3976,6 @@ Other Style Guides - **Grooveshark**: [grooveshark/javascript](https://github.com/grooveshark/javascript) - **Grupo-Abraxas**: [Grupo-Abraxas/javascript](https://github.com/Grupo-Abraxas/javascript) - **Happeo**: [happeo/javascript](https://github.com/happeo/javascript) - - **Honey**: [honeyscience/javascript](https://github.com/honeyscience/javascript) - **How About We**: [howaboutwe/javascript](https://github.com/howaboutwe/javascript-style-guide) - **HubSpot**: [HubSpot/javascript](https://github.com/HubSpot/javascript) - **Hyper**: [hyperoslo/javascript-playbook](https://github.com/hyperoslo/javascript-playbook/blob/master/style.md) @@ -4004,7 +4001,6 @@ Other Style Guides - **Pier 1**: [Pier1/javascript](https://github.com/pier1/javascript) - **Qotto**: [Qotto/javascript-style-guide](https://github.com/Qotto/javascript-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) - **Shutterfly**: [shutterfly/javascript](https://github.com/shutterfly/javascript) From e6080c7beed96700a599e7d86f1517bdc8269366 Mon Sep 17 00:00:00 2001 From: Richard Klees Date: Thu, 11 May 2023 17:30:30 +0200 Subject: [PATCH 27/31] [readme] add ILIAS to users --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 342443625a..9026489006 100644 --- a/README.md +++ b/README.md @@ -3979,6 +3979,7 @@ Other Style Guides - **How About We**: [howaboutwe/javascript](https://github.com/howaboutwe/javascript-style-guide) - **HubSpot**: [HubSpot/javascript](https://github.com/HubSpot/javascript) - **Hyper**: [hyperoslo/javascript-playbook](https://github.com/hyperoslo/javascript-playbook/blob/master/style.md) + - **ILIAS**: [ILIAS](https://github.com/ILIAS-eLearning/ILIAS) - **InterCity Group**: [intercitygroup/javascript-style-guide](https://github.com/intercitygroup/javascript-style-guide) - **Jam3**: [Jam3/Javascript-Code-Conventions](https://github.com/Jam3/Javascript-Code-Conventions) - **JSSolutions**: [JSSolutions/javascript](https://github.com/JSSolutions/javascript) From f45bd1ebc0549d370ccd7cb0ca039b40d3be768b Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 2 Oct 2024 01:14:01 +0400 Subject: [PATCH 28/31] [eslint config] [*] [fix] fix crash in eslint invocation with TIMING env set --- packages/eslint-config-airbnb-base/whitespace.js | 8 +++++++- packages/eslint-config-airbnb/whitespace.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb-base/whitespace.js b/packages/eslint-config-airbnb-base/whitespace.js index e896072154..01e5198671 100644 --- a/packages/eslint-config-airbnb-base/whitespace.js +++ b/packages/eslint-config-airbnb-base/whitespace.js @@ -51,5 +51,11 @@ if (CLIEngine) { const path = require('path'); const { execSync } = require('child_process'); - module.exports = JSON.parse(String(execSync(path.join(__dirname, 'whitespace-async.js')))); + // NOTE: ESLint adds runtime statistics to the output (so it's no longer JSON) if TIMING is set + module.exports = JSON.parse(String(execSync(path.join(__dirname, 'whitespace-async.js'), { + env: { + ...process.env, + TIMING: undefined, + } + }))); } diff --git a/packages/eslint-config-airbnb/whitespace.js b/packages/eslint-config-airbnb/whitespace.js index e896072154..01e5198671 100644 --- a/packages/eslint-config-airbnb/whitespace.js +++ b/packages/eslint-config-airbnb/whitespace.js @@ -51,5 +51,11 @@ if (CLIEngine) { const path = require('path'); const { execSync } = require('child_process'); - module.exports = JSON.parse(String(execSync(path.join(__dirname, 'whitespace-async.js')))); + // NOTE: ESLint adds runtime statistics to the output (so it's no longer JSON) if TIMING is set + module.exports = JSON.parse(String(execSync(path.join(__dirname, 'whitespace-async.js'), { + env: { + ...process.env, + TIMING: undefined, + } + }))); } From 6499695ac11c4640ed0f77f8865a1adcb32d3239 Mon Sep 17 00:00:00 2001 From: Matheus Felipe Date: Fri, 13 Oct 2023 04:58:10 -0300 Subject: [PATCH 29/31] [readme] update link to es5 and es6 compat table in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9026489006..9a325a355b 100644 --- a/README.md +++ b/README.md @@ -3746,7 +3746,7 @@ Other Style Guides ## ECMAScript 5 Compatibility - - [27.1](#es5-compat--kangax) Refer to [Kangax](https://twitter.com/kangax/)’s ES5 [compatibility table](https://kangax.github.io/es5-compat-table/). + - [27.1](#es5-compat--kangax) Refer to [Kangax](https://twitter.com/kangax/)’s ES5 [compatibility table](https://compat-table.github.io/compat-table/es5/). **[⬆ back to top](#table-of-contents)** From 11f986fdc7d6b4c80e396437e9c45c939362bdee Mon Sep 17 00:00:00 2001 From: ptmkenny <1451472+ptmkenny@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:03:23 +0900 Subject: [PATCH 30/31] [eslint config] [deps] update `eslint-plugin-react-hooks` --- packages/eslint-config-airbnb/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index efa5be5cee..c36359ea7c 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -78,7 +78,7 @@ "eslint-plugin-import": "^2.30.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.36.1", - "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-hooks": "^5.1.0", "in-publish": "^2.0.1", "react": ">= 0.13.0", "safe-publish-latest": "^2.0.0", @@ -89,7 +89,7 @@ "eslint-plugin-import": "^2.30.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.36.1", - "eslint-plugin-react-hooks": "^4.6.2" + "eslint-plugin-react-hooks": "^5.1.0" }, "engines": { "node": "^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0" From 99ade7a6b18b059380ed9d187873517ce88a0e33 Mon Sep 17 00:00:00 2001 From: Christian Vuerings Date: Wed, 17 Sep 2025 18:52:54 +0200 Subject: [PATCH 31/31] Add code of conduct Airbnb has adopted a Code of Conduct that applies to all open source projects. This addition ensures project participants understand community standards and provides clear reporting mechanisms for violations. --- CODE_OF_CONDUCT.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..c81dc69c25 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +Airbnb has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full Code of Conduct text](https://airbnb.io/codeofconduct/) so that you can understand what actions will and will not be tolerated. Report violations to the maintainers of this project or to [opensource-conduct@airbnb.com](mailto:opensource-conduct@airbnb.com). + +Reports sent to [opensource-conduct@airbnb.com](mailto:opensource-conduct@airbnb.com) are received by Airbnb's open source code of conduct moderation team, which is composed of Airbnb employees. All communications are private and confidential.