Skip to content

Fix: Fix false positive with empty array variable in require-meta-has-suggestions rule #171

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

Conversation

bmish
Copy link
Member

@bmish bmish commented Jul 27, 2021

If the suggestions array is initialized as an empty array variable, we need to assume that someone may have pushed suggestion objects to it, so we should consider that a usage of suggestions.

Previously, this rule incorrectly assumed that using const suggest = []; ... context.report({suggest,...}); meant the rule was not using suggestions.

Real world example here: https://github.com/eslint/eslint/blob/master/lib/rules/no-nonoctal-decimal-escape.js#L91

@aladdin-add aladdin-add merged commit fffa881 into eslint-community:master Jul 27, 2021
@aladdin-add
Copy link
Contributor

released in [email protected]

@bmish
Copy link
Member Author

bmish commented Jul 27, 2021

Thanks!

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.

2 participants