fix(linter): infer lint tasks with inputs using {workspaceRoot}
to support nested projects
#31488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Behavior
When running the
lint
task on a project that contains nested projects, the task runs over all the files, including the ones inside the nested projects, but the task cache status is not affected by changes to the files in nested projects. This only happens when the inputs are defined with{projectRoot}/...
(what the@nx/eslint/plugin
infers). The{projectRoot}
token scopes the files inside the project without files in other nested projects. While the{workspaceRoot}
token would include every file and wouldn't scope them to any particular project.Expected Behavior
The
@nx/eslint/plugin
should inferlint
tasks with their inputs using the{workspaceRoot}
token to support nested projects. This would be more aligned with what the tool itself does, which runs over all the files inside the project root regardless of them being inside nested Nx projects.Additionally, the difference in behavior between
{workspaceRoot}
and{projectRoot}
should be documented.Related Issue(s)
Fixes #31264