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

array-callback-return should report .flatMap() #12235

Closed
mdjermanovic opened this issue Sep 7, 2019 · 3 comments
Closed

array-callback-return should report .flatMap() #12235

mdjermanovic opened this issue Sep 7, 2019 · 3 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible rule Relates to ESLint's core rules
Projects

Comments

@mdjermanovic
Copy link
Member

Array.prototype.flatMap was added in ECMAScript 2019

What rule do you want to change?

array-callback-return

Does this change cause the rule to produce more or fewer warnings?

more

How will the change be implemented? (New option, new default behavior, etc.)?

new default behavior

Please provide some example code that this change will affect:

/*eslint array-callback-return: "error"*/

foo.flatMap(x => {})

What does the rule currently do for this code?

No errors

What will the rule do after it's changed?

Error: Expected to return a value in arrow function.

Are you willing to submit a pull request to implement this change?

Yes.

Can this be a semver-minor default behavior change? It looks too 'small' for an option.

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 7, 2019
@platinumazure
Copy link
Member

I'm worried about the potential breaking change impact.

Could we look for ecmaVersion >= 2019 in a semver-minor update, then maybe remove that check in the next major release?

@mdjermanovic
Copy link
Member Author

Could we look for ecmaVersion >= 2019 in a semver-minor update, then maybe remove that check in the next major release?

I think it's a good idea.

Might be technically a bit more correct to check if an ES2019+ environment is activated rather than parser, but I don't think it's possible from within a rule at this moment.

@g-plane
Copy link
Member

g-plane commented Sep 8, 2019

I don't think it's a breaking change, though it may break user's tests or CI.

@mdjermanovic mdjermanovic self-assigned this Sep 9, 2019
@g-plane g-plane added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 27, 2019
@mdjermanovic mdjermanovic added the breaking This change is backwards-incompatible label Oct 21, 2019
@mysticatea mysticatea added this to Issues which have PR in v7.0.0 Nov 7, 2019
@kaicataldo kaicataldo removed bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint labels Dec 20, 2019
v7.0.0 automation moved this from Issues which have PR to Done Jan 17, 2020
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 17, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible rule Relates to ESLint's core rules
Projects
No open projects
v7.0.0
  
Done
Development

No branches or pull requests

4 participants