Skip to content

Commit 78f8cf4

Browse files
authored
Mark simple-git-hooks as used dependency when config exists (#1027)
1 parent b39ac44 commit 78f8cf4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/knip/src/plugins/simple-git-hooks/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { IsPluginEnabled, Plugin, ResolveConfig } from '../../types/config.js';
22
import type { Input } from '../../util/input.js';
3+
import { toDependency } from '../../util/input.js';
34
import { hasDependency } from '../../util/plugin.js';
45
import type { SimpleGitHooksConfig } from './types.js';
56

@@ -24,7 +25,7 @@ const resolveConfig: ResolveConfig<SimpleGitHooksConfig> = async (config, option
2425
for (const id of options.getInputsFromScripts(hook)) inputs.add(id);
2526
}
2627

27-
return Array.from(inputs);
28+
return [toDependency('simple-git-hooks'), ...Array.from(inputs)];
2829
};
2930

3031
export default {

packages/knip/test/plugins/simple-git-hooks.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ test('Find dependencies with the simple-git-hooks plugin', async () => {
1515

1616
assert(issues.binaries['package.json']['eslint']);
1717
assert(issues.binaries['package.json']['lint-staged']);
18-
assert(issues.devDependencies['package.json']['simple-git-hooks']);
1918
assert(issues.devDependencies['package.json']['lint-staged']);
2019

2120
assert.deepEqual(counters, {
2221
...baseCounters,
2322
binaries: 2,
24-
devDependencies: 2,
23+
devDependencies: 1,
2524
});
2625
});

0 commit comments

Comments
 (0)