diff --git a/packages/eslint-plugin/src/rules/dependency-checks.ts b/packages/eslint-plugin/src/rules/dependency-checks.ts index 937f63e24c29d..84d6f38d55350 100644 --- a/packages/eslint-plugin/src/rules/dependency-checks.ts +++ b/packages/eslint-plugin/src/rules/dependency-checks.ts @@ -45,7 +45,7 @@ export default createESLintRule({ type: 'object', properties: { buildTargets: [{ type: 'string' }], - ignoreDependencies: [{ type: 'string' }], + ignoredDependencies: [{ type: 'string' }], checkMissingDependencies: { type: 'boolean' }, checkObsoleteDependencies: { type: 'boolean' }, checkVersionMismatches: { type: 'boolean' }, diff --git a/packages/nx/src/plugins/js/package-json/create-package-json.ts b/packages/nx/src/plugins/js/package-json/create-package-json.ts index 7d844b4ef63ff..c84ad7ea027a5 100644 --- a/packages/nx/src/plugins/js/package-json/create-package-json.ts +++ b/packages/nx/src/plugins/js/package-json/create-package-json.ts @@ -181,6 +181,7 @@ export function findProjectsNpmDependencies( target: string, options: { helperDependencies?: string[]; + ignoredDependencies?: string[]; }, fileMap?: ProjectFileMap ): NpmDeps { @@ -213,6 +214,7 @@ export function findProjectsNpmDependencies( graph, npmDeps, seen, + options.ignoredDependencies || [], dependencyInputs, selfInputs ); @@ -226,6 +228,7 @@ function findAllNpmDeps( graph: ProjectGraph, npmDeps: NpmDeps, seen: Set, + ignoredDependencies: string[], dependencyPatterns: string[], rootPatterns?: string[] ): void { @@ -260,6 +263,14 @@ function findAllNpmDeps( } else { if (node) { seen.add(dep); + // do not add ignored dependencies to the list or non-npm dependencies + if ( + ignoredDependencies.includes(node.data.packageName) || + node.type !== 'npm' + ) { + continue; + } + npmDeps.dependencies[node.data.packageName] = node.data.version; recursivelyCollectPeerDependencies(node.name, graph, npmDeps, seen); } else if (graph.nodes[dep]) { @@ -269,6 +280,7 @@ function findAllNpmDeps( graph, npmDeps, seen, + ignoredDependencies, dependencyPatterns ); }