Skip to content

fix(gradle): exclude non-JS gradle sub-projects from eslint plugin#34735

Merged
leosvelperez merged 3 commits intomasterfrom
nxc-4001
Mar 9, 2026
Merged

fix(gradle): exclude non-JS gradle sub-projects from eslint plugin#34735
leosvelperez merged 3 commits intomasterfrom
nxc-4001

Conversation

@leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Mar 6, 2026

Current Behavior

The @nx/eslint/plugin infers a lint target for gradle-project-graph because it contains a single .ts file (publish-maven.ts), even though it's a Kotlin/Gradle project. Similarly, the parent gradle project's eslint . 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 parent gradle project's lint should not scan into those directories.

Changes

  • Add project-graph and batch-runner to ESLint ignorePatterns in packages/gradle/.eslintrc.json

@netlify
Copy link

netlify bot commented Mar 6, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit dd5a5e7
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69ae9d9b1937bb000890d387
😎 Deploy Preview https://deploy-preview-34735--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Mar 6, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit dd5a5e7
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69ae9d9b33d64300083bac92
😎 Deploy Preview https://deploy-preview-34735--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Mar 6, 2026

View your CI Pipeline Execution ↗ for commit dd5a5e7

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 13m 3s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 23s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-09 10:32:08 UTC

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

✅ 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.

Revert fix via Nx Cloud  

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/**/*",
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

leosvelperez and others added 3 commits March 9, 2026 11:14
Co-authored-by: leosvelperez <leosvelperez@users.noreply.github.com>
eslintrc ignorePatterns already prevents lint target inference for non-JS sub-projects
@leosvelperez leosvelperez enabled auto-merge (squash) March 9, 2026 10:21
@leosvelperez leosvelperez merged commit 92335c4 into master Mar 9, 2026
25 checks passed
@leosvelperez leosvelperez deleted the nxc-4001 branch March 9, 2026 10:32
@github-actions
Copy link
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 Mar 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants