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

test: update eslint config to flat on eslint v8 #836

Merged

Conversation

MikeMcC399
Copy link
Collaborator

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

  1. Install latest plugin versions
  2. Install @eslint/eslintrc for Backwards compatibility utility
  3. Replace the config file .eslintrc using eslint.config.mjs according 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

Verification

npm ci
npm run lint

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399 MikeMcC399 marked this pull request as ready for review May 6, 2024 10:30
@jennifer-shehane jennifer-shehane merged commit 3181d68 into cypress-io:master May 6, 2024
12 checks passed
@MikeMcC399 MikeMcC399 deleted the update/eslint-flat-v8 branch May 6, 2024 14:48
@cypress-app-bot
Copy link
Collaborator

🎉 This PR is included in version 2.0.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants