From 8d3c25f47b1a377993c42d44f0b1722193aa7361 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 13 Feb 2022 22:11:00 -0500 Subject: [PATCH 1/4] Sponsors: Sync README with website --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63bff9ae824..b0ef0d66b9c 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Automattic

Gold Sponsors

Contra Nx (by Nrwl) Chrome's Web Framework & Tools Performance Fund Salesforce Airbnb American Express Substack

Silver Sponsors

Liftoff

Bronze Sponsors

-

launchdarkly Anagram Solver VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Practice Ignition

+

launchdarkly Anagram Solver VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Practice Ignition

## Technology Sponsors From d992382dcd3c0341651d623c8167a62897444a1e Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 14 Feb 2022 20:12:42 -0500 Subject: [PATCH 2/4] Sponsors: Sync README with website --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0ef0d66b9c..fe9812dccc7 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Platinum Sponsors

-

Automattic

Gold Sponsors

+

Automattic Flux Industries

Gold Sponsors

Contra Nx (by Nrwl) Chrome's Web Framework & Tools Performance Fund Salesforce Airbnb American Express Substack

Silver Sponsors

Liftoff

Bronze Sponsors

launchdarkly Anagram Solver VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Practice Ignition

From ee7c5d14a2cb5ce352d1851cec858b942572d2cc Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Tue, 15 Feb 2022 17:01:20 +0530 Subject: [PATCH 3/4] fix: false positive in `camelcase` with combined properties (#15581) * fix: false positive in `camelcase` with combined options Fixes #15572 * test: add mores cases for camelcase rule * chore: update JSDoc comment * test: add location * chore: remove unwanted change --- lib/rules/camelcase.js | 4 +- tests/lib/rules/camelcase.js | 101 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/lib/rules/camelcase.js b/lib/rules/camelcase.js index 6bb1838a72e..e4761466902 100644 --- a/lib/rules/camelcase.js +++ b/lib/rules/camelcase.js @@ -146,7 +146,7 @@ module.exports = { /** * Checks if a given binding identifier uses the original name as-is. - * - If it's in object destructuring, the original name is its property name. + * - If it's in object destructuring or object expression, the original name is its property name. * - If it's in import declaration, the original name is its exported name. * @param {ASTNode} node The `Identifier` node to check. * @returns {boolean} `true` if the identifier uses the original name as-is. @@ -161,7 +161,7 @@ module.exports = { switch (parent.type) { case "Property": return ( - parent.parent.type === "ObjectPattern" && + (parent.parent.type === "ObjectPattern" || parent.parent.type === "ObjectExpression") && parent.value === valueNode && !parent.computed && parent.key.type === "Identifier" && diff --git a/tests/lib/rules/camelcase.js b/tests/lib/rules/camelcase.js index 3a47a1b4b2d..79c237ce202 100644 --- a/tests/lib/rules/camelcase.js +++ b/tests/lib/rules/camelcase.js @@ -407,6 +407,35 @@ ruleTester.run("camelcase", rule, { code: "class C { snake_case; #snake_case; #snake_case2() {} }", options: [{ properties: "never" }], parserOptions: { ecmaVersion: 2022 } + }, + + // Combinations of `properties` and `ignoreDestructring` + { + code: ` + const { some_property } = obj; + + const bar = { some_property }; + + obj.some_property = 10; + + const xyz = { some_property: obj.some_property }; + + const foo = ({ some_property }) => { + console.log(some_property) + }; + `, + options: [{ properties: "never", ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 2022 } + }, + + // https://github.com/eslint/eslint/issues/15572 + { + code: ` + const { some_property } = obj; + doSomething({ some_property }); + `, + options: [{ properties: "never", ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 2022 } } ], invalid: [ @@ -1416,6 +1445,78 @@ ruleTester.run("camelcase", rule, { options: [{ properties: "always" }], parserOptions: { ecmaVersion: 2022 }, errors: [{ messageId: "notCamelCasePrivate", data: { name: "snake_case" } }] + }, + + // Combinations of `properties` and `ignoreDestructring` + { + code: ` + const { some_property } = obj; + doSomething({ some_property }); + `, + options: [{ properties: "always", ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 2022 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "some_property" }, + line: 3, + column: 27 + } + ] + }, + { + code: ` + const { some_property } = obj; + doSomething({ some_property }); + doSomething({ [some_property]: "bar" }); + `, + options: [{ properties: "never", ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 2022 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "some_property" }, + line: 4, + column: 28 + } + ] + }, + { + code: ` + const { some_property } = obj; + + const bar = { some_property }; + + obj.some_property = 10; + + const xyz = { some_property: obj.some_property }; + + const foo = ({ some_property }) => { + console.log(some_property) + }; + `, + options: [{ properties: "always", ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 2022 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "some_property" }, + line: 4, + column: 27 + }, + { + messageId: "notCamelCase", + data: { name: "some_property" }, + line: 6, + column: 17 + }, + { + messageId: "notCamelCase", + data: { name: "some_property" }, + line: 8, + column: 27 + } + ] } ] }); From 3fc919626ef6a00e35bb6b559b60a1e89cf6ca1a Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Wed, 16 Feb 2022 02:26:39 +0100 Subject: [PATCH 4/4] chore: include `tests/conf` in test runs (#15610) --- Makefile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.js b/Makefile.js index 83c6d4095de..54ef7060675 100644 --- a/Makefile.js +++ b/Makefile.js @@ -73,7 +73,7 @@ const NODE = "node ", // intentional extra space JSON_FILES = find("conf/").filter(fileType("json")), MARKDOWNLINT_IGNORED_FILES = fs.readFileSync(path.join(__dirname, ".markdownlintignore"), "utf-8").split("\n"), MARKDOWN_FILES_ARRAY = find("docs/").concat(ls(".")).filter(fileType("md")).filter(file => !MARKDOWNLINT_IGNORED_FILES.includes(file)), - TEST_FILES = "\"tests/{bin,lib,tools}/**/*.js\"", + TEST_FILES = "\"tests/{bin,conf,lib,tools}/**/*.js\"", PERF_ESLINTRC = path.join(PERF_TMP_DIR, "eslintrc.yml"), PERF_MULTIFILES_TARGET_DIR = path.join(PERF_TMP_DIR, "eslint"), PERF_MULTIFILES_TARGETS = `"${PERF_MULTIFILES_TARGET_DIR + path.sep}{lib,tests${path.sep}lib}${path.sep}**${path.sep}*.js"`,