-
Notifications
You must be signed in to change notification settings - Fork 30k
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
tools: enable all es6 rules in linter #5052
Conversation
This change enables the es6 environment in eslint. Rather than selecting es6 rules one at a time, this turns all of them on with the exception of modules. Ref: nodejs#5028
LGTM pending CI. This can probably be safely backported to LTS. It just enables parsing of the language features. Of course, we should verify it in CI first. |
Turns out this is roughly equivalent to #5028 so it should be all good. Let's give CI a whirl... |
Yeah I'm all for it as well; LGTM after CI turns green. |
Also, adding |
Unrelated failure with known-ish flaky test in CI that might be fixed if #4772 lands. But I like my CI's green, so I'm going to run it again: |
The question about LTS suitability goes more to just this being able to be used on LTS, it's about what this enables on master that can't be done on LTS and therefore makes cherry-picking more difficult because it widens the gap between the branches. I'm also wondering what this enables in core that our current config disallows? And, whether we actually want to accept usage of those features. I'd personally prefer to take a more strategic approach to adopting language features that's based on an understanding of performance and an assessment of how it might impact on the readability of our codebase. Already we have a really awkward state of flux, particularly around the transition from Our policy on evolutionary change of the codebase is also to blame for this current state of flux but there are good justifications for that. So, pending hearing about what this enables that isn't already enabled by the current ruleset, I'm -0 on this. I'd also like this to hold off until @jasnell and @thealphanerd have a chance to weigh in on the question of the impact this is going to have on the difficulty of maintaining LTS. |
@rvagg is your only objection toward LTS, or against this change in master? It would, most likely, be simple to get away with not backporting this to LTS, as we shouldn't be introducing any new language features. On master, I think this is a worthwhile change. ESLint is moving away from enabling specific language features. Once ESLint 2.0.0 is released, you are expected to enable a language version, not specific features. EDIT: Another thing to consider is whether ESLint updates will be backported. If so, the existing config will need to change anyway. |
It's not so much about pulling this one change back. The key challenge is
|
@jasnell sorry, I was referring only to this PR. It doesn't introduce anything into the actual source code. It just makes ESLint more pleasant to deal with. People are certainly going to want these features enabled to experiment with new features in core (the original reason for #5028), even if they don't land. And, as I mentioned in the edit to my previous comment, ESLint is ditching |
@thefourtheye You might want to re-open your PR and scale it back to just enabling the spread operator or whatever it was originally opened for. This one looks like it might get hung up for a while or not happen at all. A narrow conversation around the single feature you were originally trying to enable might go faster. |
One thing to note is that, just like we can turn individual features on, we can also turn them off. I hesitate to endorse a deny-list approach over an allow-list approach in any context, there might be some value in making |
@Trott I would prefer to wait till we reach a consensus before re-opening that PR :-) If at all possible, we ll do it in this PR's way. |
@rvagg asked:
Here are the features that this PR enables that we do not currently have enabled. Reminder that we can turn any of them off individually if we wish.
I opened this PR because that list is almost identical to the list that was proposed for being added/enabled in #5028. The only difference is this adds |
@thefourtheye That works too. If there's a need or desire for just the spread operator, though, that conversation might go faster. And there's no reason that other PR can't go through with just the spread operator, and then this one comes along at a later date. But if you'd rather wait and see what happens here, that's fine by me too. |
Thanks for the list @Trott, perfect. So there are two issues here, not necessarily blockers mind you:
So far the track record has been pretty positive I think on adopting features. We've been careful and measured about it, conscious of performance and diff noise. So enthusiasts of new language features ought not to be pessimistic in light of item 2 above. What I'm arguing for here is more of a gating process. If you want to use a new feature, like spread, then we should have a discussion about spread and bring to bear all of the concerns I've listed above. Perhaps spread has terrible performance and should be generally avoided? Perhaps the feature is not on LTS, we should involve LTS folks so they can think through what might happen if said feature started replacing large amounts of code over a short period of time, like Lastly, there's also a question of style. Consider the recent discussion about arrow-function style, it's not just about enabling a feature but often about the particular style for how you use that feature. If we go ahead and enable a feature then we should apply a consistent style instead of letting different style variants be used and then later have clean-up commits (like we had with single-arg arrow-functions). That discussion can be had when we consider the individual feature. My preference. So a soft -1 from me, i.e. happy to be overruled here if nobody agrees and I'm the only -1. |
Enabling ESLint to not choke on a language feature is not a green light to use it in core. I agree that we still need to gate things. That is what the PR process is for. This doesn't introduce code into core just allows the tooling to be more flexible moving forward. My second point is about ESLint itself. In the past we have cherry-picked ESLint updates back to at least v4.x. When/if that happens with the upcoming ESLint 2.0, we will have to do something similar to this anyway. |
That brings up the question, is performance the only criteria to decide if a feature should be allowed in core? |
@rvagg Thanks for articulating the concerns in a clear and detailed fashion. Happy to say that nothing in there is surprising. Especially if @jasnell, @thealphanerd, or someone else has LTS concerns about this, I'm happy to go with their judgment. I do want to reiterate @cjihrig's point, though, that this is not supposed to be a green light to start using all of these features. Nonetheless, I can also see how it will be difficult to prevent people from interpreting it that way. And you can certainly make the argument that it is unfriendly to new contributors for the linter to be more lax than what we actually want people to submit. I'm actually +1 on opening separate PRs for each ES6 feature that people want to start using and having separate discussions for each one. I only opened this because #5028 was going to do nearly exactly the same thing as this PR and it had amassed several Obligatory irony note: If I had not opened this PR, all these features would probably be enabled already (because #5028 probably would have sailed through--it already had 5 |
This seems like a bad idea, we should make sure this is off. |
@thefourtheye What do you think of going back and having the spread discussion in #5028? This is stalling out and I'd like to close it unless someone wishes to vigorously champion it? …sideways glance at @cjihrig… |
@cjihrig my response to:
Was actually answered in an illustrative way by @Trott:
Due to the speed of dev around here I'm pretty sure none of us is reviewing 100% of the changes going in to core. Each change has an isolated group of people reviewing it, mostly a group who have rough interest in the area of concern. So my argument here is for the gating process to be more along the lines of: "doh! the linter is complaining at me, Node really should allow me to use |
My thinking is along the lines outlined by @rvagg. Having the discussion and enabling them one by one is probably the best way to ensure the right discussion/review occurs. |
At this point I'm -1 to enabling this. I'd rather see each rule enabled one at a time as needed. |
Sounds like this can be closed and, if necessary, the spread operator can be discussed in #5028 or elsewhere. |
This change enables the es6 environment in eslint. Rather than selecting
es6 rules one at a time, this turns all of them on with the exception of
modules.
Ref: #5028
Not sure if this will be controversial or not. And not sure if it makes sense
to land on LTS or not. (Maybe we shouldn't use es6-isms not supported by
LTS? Certainly not for code that needs to land on LTS, of course. But I'm not
sure a lot of these rules will actually cover things that don't work in LTS but work
in Stable. Will have to look into that...)