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

Add no-array-method-this-argument rule #1357

Merged
merged 6 commits into from
Jun 17, 2021

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Jun 16, 2021

Fixes #974

--------------------------------------------------------------------------------␊
Suggestion 2/2: Use bound function.␊
1 | array.map(callback.bind(thisArgument))␊
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 didn't auto-fix this case to use callback.bind, since it's not the best option, people may won't get attention with auto-fix.

@fisker fisker marked this pull request as ready for review June 16, 2021 09:01
docs/rules/no-array-method-this-argument.md Outdated Show resolved Hide resolved
docs/rules/no-array-method-this-argument.md Outdated Show resolved Hide resolved
rules/no-array-method-this-argument.js Outdated Show resolved Hide resolved
rules/no-array-method-this-argument.js Outdated Show resolved Hide resolved
@sindresorhus sindresorhus merged commit 96587f2 into sindresorhus:main Jun 17, 2021
@fisker fisker deleted the no-array-method-this-argument branch June 17, 2021 11:24
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.

Rule proposal: No this argument in array methods when using arrow functions
2 participants