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

prefer-flat-map should not trigger on .flat() with a param >1 #61

Closed
Sembiance opened this issue May 11, 2020 · 0 comments
Closed

prefer-flat-map should not trigger on .flat() with a param >1 #61

Sembiance opened this issue May 11, 2020 · 0 comments
Labels

Comments

@Sembiance
Copy link

Array.flat() has an optional 'depth' parameter (default of 1).
Array.flatMap() only supports the default depth of 1.

So if you have code:

myArray.flat(99)

The rule shouldn't trigger on that, but it currently does.

So basically if the .flat() call has an argument and that argument is greater than 1, then don't report it as an error as .flatMap() won't work in this situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants