New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefer-set-has
: Ignore arrays only checking existence once
#706
prefer-set-has
: Ignore arrays only checking existence once
#706
Conversation
identifiers.length === 1 && | ||
identifiers.every(identifier => !isMultipleCall(identifier, node)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use .every()
on purpose, we might add option to ignore 2
:)
rules/prefer-set-has.js
Outdated
const multipleCallNodeTypes = new Set([ | ||
'ForOfStatement', | ||
'ForStatement', | ||
'WhileStatement', | ||
'DoWhileStatement', | ||
'FunctionDeclaration', | ||
'FunctionExpression', | ||
'ArrowFunctionExpression', | ||
'ObjectMethod', | ||
'ClassMethod' | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These types are all I got in mind could call .includes()
multiple times. Maybe more from other parser, need feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot ForInStatement
, added in aaa3638.
Fixes #696