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
Update: Array.prototype.flatMap in array-callback-return (fixes #12235) #12267
Conversation
@@ -20,14 +20,17 @@ This rule finds callback functions of the following methods, then checks usage o | |||
* [`Array.prototype.every`](https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.every) | |||
* [`Array.prototype.filter`](https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.filter) | |||
* [`Array.prototype.find`](https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.find) | |||
* [`Array.prototype.findIndex`](https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.findIndex ) | |||
* [`Array.prototype.findIndex`](https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.findindex ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a side note, all of these links shouldn't be to the always-obsolete snapshots on ecma-international.org, but rather to the only correct version of the spec, https://tc39.es/ecma262/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to fix the links in another PR, as two of them are partially broken (wrong #
).
I understand that https://tc39.es/ecma262/ link represents the actual version much more than a draft, but it's officially still a draft? Also, it has the Draft word in the title, so I'm not sure is it OK to use this link, or just fix the links to ES2015. Or maybe change all links to ES2019.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s a living standard; whatever’s on github is always the latest version.
Thank you for contribution. But I'd like to defer to merge as a breaking change until 7.0.0. Because |
Can it be added behind an option now, and then turned on by default in v7? |
I'm not a big fan of adding an option for only |
As a side note, I would be interested in seeing if we could do a 7.0.0 release soon. It would be nice to get into the habit of doing smaller, more frequent major releases. But I know some users already struggle to do major version upgrades even if we do them infrequently... |
Just a thought, perhaps the rule could have an option - array of additional method names. That would avoid similar problems in the future. Albeit, that could turn this rule into a generic configurable "callback-return" rule, so I'm not sure if this is a good idea. |
More frequent majors is a heavy burden on shared configs and plugins. |
For v7.0.0, is there a need to check As a similar thing, there is no |
I agree there is probably no need to check ecmaVersion if we just label this as breaking and add it in 7.0.0. |
@kaicataldo I added 'do not merge' because this needs to be changed if there is no need to check ecmaVersion. Sorry, I should have left a note. |
Ah, sorry! I should have asked. I was removing "do not merge" labels from "breaking" changes because we're now able to merge semver-major PRs in preparing for our first v7 alpha release. |
Closing this in favor of #12765. It seemed much easier to just make a new PR in this case. |
What is the purpose of this pull request? (put an "X" next to item)
[X] Changes an existing rule #12235
This PR adds
Array.prototype.flatMap
to the list of targeted methods inarray-callback-return
, but only whenecmaVersion
is set to2019
or higher, in order to minimize potential breaking change impact.This can produce more errors by default (for an ecmaVersion >= 2019 configuration only).
What changes did you make? (Give an overview)
Added
flatMap
to the pattern ifecmaVersion >= 10
.Also fixed two links in the documentation.
Is there anything you'd like reviewers to focus on?
Would be probably more correct to check enabled environments instead of the ecmaVersion, but that isn't possible at the moment as far as I know.
The diff looks big, most of it is just copy & paste to a different location.