import-js/eslint-plugin-import

ecmaVersion in recommended config is outdated

ClementValot opened this issue ยท 6 comments

Config import/recommended has a hardcoded parserOptions.ecmaVersion of 2018

This has the side effect of not being able to parse my eslint.config.mjs which uses nullish coalescing (Unless I override with languageOptions.ecmaVersion = latest )

Is there a technical reason for not setting it to latest (which is currently the ESLint default)?

Good question. When i was doing the flat config work, i was aiming for parity with the original configs, just with the new config structure. And the legacy configs had it defined that way.

parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
},

I can't think of a reason why that shouldn't be 'latest', though.

Changing it would be a breaking change, unfortunately.

I don't know nearly enough about this to understand why, are there features that are enabled with 2018 and wouldn't be with latest?

Because the inability of eslint to tolerate newer syntax is also a feature, and code could accidentally use syntax that isn't actually supported in their target environments if the ecmaVersion is bumped.

Changing it would be a breaking change, unfortunately.

This got me thinking, would there be value in having a checklist of things that we'd like to include whenever there is a need for a new major? I feel like there's been several of these kinds of small items that would be nice to have, but are breaking. Just a thought.

I have various lists tracking them; including a local branch.