fix(core): skip eslint custom hasher when hashing tasks during running commands (#28616)

This change speeds up Nx Cloud runs by not orchestrating cache hits for
lint tasks.

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jack Hsu 2024-10-25 08:30:22 -04:00 committed by GitHub
parent fe7d7ac48e
commit 4e81fa2d70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -50,13 +50,15 @@ export default async function run(
hashes.push(res.details.nodes[d]); hashes.push(res.details.nodes[d]);
} }
} }
return { const hashResult = {
value: hashArray([command, selfSource, ...hashes, tags]), value: hashArray([command, selfSource, ...hashes, tags]),
details: { details: {
command, command,
nodes: { [task.target.project]: selfSource, tags, ...nodes }, nodes: { [task.target.project]: selfSource, tags, ...nodes },
}, },
}; };
hashResult['name'] = 'eslint-hasher';
return hashResult;
} }
function allDeps( function allDeps(

View File

@ -41,7 +41,7 @@ export async function hashTasksThatDoNotDependOnOutputsOfOtherTasks(
const tasksToHash = tasksWithHashers const tasksToHash = tasksWithHashers
.filter(({ task, customHasher }) => { .filter(({ task, customHasher }) => {
// If a task has a custom hasher, it might depend on the outputs of other tasks // If a task has a custom hasher, it might depend on the outputs of other tasks
if (customHasher) { if (customHasher && customHasher.name !== 'eslint-hasher') {
return false; return false;
} }