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
Clarify policy on accepting support for new language features #9804
Comments
For the record, the appropriate time for everyone - browsers/implementations, babel, tooling like eslint - to implement proposals is at stage 3 (that's the intention of the staging process). The risk of syntax changes, specifically, in stage 3 is remarkably low, and is even lower after a browser has shipped an implementation (and the risk is not zero in stage 4, either). My suggestion is that stage 3 syntax proposals that are shipping in at least one browser (or node), should be considered stable enough to implement. Similarly, stage 3 API proposals that are shipping in at least one unflagged browser (to account for web compatibility risk) should be eligible for new rules, or modifications to existing rules, to support. This, imo, has the best combination of "support stage 3 proposals" without adding any significant risk of breakage. |
A few thoughts:
|
eslint can choose to add arbitrary acorn plugins to achieve stage 3 support, fwiw. |
Yes, but that requires us to implement them, and I don't think we have the manpower for that right now. |
I can quite guarantee you that if eslint officially promises to add the support if but a syntax plugin existed, a mob of people would build one quite rapidly, myself included :-) |
Acorn has moved to acornjs organization and it looks having official plugins for stage-3 syntaxes. Probably we can use those for parsing. If My thought seems similar to @ljharb.
|
Another alternative is supporting stage 3 proposals with a feature flag - then, if there’s a syntax or semantics change, a different feature flag could be used for the new behavior, and all the outdated ones could be removed in the next major (or, once it’s stage 4, all of them for that proposal would be removed in favor of the ecmaVersion). (I realize feature flags were intentionally removed, but it might make sense here) |
You could also say that semver guidelines don’t apply to experimental features — i.e. if a feature makes breaking changes, those changes will affect the next minor version of ESLint. Because the feature is opt-in and the syntax itself is subject to change, it would seem to make sense to be able to quickly adapt to changes. |
I would note that the "experimental" status of these language features usually doesn't seem to stop people from using them in production anyway. I suspect that a lot of our users would rather not have their build broken despite relying on experimental features. That said, having the semver guidelines not apply to experimental features would make things better, in my opinion. |
It seems like most of those plugins are released under the AGPL, so I don't think we would be able to use them unless the license is changed. |
Sounds good to me if we add "AST of experimental feature can be changed in minor" into our semver policy. I updated my comment #9804 (comment). I didn't realize the license matter. Maybe does it affect closed source web services which are using ESLint? |
I'm quite sure that if the sole barrier to adoption of any pre-stage-4 feature in eslint by default is the lack of a properly licensed acorn plugin, the appropriate call to action will summon one from the wider JS community :-) |
No one has yet mentioned why we (maybe me, initially) decided to limit our support to stage 4 features. Here is some of the rationale, for historical purposes:
The fundamental reason that we now don't support stage 3 features is because we don't know if they will end up in the next edition of ECMAScript or not. Since we are limited to the There have been requests in the past to create something like a "latest" setting for So the two real barriers to implementing stage 3 features right now are:
Our users rely on |
One difference is that now there's schema validation, and, the stage process means that in a given calendar year (between publications of an edition of the specification) there's a lot less churn then there used to be in stage 3 proposals. Some potential options:
These, paired with "proposal flags can break in a semver-minor", seems like it would address all the issues except "where do the flags go"? For that bikeshed, I'd suggest in parserOptions, |
@nzakas Thank you for the description. I thought that we can relax this policy because of few reasons:
|
I thought the purpose of this issue was just to document what we do and don't support, not to propose changing it?
This is exactly what I wanted to avoid. One of our guiding principles has been, for a while, that we don't want people to have to update their configs all that frequently. If we add an Again, we did all of this for ES6 features, it turned into a lot of confusion for everyone. I'd really rather not go through that again. As long as babel-eslint exists, I'm just not convinced that there's any pressing need to jump to implement stage 3 proposals. People who really need or want to use the latest stuff are already using Babel, so having them use babel-eslint isn't a huge leap. But again, I was under the impression that this issue was just to document the current approach to supporting ECMAScript versions and features. It seems like we should be focusing on that and if someone wants to propose a change, that should be a separate issue that lays out the use cases and requirements. |
Going back to discussion about clarifying the current policy: The conversation that started this issue is in #9613, about adding a null check to a rule to avoid a runtime crash after encountering a missing catch binding (currently a stage 3 proposal). I originally added it to the TSC agenda because it seems like we've been inconsistent about whether we accept this type of change. Previous cases that I can find (I might be missing some):
This seems inconsistent, and as a result I'm not sure what our official policy is. Ideally, we can clarify what type of changes we will accept so that there isn't any ambiguity in the future. |
@not-an-aardvark also, #7230 was not accepted (prefer object spread over |
I didn't include #7230 because object spread is a feature that we explicitly do support with the |
I'm sorry for I have gone too far. My thoughts on this issue are:
|
I agree with @mysticatea's last comment. We have a history of updating rules to avoid crashing on nonstandard and experimental AST nodes when they are well-defined and obvious. I'd say we can clarify our support by saying something like:
|
|
Would this policy only extend to crashes, or would we also fix false positives resulting from these language features? edit: In other words, are we committing to making the rules work correctly for experimental syntax, or are we just committing to having the rules not crash and allowing your linting build to continue (even if they report a bunch of incorrect errors)? |
My suggestion would be to accept fixes that stop rules from breaking (as in not being able to complete linting process on the file that uses Stage 3 features), but not the fixes that decrease/increase number of errors. Also, I would want to specify that this rule should only apply to any Stage 3 features that don't introduce new ESTree nodes (or rather, non-Stage 4 AST Nodes should not be used anywhere in the code). |
What about JSX and type annotations? They’re already referenced in the codebase. |
My understanding has been that we have full support for JSX, and treat it the same way as stage 4 features. However, I have the same question as @j-f1 about type annotations. Ideally, I think it would be nice if the policy allowed changes like #9027 (fixes a false positive when using type annotations), because the bug would otherwise have made the |
My assumption is that this policy only applies to ECMAScript features. Anything outside of the ECMA spec is treated differently on a case-by-case bases (which includes type annotations, JSX, JSDoc, etc.). |
Agree with @ilyavolodin. So how about this?
|
I would also like to propose adding an issue label like "experimental", which would allow us to review at a glance what proposals are or were for experimental features. I'm okay with bikeshedding on whether we should have a label just for rejected experimental change requests (which would allow us to easily find those if the syntax hits Stage 4 and reopen them, if we wanted); or if we should have a general "experimental" label and a further label to indicate a decision to reject an issue/PR, which combined with "experimental" shows why we closed the issue. Either way is fine by me. I just think we should be labeling those issues in some way. |
At last TSC meeting we said we will create an issue to discuss current policy on accepting support for new language features.
Our current approach is that we will only accept new ECMA features that reach Stage 4. There has been some exception to this rule in the past. We accepted Object Rest/Spread when it was at Stage 2, but it was put behind experimental prefix. We also accepted features that are not part of ECMA Script spec at all, like JSX, JSDoc, etc. While we haven't accepted any changes to support decorators, we have modified our rules to not fail when decorators are present.
There has been multiple PRs and issues in the past proposing support to new features that we've rejected, however, we have no clear policy that specify what we will accept and what we will not. I think this topic needs clarification so contributors don't waste their time coding support for new feature just to see their PR closed.
The text was updated successfully, but these errors were encountered: