Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

luc122c
Copy link
Contributor

@luc122c luc122c commented Mar 30, 2024

๐Ÿ”— Linked issue

Resolves #25351

๐Ÿ“š Description

As discussed in #25351, eslint are upgrading their config system in eslint v9. The new syntax is available now but is opt-in. We can opt in by replacing .eslintrc with a eslint.config.js file or setting the environment variable ESLINT_USE_FLAT_CONFIG=true before running eslint.

I have followed eslint's configuration migration guide to replace the configuration. This PR is intended to be a straight swap, not modifying the configuration in any way, just upgrading the syntax. There may be additional work needed to take advantage of the benefits the new syntax brings.

๐Ÿงช How to test

  1. Pull the branch
  2. Install dependencies
  3. Run ESLINT_USE_FLAT_CONFIG=true pnpm run lint

โฌ‡๏ธ Dependencies

Nuxt depends on several configs and plugins. Below is the status of flat config support for each dependency. (Data sourced from tracker)

Name Support Issue/PR
jsdoc โœ… gajus/eslint-plugin-jsdoc#1177
import ? import-js/eslint-plugin-import#2714
unicorn โœ… sindresorhus/eslint-plugin-unicorn#1886
no-only-tests ?
@nuxt/eslint-config ๐Ÿšง https://github.com/nuxt/eslint/releases/tag/v0.3.0-beta.7
eslint-config-standard ๐Ÿ“ฆ ๐Ÿ›‘ standard/eslint-config-standard#351

โš ๏ธ Issues

Current issues:

  • Standard needs to release a new package
  • @nuxt/eslint-config is still in beta

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@luc122c
Copy link
Contributor Author

luc122c commented Mar 30, 2024

@antfu Do you have any guidance for getting the @nuxt/eslint-config working ๐Ÿ™

@antfu
Copy link
Member

antfu commented Mar 30, 2024

For @nuxt/eslint-config you will need the v0.3.0-beta.7 version

Copy link

socket-security bot commented Mar 30, 2024

New and removed dependencies detected. Learn more about Socket for GitHub โ†—๏ธŽ

Package New capabilities Transitives Size Publisher
npm/@eslint/[email protected] filesystem, unsafe Transitive: environment, eval +17 2.58 MB eslintbot
npm/[email protected] Transitive: filesystem, unsafe +5 525 kB hirokiosame
npm/[email protected] Transitive: filesystem, unsafe +19 1.96 MB voxpelli
npm/[email protected] filesystem, unsafe Transitive: environment, eval +74 6.13 MB ljharb
npm/[email protected] filesystem Transitive: environment, unsafe +11 3.68 MB gajus
npm/[email protected] None 0 9.54 kB levibuzolic
npm/[email protected] environment, filesystem Transitive: eval, shell, unsafe +56 9.17 MB eslintbot
npm/[email protected] Transitive: environment, filesystem, unsafe +2 264 kB danielroe
npm/[email protected] None +4 427 kB evilebottnawi
npm/[email protected] environment, filesystem, shell Transitive: unsafe +27 1.55 MB piotr-oles
npm/[email protected] Transitive: environment, filesystem +2 107 kB ryanzim
npm/[email protected] environment 0 24.6 kB pi0
npm/[email protected] Transitive: filesystem +13 393 kB sindresorhus
npm/[email protected] None +2 691 kB pi0
npm/[email protected] network, shell, unsafe +1 8.65 MB davidortner
npm/[email protected] None 0 8.13 kB bevacqua
npm/[email protected] None 0 39.9 kB pi0
npm/[email protected] None 0 37.3 kB pi0
npm/[email protected] None +1 495 kB antfu
npm/[email protected] Transitive: environment, filesystem, shell +20 4.96 MB davidanson
npm/[email protected] None 0 878 kB streamich
npm/[email protected] unsafe 0 119 kB evilebottnawi
npm/[email protected] None 0 180 kB pi0

๐Ÿšฎ Removed packages: npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full reportโ†—๏ธŽ

@antfu antfu changed the title feat(nuxt): Convert eslint config to v9 syntax build(nuxt): migrate to ESLint flat config Apr 3, 2024
@antfu antfu marked this pull request as ready for review April 3, 2024 11:48
Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

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

LGTM, I think this could be a good starting point. I will refactor them out and move some rules into @nuxt/eslint-config in future PRs.

@luc122c
Copy link
Contributor Author

luc122c commented Apr 3, 2024

Thanks for sorting @antfu ๐Ÿ˜ƒ Much appreciated.

@danielroe danielroe changed the title build(nuxt): migrate to ESLint flat config chore: migrate to ESLint flat config Apr 3, 2024
luc122c and others added 2 commits April 3, 2024 21:10
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 ESLint config to v9 config system
4 participants