Skip to content

Add no-array-reverse rule #2677

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

Merged
merged 5 commits into from
Jul 5, 2025
Merged

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Jun 12, 2025

Part of #1514

Forbid array.reverse(), but allow it to be used as an expression statement by default.

Even in this case

const reversed = [...array].reverse()

array can be a spreadable but not an array, so this rule is not fixable for any case.

@fisker
Copy link
Collaborator Author

fisker commented Jun 12, 2025

//cc @axetroy @fregante

mentioning you since you are involved in #2428

@fisker fisker marked this pull request as ready for review June 12, 2025 17:11
@fisker fisker force-pushed the no-array-reverse branch from 01e37ef to e39a67f Compare June 27, 2025 00:41
@fisker fisker mentioned this pull request Jun 27, 2025
@fisker fisker force-pushed the no-array-reverse branch from e39a67f to e753e11 Compare June 27, 2025 01:01
@sindresorhus sindresorhus merged commit b051302 into sindresorhus:main Jul 5, 2025
18 checks passed
@fisker fisker deleted the no-array-reverse branch July 5, 2025 23:25
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