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(linter): allow ESLint Flat Config to be opted into manually #16858

Merged
merged 2 commits into from
May 8, 2023

Conversation

JamesHenry
Copy link
Collaborator

@JamesHenry JamesHenry commented May 8, 2023

Current Behavior

ESLint's new (not yet default) so called "Flat Config" cannot be used with Nx workspaces.

Expected Behavior

Users can manually opt into using ESLint's Flat Config style in their Nx workspaces prior to it being the official primary configuration style in ESLint v9 later in the year.

Appropriate migrations and generators will follow on from this once we get much closer to Flat Config being the primary default in ESLint.

https://eslint.org/docs/latest/use/configure/configuration-files-new

P.S. I also took the opportunity to clean up how ESLint is resolved and instantiated, it had become organically a bit messy over time

@vercel
Copy link

vercel bot commented May 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 0:43am

if (
useFlatConfig &&
eslintConfigPath &&
!eslintConfigPath?.endsWith('eslint.config.js')
Copy link
Contributor

@meeroslav meeroslav May 8, 2023

Choose a reason for hiding this comment

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

Nit: The optional chaining on line 27 is not needed, since we check for eslintConfigPath's existence on line before

@meeroslav meeroslav added the scope: linter Issues related to Eslint support in Nx label May 8, 2023
@JamesHenry JamesHenry marked this pull request as ready for review May 8, 2023 13:46
@JamesHenry JamesHenry requested a review from FrozenPandaz as a code owner May 8, 2023 13:46
@JamesHenry JamesHenry merged commit 7920fb6 into nrwl:master May 8, 2023
@JamesHenry JamesHenry deleted the eslint-flat-config branch May 8, 2023 14:56
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: linter Issues related to Eslint support in Nx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants