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

Reconfigure ESLint with flat config #577

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Conversation

Splines
Copy link
Member

@Splines Splines commented Jan 4, 2024

Background

The pipeline in #543 failed because of this warning:

0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override

since we have set the maximum number of allowed warnings to $0$.

There's a solution: the relatively new flag --no-warn-ignored (see my stack overflow answer here). Unfortunately, this flag is only available in the new ESLint flat configuration. Starting with v9, ESLint provides a new flat config format (eslint.config.js). Also see the configuration migration guide.

So, I just published a new version 2.0.0 for the eslint-plugin-erb adopting the new API. This PR therefore upgrades this plugin and also uses the new flat config.

Limitations

  • As the new ESLint flat configuration is feature-complete, but still new and in its alpha version, not all plugins support it yet. For example, the eslint-plugin-cypress doesn't support it at the moment. Therefore, I removed the cypress-related ESLint rules for the moment and will hopefully bring them back once the plugin is ready for the new configuration.
  • There might be severe bugs in ESLint as v9 is still an alpha right now. However, it worked like a charm for me locally. And if we find bugs as early testers, we can help the team figure them out ;)
  • Very unfortunately in my opinion, the --ignore-path was dropped with this PR. I totally agree to this comment and hope they will bring the feature back. For now, we have to live without it. If necessary, more folders will have to be added to the ignores section in the eslint.config.mjs configuration file. It will be a pain to keep this in sync with the .gitignore.

Reviewers

  • You have to run yarn install such that the new version of ESLint is installed.
  • Please make sure the VSCode integration still works

We sadly have to get rid of cypress for the moment.
See this answer: https://stackoverflow.com/a/77758970/9655481
for the background behind this change.
@Splines Splines self-assigned this Jan 4, 2024
@Splines Splines marked this pull request as ready for review January 4, 2024 19:36
@Splines Splines requested a review from fosterfarrell9 January 4, 2024 19:36
@Splines Splines merged commit 283a496 into mampf-next Jan 4, 2024
5 checks passed
@Splines Splines deleted the lint/flat-eslint-config branch January 4, 2024 21:44
@Splines Splines mentioned this pull request Jan 4, 2024
1 task
Splines added a commit that referenced this pull request Jan 6, 2024
* Upgrade ESLint configuration to new flat config

We sadly have to get rid of cypress for the moment.

* Run linter with `--no-warn-ignored` flag

See this answer: https://stackoverflow.com/a/77758970/9655481
for the background behind this change.

* Also lint the ESLint config file itself

* Get rid of `--ignore-path .gitignore`
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.

2 participants