Skip to content

Commit

Permalink
Exclude 2 elements
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Mar 17, 2020
1 parent 1f25046 commit 5395449
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rules/no-unreadable-array-destructuring.js
Expand Up @@ -7,7 +7,7 @@ const isCommaFollowedWithComma = (element, index, array) =>

const create = context => {
return {
'ArrayPattern[elements.length>1]': node => {
'ArrayPattern[elements.length>=3]': node => {
if (node.elements.some(isCommaFollowedWithComma)) {
context.report({
node,
Expand Down
6 changes: 3 additions & 3 deletions test/no-unreadable-array-destructuring.js
Expand Up @@ -32,7 +32,7 @@ ruleTester.run('no-unreadable-array-destructuring', rule, {
'function foo([bar,, baz,, qux]) {}',
'const [, ...rest] = parts;',
// This is stupid, but valid code
'const [,] = parts;'
'const [,,] = parts;'
],
invalid: [
{
Expand Down Expand Up @@ -73,8 +73,8 @@ ruleTester.run('no-unreadable-array-destructuring', rule, {
},
// This is stupid, but valid code
{
code: 'const [,,] = parts;',
code: 'const [,,,] = parts;',
errors
},
}
]
});

0 comments on commit 5395449

Please sign in to comment.