fix(repo): remove redundant inputs override for build-base target#34649
Conversation
The build-base target had a manual inputs override of ["production", "^production"] which shadows the more accurate inputs inferred by the @nx/js/typescript plugin.
✅ 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 3d22f1e
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
✅ The fix from Nx Cloud was applied
These changes fix the lint failures by adding missing dependencies to the ignoredDependencies lists in the ESLint configurations. When we removed the manual inputs override for build-base in nx.json, the @nx/js/typescript plugin began inferring inputs differently, causing the @nx/dependency-checks rule to exclude certain files (particularly .js files) from its analysis and incorrectly flag legitimately-used dependencies as unused.
Tip
✅ We verified this fix by re-running angular-rspack-compiler:lint, angular:lint, nx:lint.
Suggested Fix changes
diff --git a/packages/angular-rspack-compiler/.eslintrc.json b/packages/angular-rspack-compiler/.eslintrc.json
index eab5cc4b4f..f783908f7c 100644
--- a/packages/angular-rspack-compiler/.eslintrc.json
+++ b/packages/angular-rspack-compiler/.eslintrc.json
@@ -45,6 +45,7 @@
"ignoredDependencies": [
"@angular/core",
"jsonc-eslint-parser",
+ "semver",
"vitest",
"memfs"
]
diff --git a/packages/angular/.eslintrc.json b/packages/angular/.eslintrc.json
index dde9a874c8..f71c7a4d04 100644
--- a/packages/angular/.eslintrc.json
+++ b/packages/angular/.eslintrc.json
@@ -52,6 +52,7 @@
"buildTargets": ["build-base"],
"ignoredDependencies": [
"@angular-devkit/architect",
+ "@angular-devkit/core",
"@angular-devkit/schematics",
"@nx/cypress",
"@nx/jest",
diff --git a/packages/nx/.eslintrc.json b/packages/nx/.eslintrc.json
index 44650fb785..8e12df20ef 100644
--- a/packages/nx/.eslintrc.json
+++ b/packages/nx/.eslintrc.json
@@ -145,7 +145,9 @@
// Nx Docker plugin conditionally available dynamically at runtime
"@nx/docker",
// Only used in test-utils at the time of writing
- "@ltd/j-toml"
+ "@ltd/j-toml",
+ // Used in WASI browser implementation (nx.wasi-browser.js)
+ "@napi-rs/wasm-runtime"
]
}
]
🔔 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
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
…4649) ## Current Behavior The `build-base` target in `nx.json` has a manual `inputs` override of `["production", "^production"]` which shadows the more accurate inputs inferred by the `@nx/js/typescript` plugin. ## Expected Behavior Let the `@nx/js/typescript` plugin infer the correct inputs for `build-base` tasks, providing more accurate cache invalidation based on the actual tsconfig project references. ## Lint Rule Changes Removing the broad `inputs` override causes the `@nx/dependency-checks` lint rule to flag a few dependencies as "unused" across three packages. This happens because the rule uses the build target's inputs to determine which files to scan for imports, and the narrower tsc-inferred inputs don't cover certain files: - **`packages/nx`**: `@napi-rs/wasm-runtime` — used in `nx.wasi-browser.js`, a `.js` file outside tsconfig scope - **`packages/angular`**: `@angular-devkit/core` — only referenced as a string (for `ensurePackage()`, migrations config) and is a `peerDependency`, not directly imported at runtime - **`packages/angular-rspack-compiler`**: `semver` — used in `patch/patch-angular-build.js`, a `.js` patch file outside tsconfig scope These are all legitimate dependencies. Adding the `.js` files to tsconfig would require `allowJs` and pull non-TS scripts into the build pipeline unnecessarily. Adding them to `ignoredDependencies` in each package's `.eslintrc.json` is the correct fix. --------- Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com> Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com> (cherry picked from commit f48bf31)
|
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
build-basetarget innx.jsonhas a manualinputsoverride of["production", "^production"]which shadows the more accurate inputs inferred by the@nx/js/typescriptplugin.Expected Behavior
Let the
@nx/js/typescriptplugin infer the correct inputs forbuild-basetasks, providing more accurate cache invalidation based on the actual tsconfig project references.Lint Rule Changes
Removing the broad
inputsoverride causes the@nx/dependency-checkslint rule to flag a few dependencies as "unused" across three packages. This happens because the rule uses the build target's inputs to determine which files to scan for imports, and the narrower tsc-inferred inputs don't cover certain files:packages/nx:@napi-rs/wasm-runtime— used innx.wasi-browser.js, a.jsfile outside tsconfig scopepackages/angular:@angular-devkit/core— only referenced as a string (forensurePackage(), migrations config) and is apeerDependency, not directly imported at runtimepackages/angular-rspack-compiler:semver— used inpatch/patch-angular-build.js, a.jspatch file outside tsconfig scopeThese are all legitimate dependencies. Adding the
.jsfiles to tsconfig would requireallowJsand pull non-TS scripts into the build pipeline unnecessarily. Adding them toignoredDependenciesin each package's.eslintrc.jsonis the correct fix.