question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow setting ecmaVersion to latest

See original GitHub issue

What version are you using? 3.9.1

Problem I want to solve I want to be able to always use the latest available ecmaVersion

Proposed solution Allow 'latest' as a config option for ecmaVersion, aliasing whatever the latest version the included acorn supports. Kinda like https://babeljs.io/docs/plugins/preset-latest/

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:33 (33 by maintainers)

github_iconTop GitHub Comments

4reactions
sindresorhuscommented, Nov 5, 2016

@ilyavolodin I always want the latest syntax. Browsers have versionless JS. I don’t see why ESLint shouldn’t at least have the ability to opt into such. IMHO latest should have been the default.

This seems like a micro-optimization that requires a lot of thought and effort to solve the issue that takes less than 1 second to fix by hands.

Micro-optimization to you, better UX for many others. Easiest solution would just be to hard-code a list of supported ECMAScript versions. It only needs updating once a year and then you’re in control of what latest means for ESLint.

1 second * ESLint users * configs, adds up.

2reactions
kaicataldocommented, Nov 8, 2016

I’m still very much against tying this to Espree’s release cycle, even with a disclaimer, for a few reasons:

  • I feel like just having this option encourages users to use it. It sounds very appealing to set the version once and never have to worry about it again. However, there is always a delay between when Espree lands a new ecmaVersion and when ESLint fully supports the new features, because rules need to be updated for the new syntax. This means that there’s a very high probability that ESLint is broken for those users for that duration. Example: see the following changes that had to be made to ensure async/await worked for all of ESLint’s core rules. You could argue that the user doesn’t have to use the new features - but then what’s the point of the option? I’m not a fan of knowingly giving users an option that has a high probability of breaking their build.
  • Tying latest to Espree’s release cycle means that two users (or even two builds by the same person) running the same version of ESLint could potentially have been linted with the parser set to two different ecmaVersions. How can one have confidence in a quality assurance check if it’s not deterministic?

The “eslint:all” configuration is different because it only changes on new releases of ESLint. To be clear: I’m not against the inclusion of this option, but I do think it should be tied to ESLint’s release cycle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Options - ESLint - Pluggable JavaScript Linter
ESLint lets you configure language options specific to the JavaScript used in ... 2016 globals and automatically sets the ecmaVersion parser option to...
Read more >
Specifying Environments in ESLint Configurations [duplicate]
An environment provides predefined global variables. The available environments are: es6 - enable all ECMAScript 6 features except for modules ( ...
Read more >
acorn - npm
Defaults to true for ecmaVersion 2022 and later, false for lower versions. Setting this option to true allows to have top-level await ...
Read more >
JSHint Options Reference
This option allows you to force all variable names to use either ... The option cannot be maintained without automatically opting users in...
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript linter
ESLint allows you to specify the JavaScript language options you want to ... ecmaVersion - set to 3, 5 (default), 6, 7, or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found