Skip to content
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

Merged
merged 6 commits into from May 3, 2020

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented May 2, 2020

Fixes #696

Comment on lines +153 to +154
identifiers.length === 1 &&
identifiers.every(identifier => !isMultipleCall(identifier, node))
Copy link
Collaborator Author

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 :)

Comment on lines 110 to 120
const multipleCallNodeTypes = new Set([
'ForOfStatement',
'ForStatement',
'WhileStatement',
'DoWhileStatement',
'FunctionDeclaration',
'FunctionExpression',
'ArrowFunctionExpression',
'ObjectMethod',
'ClassMethod'
]);
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

@sindresorhus sindresorhus merged commit 54c6f54 into sindresorhus:master May 3, 2020
@fisker fisker deleted the prefer-set-has-update branch May 3, 2020 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prefer-set-has is little bit annoying
2 participants