Skip to content

Commit 7abdc69

Browse files
committed
Fix config hints in production mode (resolves #1279)
1 parent 7c70d9f commit 7abdc69

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/knip/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const run = async () => {
8787

8888
if (
8989
(!parsedCLIArgs['no-exit-code'] && totalErrorCount > Number(parsedCLIArgs['max-issues'] ?? 0)) ||
90-
(options.isTreatConfigHintsAsErrors && configurationHints.size > 0)
90+
(!options.isDisableConfigHints && configurationHints.size > 0)
9191
) {
9292
process.exit(1);
9393
}

packages/knip/test/cli/cli-treat-config-hints-as-errors.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ test('knip (treatConfigHintsAsErrors: true)', () => {
1616
assert.equal(result.stderr, 'bananas package.json Remove from ignoreDependencies');
1717
assert.equal(result.status, 1);
1818
});
19+
20+
test('knip (production)', () => {
21+
const cwd = resolve('fixtures/treat-config-hints-as-errors2');
22+
const result = exec('knip --production', { cwd });
23+
assert.equal(result.stderr, '');
24+
assert.equal(result.status, 0);
25+
});

0 commit comments

Comments
 (0)