Skip to content

Commit 99a7c9b

Browse files
committed
Simplify devDependency duplicate detection logic
1 parent 96f178f commit 99a7c9b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/knip/src/DependencyDeputy.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,13 @@ export class DependencyDeputy {
323323
dependencyIssues.push({ type: 'dependencies', workspace, filePath, symbol, fixes: [], ...position });
324324
}
325325

326-
const productionDeps = new Set(this.getProductionDependencies(workspace));
327-
const isDuplicateOrUnreferenced = (dep: string) => productionDeps.has(dep) || isNotReferencedDependency(dep);
326+
const manifest = this._manifests.get(workspace)!;
328327

329-
for (const symbol of this.getDevDependencies(workspace).filter(isDuplicateOrUnreferenced)) {
328+
for (const symbol of this.getDevDependencies(workspace)) {
329+
if (!manifest.dependencies.includes(symbol) && !isNotReferencedDependency(symbol)) continue;
330330
const position = peeker.getLocation('devDependencies', symbol);
331331
devDependencyIssues.push({ type: 'devDependencies', filePath, workspace, symbol, fixes: [], ...position });
332332
}
333-
334-
const manifest = this._manifests.get(workspace)!;
335333
for (const symbol of this.getOptionalPeerDependencies(workspace)) {
336334
if (!isReferencedDependency(symbol)) continue;
337335
if (manifest.dependencies.includes(symbol) || manifest.devDependencies.includes(symbol)) continue;

0 commit comments

Comments
 (0)