Skip to content

feat(linter): update allowed ESLint config file extensions#30127

Merged
FrozenPandaz merged 2 commits intonrwl:masterfrom
TorinFrancis:eslint/typescript-config-support
Jun 9, 2025
Merged

feat(linter): update allowed ESLint config file extensions#30127
FrozenPandaz merged 2 commits intonrwl:masterfrom
TorinFrancis:eslint/typescript-config-support

Conversation

@TorinFrancis
Copy link
Copy Markdown
Contributor

@TorinFrancis TorinFrancis commented Feb 20, 2025

ESLint added experimental support for typescript config files since 9.9.0, and as of 9.18.0 that support is stable. This PR add ts/mts/cts to the list of known eslint config files, and adds the same extensions to config file generators

Current Behavior

When using the eslint executor with a ts file, returns error "When using the new Flat Config with ESLint, all configs must be named eslint.config.js or eslint.config.cjs and .eslintrc files may not be used. See https://eslint.org/docs/latest/use/configure/configuration-files"

When using the eslint plugin, the inferred task is not created for projects that do not have a non-ts eslint config.

Workarounds

  • Compiling ts rules/configs in a project. Introduces other issues
  • Using jiti or comparable
  • For plugin users, having a fake eslint.config.js at the root allows the inferred task to be created. ESLint will still use the ts config.
    • Cache targets are wrong
    • Complications in non-monorepo workspaces

Expected Behavior

When using the eslint executor with a ts file, no error is thrown.

When using the eslint plugin with a ts file, the inferred task is created.

Related Issue(s)

No issues, but addresses this discussion

@TorinFrancis TorinFrancis requested a review from a team as a code owner February 20, 2025 19:49
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 20, 2025

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

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jun 9, 2025 0:05am

@TorinFrancis TorinFrancis force-pushed the eslint/typescript-config-support branch 4 times, most recently from 2e4b2a2 to 0e5be8c Compare February 25, 2025 19:03
@TorinFrancis
Copy link
Copy Markdown
Contributor Author

Hey @leosvelperez is there anything I can do to help get this through? This is my first Nx PR so I'm sure I've missed some things

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Feb 28, 2025

View your CI Pipeline Execution ↗ for commit 3714097.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 29m 33s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 19s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 4s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 3s View ↗
nx documentation ✅ Succeeded 2m 40s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-09 12:26:40 UTC

@TorinFrancis TorinFrancis force-pushed the eslint/typescript-config-support branch from 0e5be8c to fe57273 Compare March 5, 2025 16:58
@TorinFrancis TorinFrancis force-pushed the eslint/typescript-config-support branch from fe57273 to 52bcd8c Compare March 17, 2025 17:00
@FrozenPandaz FrozenPandaz added the priority: medium Medium Priority (not high, not low priority) label May 14, 2025
@leosvelperez
Copy link
Copy Markdown
Member

@TorinFrancis thanks for taking the time to contribute! I'm sorry for the delay.

Please rebase your changes and make sure that all unit tests pass. The CI checks were previously failing.

@leosvelperez leosvelperez force-pushed the eslint/typescript-config-support branch from 52bcd8c to 3714097 Compare June 9, 2025 11:50
@leosvelperez leosvelperez requested review from a team as code owners June 9, 2025 11:50
@leosvelperez leosvelperez requested a review from FrozenPandaz June 9, 2025 11:50
@FrozenPandaz FrozenPandaz merged commit f1c090b into nrwl:master Jun 9, 2025
8 checks passed
FrozenPandaz added a commit that referenced this pull request Jun 9, 2025
@github-actions
Copy link
Copy Markdown
Contributor

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 Jun 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

priority: medium Medium Priority (not high, not low priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants