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

feat: add flat configurations #212

Merged
merged 1 commit into from
May 29, 2024

Conversation

MikeMcC399
Copy link
Collaborator

Issue

eslint-plugin-cypress@3.2.0 added support for the use of Flat config files with ESLint 8.57.0 and above through the compatibility utility @eslint/eslintrc.

To fully support Flat config files the plugin needs to provide corresponding configurations which do not rely on any compatibility utility.

Goals

  • Offer configurations directly usable in the ESLint v9 Configuration Files default flat config format (eslint.config.*.js). The new configurations should be based on the existing .eslintrc.* configurations.
  • Remove the dependency on the @eslint/eslintrc utility, also referred to as the Backwards compatibility utility
  • Continue to offer configurations for the Configuration Files (Deprecated) format (.eslintrc.*)
  • Prepare for removal of deprecated configurations with minimal impact for users and for plugin maintenance

Changes

  • The set of flat configs is made available through eslint-plugin-cypress/flat:
Configuration Content
configs.globals defines globals cy, Cypress, expect, assert and chai used in Cypress test specs as well as globals.browser and globals.mocha from globals. Additionally, languageOptions of ecmaVersion: 2019 and sourceType: 'module' for backwards compatibility with earlier versions of this plugin are defined. There are no default rules enabled in this configuration.
configs.recommended enables recommended Rules. It includes also configs.global (see above)
  • Documentation is updated accordingly

@cypress-app-bot
Copy link

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented May 16, 2024

Documentation Preview

@MikeMcC399 MikeMcC399 mentioned this pull request May 16, 2024
@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented May 17, 2024

@jennifer-shehane

  • This PR is already feature-complete.

  • There is however an outstanding related PR feat: add eslint api v9 compatibility ihordiachenko/eslint-plugin-chai-friendly#33. If this gets merged, then it would simplify the example using eslint-plugin-chai-friendly, so I'm currently holding the PR back and leaving it in draft status.

  • There is still a lot of ballast in the repo concerning older versions which could be cleaned up in a future major release. This is however not such an urgent issue. The ESLint team still have work to do hoisting some of their own utilities into full ESLint v9 support.

@jennifer-shehane
Copy link
Member

@MikeMcC399 Is this ready for review? It is still marked as draft.

@MikeMcC399
Copy link
Collaborator Author

@jennifer-shehane

Is this ready for review? It is still marked as draft.

I just realized that the import statements in the documentation are inconsistent, so I wanted to go back and rework to avoid that confusion. Unfortunately there is no consistency in the ESLint ecosystem about this.

@MikeMcC399
Copy link
Collaborator Author

The commits are squashed and the PR is ready for review.

@MikeMcC399 MikeMcC399 marked this pull request as ready for review May 24, 2024 05:17
convert globals test to use legacy config
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to hit the approve button on this one

@jennifer-shehane jennifer-shehane merged commit 0e835e9 into cypress-io:master May 29, 2024
7 checks passed
@cypress-app-bot
Copy link

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MikeMcC399 MikeMcC399 deleted the add/flat-config branch May 29, 2024 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to new ESLint Flat configuration files
3 participants