Every single ECMAScript edition should have an "env" option
See original GitHub issuees7/es2016 adds no new globals - that means that there’s no “env” option for it.
This is confusing, because users don’t know these details, and don’t want to have to think about it - a user should be able to set their ecmaVersion
and env
to, say, “es2016” or “es2017” and have eslint do the Right Thing™.
If there are no new globals in a year, then great - es2016’s globals are the same as es2015’s - but that’s not something the user writing the eslint config should have to care about.
(opening a new issue per https://github.com/eslint/eslint/issues/8453#issuecomment-322266500)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:42 (25 by maintainers)
Top Results From Across the Web
Language Options - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Specifying Environments in ESLint Configurations [duplicate]
This question already has an answer here: The available environments are: es6 - enable all ECMAScript 6 features except for modules (this ...
Read more >babel/preset-env
babel/preset-env` is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, ...
Read more >Managing Front-end JavaScript Environment Variables
env files to source control and make those available on your hosted environment, you do not need to prefix any of your environment...
Read more >ECMAScript® 2019 Language Specification
It is the tenth edition of the ECMAScript Language Specification. ... Each module explicitly identifies declarations it uses that need to be provided...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, let’s please reopen this. It’s very confusing to have a discontinuous set of editions.
@skylize for the record, I’m the original original OP 😄
Having followed the discussion for a while, I think a middle ground can be reached.
I agree with @not-an-aardvark that having the two decoupled can be extremely valuable to certain users. I also agree with @skylize that for most users, they just want to set the one thing and be done with it (i.e., they don’t distinguish between using say es2018 globals and es6 syntax - usually because they have something like babel transpiring the syntax anyways).
I propose a middle ground solution:
I think part of the problem is that today,
env
is confusing. As @ilyavolodin notes above,env
should control the entire environment. So, let’s make that clear:env
should be the single, well-document, Just WorksTM option that the average Joe/Mary user setsenv
to say,es2018
should allow both es2018 globals and es2018 syntaxparserOptions
should remain as is. Setting this value tellseslint
to allow the syntax for that version, but says nothing about allowing globals from that versionglobals
, should be added. This will telleslint
to recognize the globals from a particular versionparserOptions
andglobals
will causeenv
to be ignoredparserOptions
orglobals
will cause the default for the other to be usedglobals
toes2018
, but not settingparserOptions
, will allow es2018 globals, but syntax will still be at es6parserOptions
toes2018
, but not settingglobals
, will allow es2018 syntax, will allow es2018 syntax, but globals will still be restricted to es6I think this allows both the flexibility for power users that @not-an-aardvark desires, and the simplicity for average users that @skylize desires.
This does break the way
env
works in a big way, and it could be a bit painful in terms of reading docs (though no code other than configs should have to be changed) for users to upgrade to the new version. But I think the long-term durability and stability works for most stakeholders.