Skip to content

Commit 0d52dd7

Browse files
committed
feature: eslint-plugin-putout: long-properties-destructuring: NumericLiteral
1 parent 28d5e68 commit 0d52dd7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/eslint-plugin-putout/lib/long-properties-destructuring/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const {isCorrectLoc} = require('../common');
55
const {
66
isImportDeclaration,
77
isForOfStatement,
8+
isIdentifier,
9+
isSpreadElement,
10+
isRestElement,
811
} = types;
912

1013
const parseOptions = (options) => {
@@ -76,6 +79,9 @@ module.exports.filter = ({node}, options) => {
7679

7780
function isCorrectPropertiesLength(properties, {maxLength}) {
7881
for (const prop of properties) {
82+
if (!isIdentifier(prop.key) && !isSpreadElement(prop) && !isRestElement(prop))
83+
return true;
84+
7985
const {name} = prop.key || prop.argument;
8086

8187
if (name.length >= maxLength)

packages/eslint-plugin-putout/lib/long-properties-destructuring/index.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ ruleTester.run('long-properties-destructuring', rule, {
4040
for (const {Hello, HelloWorld} of Words) {}
4141
`,
4242
`
43+
const {0: a, 1: b} = c;
44+
`,
45+
`
4346
const {a, b, c, d} = e;
4447
`, {
4548
code: montag`

0 commit comments

Comments
 (0)