Skip to content
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

Drop or change hard-coded ecmaVersion #215

Closed
brettz9 opened this issue Jul 23, 2024 · 7 comments
Closed

Drop or change hard-coded ecmaVersion #215

brettz9 opened this issue Jul 23, 2024 · 7 comments
Assignees

Comments

@brettz9
Copy link
Contributor

brettz9 commented Jul 23, 2024

I ran into some issues with the Cypress plugin hard-coding ES2019 to my files, not letting me use BigInt literals, for example.

I don't see any reason why Cypress has to have a particular ecmaVersion setting. The new default with ESLint is to use ecmaVersion: 'next'. If the purpose is to be more careful than the default, ensuring projects will err if they try to use too advanced of a feature for their browsers, one can use https://github.com/keithamus/eslint-plugin-escompat which, while it sets ecmaVersion to a recent version (now ES2023), detects the project's browser targets and provides linting errors if too recent of ES features are used.

@MikeMcC399
Copy link
Collaborator

@brettz9

Are you suggesting to drop ecmaVersion: 2019 setting for both legacy and flat configs?

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

const commonLanguageOptions = {
ecmaVersion: 2019,
sourceType: 'module'
}

You say you had some issues. Were you able to override the settings in your local ESlint config?

I would definitely be in favor of dropping some backwards-compatible settings and configurations at an appropriate time moving forward.

v3.0.0 was a breaking change due to dropping support for ESLint v3, v4, v5 & v6. Apart from that, backwards-compatibility has been maintained. Currently there are still far more downloads of the v2.x plugin compared to the v3.x plugin, so uptake is slow-moving!

@brettz9
Copy link
Contributor Author

brettz9 commented Jul 24, 2024

@brettz9

Are you suggesting to drop ecmaVersion: 2019 setting for both legacy and flat configs?

Yes.

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

const commonLanguageOptions = {
ecmaVersion: 2019,
sourceType: 'module'
}

You say you had some issues. Were you able to override the settings in your local ESlint config?

Yes.

I would definitely be in favor of dropping some backwards-compatible settings and configurations at an appropriate time moving forward.

v3.0.0 was a breaking change due to dropping support for ESLint v3, v4, v5 & v6. Apart from that, backwards-compatibility has been maintained. Currently there are still far more downloads of the v2.x plugin compared to the v3.x plugin, so uptake is slow-moving!

Yeah, removing it would probably not be backward-compatible, because for some it could be a higher ecmaVersion than their default. But setting it higher, e.g., to 2025 may work, but that would depend on their ESLint version supporting that as a value (and would require your periodically updating).

@MikeMcC399
Copy link
Collaborator

I would prefer to drop support for legacy configs completely and to move to the default ecmaVersion at some convenient stage so that the plugin is fully aligned with ESLint itself.

@MikeMcC399
Copy link
Collaborator

I'm going to suggest removing the commonLanguageOptions in the flat config of the next major release of the plugin. ESLint v8 reaches end-of-life on Oct 5, 2024 and that could be a trigger to provide a new release very soon.

I prefer not touching the legacy config though to avoid breaking existing setups, since there is no default for legacy. Users who need a higher version will probably already have an override in their configuration. Users who don't, might get surprised if this is updated. You could however argue either way - to keep or to update.

@MikeMcC399 MikeMcC399 self-assigned this Sep 25, 2024
@Jikodis
Copy link

Jikodis commented Oct 9, 2024

Adding cypressPlugin.configs.recommended to my existing flat config started throwing linting errors in my code since I use optional chaining. I agree with the decision to remove ecmaVersion in the flat config.

@MikeMcC399
Copy link
Collaborator

@MikeMcC399
Copy link
Collaborator

This issue is now resolved in [email protected] as far as flat configurations are concerned.

As described in the Flat Usage examples:

This version no longer specifies languageOptions for ecmaVersion and sourceType - see ESLint JavaScript languageOptions

Note that since ESLint v8 has reached end-of-life, it is no longer supported by eslint-plugin-cypress.

Deprecated legacy configuration

No change has been made to the deprecated legacy configuration parserOptions for backwards compatibility reasons, and this configuration is considered frozen. When a legacy configuration is used with ESLint 9.1 and above (ESLINT_USE_FLAT_CONFIG=false), ESLint outputs a warning similar to the following:

(node:25528) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details.
(Use node --trace-warnings ... to show where the warning was created)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants