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

no-array-method-this-argument: Check Array.from() #2262

Merged
merged 5 commits into from Jan 18, 2024

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Jan 18, 2024

Fixes #2144

@fisker fisker marked this pull request as ready for review January 18, 2024 14:01
@sindresorhus sindresorhus merged commit 797caee into sindresorhus:main Jan 18, 2024
18 checks passed
@fisker fisker deleted the array-from-this branch January 18, 2024 17:52
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊
--------------------------------------------------------------------------------␊
Suggestion 1/2: Remove the second argument.␊
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note to myself: message need fix, it's the third, not the second argument.

@ghost
Copy link

ghost commented Feb 6, 2024

Hey @fisker
I believe you also need to add Check.from() in the documentation of this rule.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md

This rule checks following array methods accepts thisArg:

Array#every()
Array#filter()
Array#find()
Array#findLast()
Array#findIndex()
Array#findLastIndex()
Array#flatMap()
Array#forEach()
Array#map()
Array#some()

@sindresorhus changelog of v51.0.0 could have added this single new responsibility of this rule in the documentation. True or false?

@fisker
Copy link
Collaborator Author

fisker commented Feb 6, 2024

I believe you also need to add Check.from() in the documentation of this rule.

Missed that, would you like to fix it?

@ghost
Copy link

ghost commented Feb 6, 2024

I don't know how to do it. Thanks though <3 @fisker

@fisker
Copy link
Collaborator Author

fisker commented Feb 6, 2024

No problem, I'll fix that.

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.

no-array-method-this-argument doesn't warn about Array.from()
2 participants