fix(gradle): exclude non-JS gradle sub-projects from eslint plugin#34735
fix(gradle): exclude non-JS gradle sub-projects from eslint plugin#34735leosvelperez merged 3 commits intomasterfrom
Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit dd5a5e7
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
✅ The fix from Nx Cloud was applied automatically
These changes fix the ESLint configuration error by restoring node_modules to the ignorePatterns array. The original PR inadvertently removed node_modules, which caused ESLint to scan into packages/gradle/node_modules/@nx/devkit/ and encounter a broken configuration reference. Adding node_modules back prevents ESLint from scanning dependency directories while preserving the intended exclusions for project-graph and batch-runner.
Tip
✅ We verified this fix by re-running gradle:lint.
Suggested Fix changes
diff --git a/packages/gradle/.eslintrc.json b/packages/gradle/.eslintrc.json
index 5346c203bb..31c2f712c7 100644
--- a/packages/gradle/.eslintrc.json
+++ b/packages/gradle/.eslintrc.json
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
- "ignorePatterns": ["!**/*", "project-graph", "batch-runner"],
+ "ignorePatterns": ["!**/*", "node_modules", "project-graph", "batch-runner"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
View interactive diff ↗🎓 Learn more about Self-Healing CI on nx.dev
nx.json
Outdated
| "exclude": ["packages/**/__fixtures__/**/*"], | ||
| "exclude": [ | ||
| "packages/**/__fixtures__/**/*", | ||
| "packages/gradle/project-graph/**/*", |
There was a problem hiding this comment.
We do not need these exclusions because we've eslintignored the typescript files in there right? So there's no target even without these exclusions.. seems to work on my machine.
There was a problem hiding this comment.
It's not "needed", but the goal was to save some processing. This eliminates some project roots from processing (they are still matched by the plugin glob and discarded when the plugin checks they don't have non-ignored lintable files), but it shouldn't make too big a difference, so we can simplify the config. I removed them.
Co-authored-by: leosvelperez <leosvelperez@users.noreply.github.com>
eslintrc ignorePatterns already prevents lint target inference for non-JS sub-projects
|
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. |
Current Behavior
The
@nx/eslint/plugininfers alinttarget forgradle-project-graphbecause it contains a single.tsfile (publish-maven.ts), even though it's a Kotlin/Gradle project. Similarly, the parentgradleproject'seslint .scans into non-JS sub-project directories unnecessarily.Expected Behavior
Non-JS Gradle sub-projects (
project-graph,batch-runner) should not have lint targets inferred by the ESLint plugin, and the parentgradleproject's lint should not scan into those directories.Changes
project-graphandbatch-runnerto ESLintignorePatternsinpackages/gradle/.eslintrc.json