cypress-example-kitchensink
cypress-example-kitchensink copied to clipboard
test: update eslint config to flat on eslint v8
Issue
The ESLint configuration file .eslintrc, used with ESLint v8, is deprecated in ESLint v9 (see ESLint 8.x configuration files).
ESLint v9 was released on Apr 5, 2024 and the announcement stated that "Flat config" is now the default.
This repo currently uses the following plugins. The table also shows if they offer flat config options:
| Plugin | version | flat config option |
|---|---|---|
| @stylistic/eslint-plugin-js | 1.7.2 |
available |
| eslint | 8.57.0 |
pluginJs.configs.recommended |
| eslint-plugin-cypress | 3.1.1 |
not available |
| eslint-plugin-jsonc | 2.15.1 |
...eslintPluginJsonc.configs['flat/recommended-with-json'] |
| eslint-plugin-mocha | 10.4.3 |
mochaPlugin.configs.flat.recommended |
eslint-plugin-cypress in the current 3.1.1 release offers no out-of-the-box flat config option.
Changes
- Install latest plugin versions
- Install @eslint/eslintrc for Backwards compatibility utility
- Replace the config file .eslintrc using
eslint.config.mjsaccording to the documentation ESLint 8.x configuration files (new) and the documentation of each plugin.
eslint-plugin-cypress
Integrate the eslint-plugin-cypress plugin using the ESLint Backwards compatibility utility: using the FlatCompat class from the npm module @eslint/eslintrc as an interim solution.
Migration to ESLint v9
The next planned step will be the migration to ESLint v9 after eslint-plugin-cypress has released a version compatible with ESLint v9.
References
- ESLint 8.x configuration files
- ESLint 8.x configuration files (new)
- ESLint > Backwards compatibility utility
Verification
npm ci
npm run lint
- Create a Draft Pull Request if your PR is not ready for review. Mark the PR as Ready for Review when you're ready for a Cypress team member to review the PR.
:tada: This PR is included in version 2.0.7 :tada:
The release is available on:
Your semantic-release bot :package::rocket: