Skip to content

Commit d08e15b

Browse files
committed
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.
1 parent 0784086 commit d08e15b

11 files changed

Lines changed: 49 additions & 0 deletions

File tree

docs/description/description.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/multiple-tests/all-patterns-typescript/patterns.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@
17241724
<module name="n_hashbang" />
17251725
<module name="n_no-hide-core-modules" />
17261726
<module name="n_shebang" />
1727+
<module name="newline-destructuring_newline" />
17271728
<module name="no-only-tests_no-only-tests" />
17281729
<module name="no-unsanitized_property" />
17291730
<module name="no-unsanitized_method" />

docs/multiple-tests/all-patterns/patterns.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@
17241724
<module name="n_hashbang" />
17251725
<module name="n_no-hide-core-modules" />
17261726
<module name="n_shebang" />
1727+
<module name="newline-destructuring_newline" />
17271728
<module name="no-only-tests_no-only-tests" />
17281729
<module name="no-unsanitized_property" />
17291730
<module name="no-unsanitized_method" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<module name="root">
2+
<module name="BeforeExecutionExclusionFileFilter">
3+
<property name="fileNamePattern" value=".*\.json" />
4+
</module>
5+
</module>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<checkstyle version="4.3">
3+
<file name="newline-destructuring.js">
4+
<error source="newline-destructuring_newline" line="2" message="Object desctructuring lines must be broken into multiple lines if there are more than 2 properties" severity="error" />
5+
</file>
6+
</checkstyle>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 2020
4+
},
5+
"plugins": ["newline-destructuring"],
6+
"rules": {
7+
"newline-destructuring/newline": ["error", { "items": 2 }]
8+
}
9+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const obj = { a: 1, b: 2, c: 3 };
2+
const { a, b, c } = obj;

docs/patterns.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
"eslint-plugin-mocha": "^10.4.3",
291291
"eslint-plugin-monorepo": "^0.3.2",
292292
"eslint-plugin-n": "^17.7.0",
293+
"eslint-plugin-newline-destructuring": "^1.2.2",
293294
"eslint-plugin-no-only-tests": "^3.1.0",
294295
"eslint-plugin-no-unsanitized": "^4.0.2",
295296
"eslint-plugin-nuxt": "^4.0.0",

0 commit comments

Comments
 (0)