cypress-io / eslint-plugin-cypress

An ESLint plugin for projects that use Cypress
MIT License
701 stars 89 forks source link

Drop or change hard-coded `ecmaVersion` #215

Open brettz9 opened 1 month ago

brettz9 commented 1 month ago

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 commented 1 month ago

@brettz9

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

https://github.com/cypress-io/eslint-plugin-cypress/blob/0e835e938987519240a3a1581b4bc483583bb9be/legacy.js#L27-L30

https://github.com/cypress-io/eslint-plugin-cypress/blob/0e835e938987519240a3a1581b4bc483583bb9be/lib/flat.js#L29-L32

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 commented 1 month ago

@brettz9

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

Yes.

https://github.com/cypress-io/eslint-plugin-cypress/blob/0e835e938987519240a3a1581b4bc483583bb9be/legacy.js#L27-L30

https://github.com/cypress-io/eslint-plugin-cypress/blob/0e835e938987519240a3a1581b4bc483583bb9be/lib/flat.js#L29-L32

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 commented 1 month ago

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.