From d08e15b415c2acbd31393ff052a3042dc3d48cec Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Wed, 20 May 2026 16:34:37 +0200 Subject: [PATCH 1/3] Add eslint-plugin-newline-destructuring Register the plugin and add a multiple-test that verifies the newline-destructuring/newline rule via a project .eslintrc.json. --- docs/description/description.json | 6 ++++++ .../all-patterns-typescript/patterns.xml | 1 + docs/multiple-tests/all-patterns/patterns.xml | 1 + docs/multiple-tests/newline-destructuring/patterns.xml | 5 +++++ docs/multiple-tests/newline-destructuring/results.xml | 6 ++++++ .../newline-destructuring/src/.eslintrc.json | 9 +++++++++ .../newline-destructuring/src/newline-destructuring.js | 2 ++ docs/patterns.json | 7 +++++++ package-lock.json | 10 ++++++++++ package.json | 1 + src/eslintPlugins.ts | 1 + 11 files changed, 49 insertions(+) create mode 100644 docs/multiple-tests/newline-destructuring/patterns.xml create mode 100644 docs/multiple-tests/newline-destructuring/results.xml create mode 100644 docs/multiple-tests/newline-destructuring/src/.eslintrc.json create mode 100644 docs/multiple-tests/newline-destructuring/src/newline-destructuring.js diff --git a/docs/description/description.json b/docs/description/description.json index e297bf568..19ce681b6 100644 --- a/docs/description/description.json +++ b/docs/description/description.json @@ -13703,6 +13703,12 @@ "description": "Require correct usage of hashbang", "timeToFix": 5 }, + { + "parameters": [], + "patternId": "newline-destructuring_newline", + "title": "Newline destructuring: Newline", + "timeToFix": 5 + }, { "parameters": [ { diff --git a/docs/multiple-tests/all-patterns-typescript/patterns.xml b/docs/multiple-tests/all-patterns-typescript/patterns.xml index baa9b8c92..a18ed4de3 100644 --- a/docs/multiple-tests/all-patterns-typescript/patterns.xml +++ b/docs/multiple-tests/all-patterns-typescript/patterns.xml @@ -1724,6 +1724,7 @@ + diff --git a/docs/multiple-tests/all-patterns/patterns.xml b/docs/multiple-tests/all-patterns/patterns.xml index baa9b8c92..a18ed4de3 100644 --- a/docs/multiple-tests/all-patterns/patterns.xml +++ b/docs/multiple-tests/all-patterns/patterns.xml @@ -1724,6 +1724,7 @@ + diff --git a/docs/multiple-tests/newline-destructuring/patterns.xml b/docs/multiple-tests/newline-destructuring/patterns.xml new file mode 100644 index 000000000..e2198d7d2 --- /dev/null +++ b/docs/multiple-tests/newline-destructuring/patterns.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/docs/multiple-tests/newline-destructuring/results.xml b/docs/multiple-tests/newline-destructuring/results.xml new file mode 100644 index 000000000..4ba542c7d --- /dev/null +++ b/docs/multiple-tests/newline-destructuring/results.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/docs/multiple-tests/newline-destructuring/src/.eslintrc.json b/docs/multiple-tests/newline-destructuring/src/.eslintrc.json new file mode 100644 index 000000000..19db7e534 --- /dev/null +++ b/docs/multiple-tests/newline-destructuring/src/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "parserOptions": { + "ecmaVersion": 2020 + }, + "plugins": ["newline-destructuring"], + "rules": { + "newline-destructuring/newline": ["error", { "items": 2 }] + } +} diff --git a/docs/multiple-tests/newline-destructuring/src/newline-destructuring.js b/docs/multiple-tests/newline-destructuring/src/newline-destructuring.js new file mode 100644 index 000000000..81f7edec4 --- /dev/null +++ b/docs/multiple-tests/newline-destructuring/src/newline-destructuring.js @@ -0,0 +1,2 @@ +const obj = { a: 1, b: 2, c: 3 }; +const { a, b, c } = obj; diff --git a/docs/patterns.json b/docs/patterns.json index 4b054a55e..b076e6fda 100644 --- a/docs/patterns.json +++ b/docs/patterns.json @@ -13947,6 +13947,13 @@ "parameters": [], "enabled": false }, + { + "patternId": "newline-destructuring_newline", + "level": "Info", + "category": "CodeStyle", + "parameters": [], + "enabled": false + }, { "patternId": "no-only-tests_no-only-tests", "level": "Error", diff --git a/package-lock.json b/package-lock.json index 0cff88d89..7192d651a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -233,6 +233,7 @@ "eslint-plugin-mocha": "^10.4.3", "eslint-plugin-monorepo": "^0.3.2", "eslint-plugin-n": "^17.7.0", + "eslint-plugin-newline-destructuring": "^1.2.2", "eslint-plugin-no-only-tests": "^3.1.0", "eslint-plugin-no-unsanitized": "^4.0.2", "eslint-plugin-nuxt": "^4.0.0", @@ -43390,6 +43391,15 @@ "node": ">=6" } }, + "node_modules/eslint-plugin-newline-destructuring": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-newline-destructuring/-/eslint-plugin-newline-destructuring-1.2.2.tgz", + "integrity": "sha512-QfKQpdx+ez2E233B6xSG82+SdkKhxSchTJCjUHjJ2RmMCq+v2IBTaR8wK2pejTBV05p/J1qB8QOOKXQNqWJGSA==", + "license": "MIT", + "peerDependencies": { + "eslint": ">=7.2.0" + } + }, "node_modules/eslint-plugin-no-only-tests": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-3.1.0.tgz", diff --git a/package.json b/package.json index 958d3da79..98f1696f9 100644 --- a/package.json +++ b/package.json @@ -290,6 +290,7 @@ "eslint-plugin-mocha": "^10.4.3", "eslint-plugin-monorepo": "^0.3.2", "eslint-plugin-n": "^17.7.0", + "eslint-plugin-newline-destructuring": "^1.2.2", "eslint-plugin-no-only-tests": "^3.1.0", "eslint-plugin-no-unsanitized": "^4.0.2", "eslint-plugin-nuxt": "^4.0.0", diff --git a/src/eslintPlugins.ts b/src/eslintPlugins.ts index 9e6c8a9b2..2572c0501 100644 --- a/src/eslintPlugins.ts +++ b/src/eslintPlugins.ts @@ -72,6 +72,7 @@ const packageNames: string[] = [ "eslint-plugin-mocha", "eslint-plugin-monorepo", "eslint-plugin-n", + "eslint-plugin-newline-destructuring", "eslint-plugin-no-only-tests", "eslint-plugin-no-unsanitized", "eslint-plugin-nuxt", From 9f5f214ffc155202343279079e036068862a6039 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Wed, 20 May 2026 17:07:27 +0200 Subject: [PATCH 2/3] Fix newline-destructuring multiple-test severity The rule meta type is layout, which Codacy maps to Info level. From 9922c3d3b83f74dacf9a30232b9bf2b22f84fd45 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Wed, 20 May 2026 17:07:36 +0200 Subject: [PATCH 3/3] Fix newline-destructuring multiple-test severity The rule meta type is layout, which Codacy maps to Info level. --- docs/multiple-tests/newline-destructuring/results.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/multiple-tests/newline-destructuring/results.xml b/docs/multiple-tests/newline-destructuring/results.xml index 4ba542c7d..28f354391 100644 --- a/docs/multiple-tests/newline-destructuring/results.xml +++ b/docs/multiple-tests/newline-destructuring/results.xml @@ -1,6 +1,6 @@ - +