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

Fix: Only consider functions with a single argument as function-style rules #213

Merged

Conversation

bmish
Copy link
Member

@bmish bmish commented Oct 14, 2021

I did some further real-world testing and found another heuristic we can use to ensure we only detect actual function-style rules (reducing false positives).

All function-styles rules should have the single context argument. This is needed so the rule can use context.report(...) to report violations.

Note that while we are now checking for a single argument, we are not checking anything about this argument, as it could have different names (doesn't have to be named context) or could use destructuring if desired.

This idea was also suggested here: #81 (comment)

Fixes #81.

Part of v4 release (#120).

https://eslint.org/docs/developer-guide/working-with-rules-deprecated

@bmish bmish mentioned this pull request Oct 14, 2021
20 tasks
Copy link
Contributor

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aladdin-add aladdin-add merged commit 86bf1f9 into eslint-community:master Oct 15, 2021
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.

False-positive for require-meta-docs-url rule
2 participants