knip 5.66.3 → 5.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConfigurationChief.d.ts +6 -0
- package/dist/cli.js +1 -0
- package/dist/compilers/index.d.ts +10 -0
- package/dist/compilers/index.js +2 -0
- package/dist/compilers/tailwind.d.ts +6 -0
- package/dist/compilers/tailwind.js +11 -0
- package/dist/plugins/astro-db/index.d.ts +8 -0
- package/dist/plugins/astro-db/index.js +11 -0
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/next/index.js +2 -2
- package/dist/reporters/symbols.js +8 -2
- package/dist/reporters/util/configuration-hints.js +25 -8
- package/dist/schema/configuration.d.ts +10 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/types/issues.d.ts +2 -1
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +3 -1
- package/dist/util/create-options.d.ts +11 -0
- package/dist/util/create-options.js +20 -16
- package/dist/util/remove-export.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/schema.json +4 -0
|
@@ -62,6 +62,11 @@ export declare class ConfigurationChief {
|
|
|
62
62
|
entry?: string | string[] | undefined;
|
|
63
63
|
project?: string | string[] | undefined;
|
|
64
64
|
} | undefined;
|
|
65
|
+
'astro-db'?: string | boolean | string[] | {
|
|
66
|
+
config?: string | string[] | undefined;
|
|
67
|
+
entry?: string | string[] | undefined;
|
|
68
|
+
project?: string | string[] | undefined;
|
|
69
|
+
} | undefined;
|
|
65
70
|
ava?: string | boolean | string[] | {
|
|
66
71
|
config?: string | string[] | undefined;
|
|
67
72
|
entry?: string | string[] | undefined;
|
|
@@ -652,6 +657,7 @@ export declare class ConfigurationChief {
|
|
|
652
657
|
jest?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
653
658
|
angular?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
654
659
|
astro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
660
|
+
"astro-db"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
655
661
|
ava?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
656
662
|
babel?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
657
663
|
biome?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
package/dist/cli.js
CHANGED
|
@@ -46,6 +46,7 @@ const run = async () => {
|
|
|
46
46
|
isProduction: options.isProduction,
|
|
47
47
|
isShowProgress: options.isShowProgress,
|
|
48
48
|
isTreatConfigHintsAsErrors: options.isTreatConfigHintsAsErrors,
|
|
49
|
+
maxShowIssues: parsedCLIArgs['max-show-issues'] ? Number(parsedCLIArgs['max-show-issues']) : undefined,
|
|
49
50
|
options: parsedCLIArgs['reporter-options'] ?? '',
|
|
50
51
|
preprocessorOptions: parsedCLIArgs['preprocessor-options'] ?? '',
|
|
51
52
|
};
|
|
@@ -14,6 +14,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
14
14
|
entry?: string | string[] | undefined;
|
|
15
15
|
project?: string | string[] | undefined;
|
|
16
16
|
} | undefined;
|
|
17
|
+
'astro-db'?: string | boolean | string[] | {
|
|
18
|
+
config?: string | string[] | undefined;
|
|
19
|
+
entry?: string | string[] | undefined;
|
|
20
|
+
project?: string | string[] | undefined;
|
|
21
|
+
} | undefined;
|
|
17
22
|
ava?: string | boolean | string[] | {
|
|
18
23
|
config?: string | string[] | undefined;
|
|
19
24
|
entry?: string | string[] | undefined;
|
|
@@ -590,6 +595,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
590
595
|
entry?: string | string[] | undefined;
|
|
591
596
|
project?: string | string[] | undefined;
|
|
592
597
|
} | undefined;
|
|
598
|
+
'astro-db'?: string | boolean | string[] | {
|
|
599
|
+
config?: string | string[] | undefined;
|
|
600
|
+
entry?: string | string[] | undefined;
|
|
601
|
+
project?: string | string[] | undefined;
|
|
602
|
+
} | undefined;
|
|
593
603
|
ava?: string | boolean | string[] | {
|
|
594
604
|
config?: string | string[] | undefined;
|
|
595
605
|
entry?: string | string[] | undefined;
|
package/dist/compilers/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import Astro from './astro.js';
|
|
|
2
2
|
import AstroMDX from './astro-mdx.js';
|
|
3
3
|
import MDX from './mdx.js';
|
|
4
4
|
import Svelte from './svelte.js';
|
|
5
|
+
import CSS from './tailwind.js';
|
|
5
6
|
import Vue from './vue.js';
|
|
6
7
|
const isAsync = (fn) => (fn ? fn.constructor.name === 'AsyncFunction' : false);
|
|
7
8
|
const normalizeExt = (ext) => ext.replace(/^\.*/, '.');
|
|
@@ -28,6 +29,7 @@ export const partitionCompilers = (rawLocalConfig) => {
|
|
|
28
29
|
};
|
|
29
30
|
const compilers = new Map([
|
|
30
31
|
['.astro', Astro],
|
|
32
|
+
['.css', CSS],
|
|
31
33
|
['.mdx', MDX],
|
|
32
34
|
['.svelte', Svelte],
|
|
33
35
|
['.vue', Vue],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const condition = (hasDependency) => hasDependency('tailwindcss');
|
|
2
|
+
const directiveMatcher = /@(?:import|config|source|plugin)\s+['"]([^'"]+)['"][^;]*;/g;
|
|
3
|
+
const compiler = (text) => {
|
|
4
|
+
const imports = [];
|
|
5
|
+
let match;
|
|
6
|
+
while ((match = directiveMatcher.exec(text)))
|
|
7
|
+
if (match[1])
|
|
8
|
+
imports.push(`import '${match[1]}';`);
|
|
9
|
+
return imports.join('\n');
|
|
10
|
+
};
|
|
11
|
+
export default { condition, compiler };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'Astro DB';
|
|
3
|
+
const enablers = ['@astrojs/db'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const entry = ['db/config.{js,ts}', 'db/seed.{js,ts}'];
|
|
6
|
+
export default {
|
|
7
|
+
title,
|
|
8
|
+
enablers,
|
|
9
|
+
isEnabled,
|
|
10
|
+
entry,
|
|
11
|
+
};
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ export declare const Plugins: {
|
|
|
17
17
|
resolve: import("../types/config.js").Resolve;
|
|
18
18
|
project: string[];
|
|
19
19
|
};
|
|
20
|
+
'astro-db': {
|
|
21
|
+
title: string;
|
|
22
|
+
enablers: string[];
|
|
23
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
24
|
+
entry: string[];
|
|
25
|
+
};
|
|
20
26
|
ava: {
|
|
21
27
|
title: string;
|
|
22
28
|
enablers: string[];
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as angular } from './angular/index.js';
|
|
2
2
|
import { default as astro } from './astro/index.js';
|
|
3
|
+
import { default as astroDb } from './astro-db/index.js';
|
|
3
4
|
import { default as ava } from './ava/index.js';
|
|
4
5
|
import { default as babel } from './babel/index.js';
|
|
5
6
|
import { default as biome } from './biome/index.js';
|
|
@@ -116,6 +117,7 @@ import { default as yorkie } from './yorkie/index.js';
|
|
|
116
117
|
export const Plugins = {
|
|
117
118
|
angular,
|
|
118
119
|
astro,
|
|
120
|
+
'astro-db': astroDb,
|
|
119
121
|
ava,
|
|
120
122
|
babel,
|
|
121
123
|
biome,
|
|
@@ -8,8 +8,8 @@ const config = ['next.config.{js,ts,cjs,mjs}'];
|
|
|
8
8
|
const defaultPageExtensions = ['{js,jsx,ts,tsx}'];
|
|
9
9
|
const productionEntryFilePatterns = [
|
|
10
10
|
'{instrumentation,instrumentation-client,middleware,proxy}.{js,ts}',
|
|
11
|
-
'app/global-error.{js,jsx,ts,tsx}',
|
|
12
|
-
'app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx}',
|
|
11
|
+
'app/global-{error,not-found}.{js,jsx,ts,tsx}',
|
|
12
|
+
'app/**/{error,layout,loading,not-found,page,template,default,forbidden,unauthorized}.{js,jsx,ts,tsx}',
|
|
13
13
|
'app/**/route.{js,jsx,ts,tsx}',
|
|
14
14
|
'app/{manifest,robots}.{js,ts}',
|
|
15
15
|
'app/**/sitemap.{js,ts}',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { printConfigurationHints } from './util/configuration-hints.js';
|
|
2
|
-
import { getColoredTitle, getIssueTypeTitle, getTableForType } from './util/util.js';
|
|
2
|
+
import { dim, getColoredTitle, getIssueTypeTitle, getTableForType } from './util/util.js';
|
|
3
3
|
export default (options) => {
|
|
4
4
|
const { report, issues, isDisableConfigHints, isShowProgress } = options;
|
|
5
5
|
const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
|
|
@@ -12,7 +12,13 @@ export default (options) => {
|
|
|
12
12
|
const issuesForType = Object.values(issues[reportType]).flatMap(Object.values);
|
|
13
13
|
if (issuesForType.length > 0) {
|
|
14
14
|
title && console.log(getColoredTitle(title, issuesForType.length));
|
|
15
|
-
|
|
15
|
+
const issues = typeof options.maxShowIssues === 'number'
|
|
16
|
+
? Array.from(issuesForType).slice(0, options.maxShowIssues)
|
|
17
|
+
: issuesForType;
|
|
18
|
+
if (issues.length > 0)
|
|
19
|
+
console.log(getTableForType(issues, options.cwd).toString());
|
|
20
|
+
if (issues.length !== issuesForType.length)
|
|
21
|
+
console.log(dim(`…${issuesForType.length - issues.length} more items`));
|
|
16
22
|
totalIssues = totalIssues + issuesForType.length;
|
|
17
23
|
}
|
|
18
24
|
}
|
|
@@ -4,15 +4,17 @@ import { byPathDepth } from '../../util/workspace.js';
|
|
|
4
4
|
import { bright, dim, getColoredTitle, getDimmedTitle } from './util.js';
|
|
5
5
|
const getWorkspaceName = (hint) => hint.workspaceName &&
|
|
6
6
|
hint.workspaceName !== '.' &&
|
|
7
|
+
hint.type !== 'top-level-unconfigured' &&
|
|
7
8
|
hint.type !== 'workspace-unconfigured' &&
|
|
8
9
|
hint.type !== 'package-entry'
|
|
9
10
|
? hint.workspaceName
|
|
10
11
|
: '';
|
|
12
|
+
const getIdentifier = (hint) => hint.identifier === '.' ? `. ${dim('(root)')}` : hint.identifier.toString();
|
|
11
13
|
const getTableForHints = (hints) => {
|
|
12
14
|
const table = new Table({ truncateStart: ['identifier', 'workspace', 'filePath'] });
|
|
13
15
|
for (const hint of hints) {
|
|
14
16
|
table.row();
|
|
15
|
-
table.cell('identifier', hint
|
|
17
|
+
table.cell('identifier', getIdentifier(hint));
|
|
16
18
|
table.cell('workspace', getWorkspaceName(hint));
|
|
17
19
|
table.cell('filePath', hint.filePath);
|
|
18
20
|
table.cell('description', dim(hint.message));
|
|
@@ -25,6 +27,9 @@ const empty = (options) => `Refine ${type(options.type)} pattern (no matches)`;
|
|
|
25
27
|
const remove = (options) => `Remove redundant ${type(options.type)} pattern`;
|
|
26
28
|
const topLevel = (options) => `Remove, or move unused top-level ${type(options.type)} to one of ${bright('"workspaces"')}`;
|
|
27
29
|
const add = (options) => options.configFilePath
|
|
30
|
+
? `Add ${bright('entry')} and/or refine ${bright('project')} files (${options.size} unused files)`
|
|
31
|
+
: `Create ${bright('knip.json')} configuration file, and add ${bright('entry')} and/or refine ${bright('project')} files (${options.size} unused files)`;
|
|
32
|
+
const addWorkspace = (options) => options.configFilePath
|
|
28
33
|
? `Add ${bright('entry')} and/or refine ${bright('project')} files in ${bright(`workspaces["${options.workspaceName}"]`)} (${options.size} unused files)`
|
|
29
34
|
: `Create ${bright('knip.json')} configuration file with ${bright(`workspaces["${options.workspaceName}"]`)} object (${options.size} unused files)`;
|
|
30
35
|
const packageEntry = () => 'Package entry file not found';
|
|
@@ -37,14 +42,15 @@ const hintPrinters = new Map([
|
|
|
37
42
|
['project-empty', { print: empty }],
|
|
38
43
|
['entry-redundant', { print: remove }],
|
|
39
44
|
['project-redundant', { print: remove }],
|
|
40
|
-
['
|
|
45
|
+
['top-level-unconfigured', { print: add }],
|
|
46
|
+
['workspace-unconfigured', { print: addWorkspace }],
|
|
41
47
|
['entry-top-level', { print: topLevel }],
|
|
42
48
|
['project-top-level', { print: topLevel }],
|
|
43
49
|
['package-entry', { print: packageEntry }],
|
|
44
50
|
]);
|
|
45
51
|
export { hintPrinters };
|
|
46
52
|
const hintTypesOrder = [
|
|
47
|
-
['workspace-unconfigured'],
|
|
53
|
+
['top-level-unconfigured', 'workspace-unconfigured'],
|
|
48
54
|
['entry-top-level', 'project-top-level'],
|
|
49
55
|
['ignoreWorkspaces'],
|
|
50
56
|
['ignoreDependencies'],
|
|
@@ -64,10 +70,15 @@ export const printConfigurationHints = ({ cwd, counters, issues, tagHints, confi
|
|
|
64
70
|
if (workspace)
|
|
65
71
|
workspace.size++;
|
|
66
72
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
if (workspaces.length === 1) {
|
|
74
|
+
configurationHints.add({ type: 'top-level-unconfigured', identifier: '.', size: workspaces[0].size });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const topWorkspaces = workspaces.sort((a, b) => b.size - a.size).filter(ws => ws.size > 1);
|
|
78
|
+
for (const { dir, size } of topWorkspaces) {
|
|
79
|
+
const identifier = toRelative(dir, cwd) || '.';
|
|
80
|
+
configurationHints.add({ type: 'workspace-unconfigured', workspaceName: identifier, identifier, size });
|
|
81
|
+
}
|
|
71
82
|
}
|
|
72
83
|
}
|
|
73
84
|
if (configurationHints.size > 0) {
|
|
@@ -80,12 +91,18 @@ export const printConfigurationHints = ({ cwd, counters, issues, tagHints, confi
|
|
|
80
91
|
}
|
|
81
92
|
const rows = hintTypesOrder.flatMap(hintTypes => hintTypes.flatMap(hintType => {
|
|
82
93
|
const hints = hintsByType.get(hintType) ?? [];
|
|
83
|
-
|
|
94
|
+
const topHints = hints.length > 10 ? Array.from(hints).slice(0, 10) : hints;
|
|
95
|
+
const row = topHints.map(hint => {
|
|
84
96
|
hint.filePath = relative(cwd, hint.filePath ?? configFilePath ?? '');
|
|
85
97
|
const hintPrinter = hintPrinters.get(hint.type);
|
|
86
98
|
const message = hintPrinter ? hintPrinter.print({ ...hint, configFilePath }) : '';
|
|
87
99
|
return { ...hint, message };
|
|
88
100
|
});
|
|
101
|
+
if (hints.length !== topHints.length) {
|
|
102
|
+
const identifier = dim(`...${hints.length - topHints.length} more similar hints`);
|
|
103
|
+
row.push({ type: hintType, identifier, filePath: '', message: '' });
|
|
104
|
+
}
|
|
105
|
+
return row;
|
|
89
106
|
}));
|
|
90
107
|
console.warn(getTableForHints(rows).toString());
|
|
91
108
|
}
|
|
@@ -12,6 +12,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
12
12
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
13
13
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
14
14
|
}, z.core.$strip>]>>;
|
|
15
|
+
'astro-db': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
16
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
17
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
18
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
19
|
+
}, z.core.$strip>]>>;
|
|
15
20
|
ava: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
16
21
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
17
22
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -588,6 +593,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
588
593
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
589
594
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
590
595
|
}, z.core.$strip>]>>;
|
|
596
|
+
'astro-db': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
597
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
598
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
599
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
600
|
+
}, z.core.$strip>]>>;
|
|
591
601
|
ava: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
592
602
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
593
603
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
16
16
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
17
17
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
18
18
|
}, z.core.$strip>]>;
|
|
19
|
+
'astro-db': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
20
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
21
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
22
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
23
|
+
}, z.core.$strip>]>;
|
|
19
24
|
ava: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
20
25
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
21
26
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -61,13 +61,14 @@ export type ReporterOptions = {
|
|
|
61
61
|
preprocessorOptions: string;
|
|
62
62
|
includedWorkspaceDirs: string[];
|
|
63
63
|
configFilePath?: string;
|
|
64
|
+
maxShowIssues?: number;
|
|
64
65
|
};
|
|
65
66
|
export type Reporter = (options: ReporterOptions) => void;
|
|
66
67
|
export type Preprocessor = (options: ReporterOptions) => ReporterOptions;
|
|
67
68
|
export type IssueSeverity = 'error' | 'warn' | 'off';
|
|
68
69
|
export type Rules = Record<IssueType, IssueSeverity>;
|
|
69
70
|
export type ConfigurationHints = Map<string, ConfigurationHint>;
|
|
70
|
-
export type ConfigurationHintType = 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'ignoreWorkspaces' | 'entry-redundant' | 'project-redundant' | 'entry-top-level' | 'project-top-level' | 'entry-empty' | 'project-empty' | 'package-entry' | 'workspace-unconfigured';
|
|
71
|
+
export type ConfigurationHintType = 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'ignoreWorkspaces' | 'entry-redundant' | 'project-redundant' | 'entry-top-level' | 'project-top-level' | 'entry-empty' | 'project-empty' | 'package-entry' | 'top-level-unconfigured' | 'workspace-unconfigured';
|
|
71
72
|
export type ConfigurationHint = {
|
|
72
73
|
type: ConfigurationHintType;
|
|
73
74
|
identifier: string | RegExp;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --format Format modified files after --fix using the local formatter\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, github-actions, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of key functions and display stats table\n --performance-fn [name] Measure only function [name]\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
|
|
1
|
+
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --format Format modified files after --fix using the local formatter\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, github-actions, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of total issues before non-zero exit code (default: 0)\n --max-show-issues Maximum number of issues to display per type\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of key functions and display stats table\n --performance-fn [name] Measure only function [name]\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
|
|
2
2
|
export type ParsedCLIArgs = ReturnType<typeof parseCLIArgs>;
|
|
3
3
|
export default function parseCLIArgs(): {
|
|
4
4
|
cache?: boolean | undefined;
|
|
@@ -23,6 +23,7 @@ export default function parseCLIArgs(): {
|
|
|
23
23
|
'include-entry-exports'?: boolean | undefined;
|
|
24
24
|
'isolate-workspaces'?: boolean | undefined;
|
|
25
25
|
'max-issues'?: string | undefined;
|
|
26
|
+
'max-show-issues'?: string | undefined;
|
|
26
27
|
memory?: boolean | undefined;
|
|
27
28
|
'memory-realtime'?: boolean | undefined;
|
|
28
29
|
'no-config-hints'?: boolean | undefined;
|
|
@@ -35,7 +35,8 @@ Options:
|
|
|
35
35
|
--no-config-hints Suppress configuration hints
|
|
36
36
|
--treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints
|
|
37
37
|
--no-exit-code Always exit with code zero (0)
|
|
38
|
-
--max-issues Maximum number of issues before non-zero exit code (default: 0)
|
|
38
|
+
--max-issues Maximum number of total issues before non-zero exit code (default: 0)
|
|
39
|
+
--max-show-issues Maximum number of issues to display per type
|
|
39
40
|
-d, --debug Show debug output
|
|
40
41
|
--trace Show trace output
|
|
41
42
|
--trace-export [name] Show trace output for named export(s)
|
|
@@ -85,6 +86,7 @@ export default function parseCLIArgs() {
|
|
|
85
86
|
'include-entry-exports': { type: 'boolean' },
|
|
86
87
|
'isolate-workspaces': { type: 'boolean' },
|
|
87
88
|
'max-issues': { type: 'string' },
|
|
89
|
+
'max-show-issues': { type: 'string' },
|
|
88
90
|
memory: { type: 'boolean' },
|
|
89
91
|
'memory-realtime': { type: 'boolean' },
|
|
90
92
|
'no-config-hints': { type: 'boolean' },
|
|
@@ -37,6 +37,7 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
37
37
|
isTrace: boolean;
|
|
38
38
|
isTreatConfigHintsAsErrors: boolean;
|
|
39
39
|
isWatch: boolean;
|
|
40
|
+
maxShowIssues: number | undefined;
|
|
40
41
|
parsedConfig: {
|
|
41
42
|
angular?: string | boolean | string[] | {
|
|
42
43
|
config?: string | string[] | undefined;
|
|
@@ -48,6 +49,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
48
49
|
entry?: string | string[] | undefined;
|
|
49
50
|
project?: string | string[] | undefined;
|
|
50
51
|
} | undefined;
|
|
52
|
+
'astro-db'?: string | boolean | string[] | {
|
|
53
|
+
config?: string | string[] | undefined;
|
|
54
|
+
entry?: string | string[] | undefined;
|
|
55
|
+
project?: string | string[] | undefined;
|
|
56
|
+
} | undefined;
|
|
51
57
|
ava?: string | boolean | string[] | {
|
|
52
58
|
config?: string | string[] | undefined;
|
|
53
59
|
entry?: string | string[] | undefined;
|
|
@@ -624,6 +630,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
624
630
|
entry?: string | string[] | undefined;
|
|
625
631
|
project?: string | string[] | undefined;
|
|
626
632
|
} | undefined;
|
|
633
|
+
'astro-db'?: string | boolean | string[] | {
|
|
634
|
+
config?: string | string[] | undefined;
|
|
635
|
+
entry?: string | string[] | undefined;
|
|
636
|
+
project?: string | string[] | undefined;
|
|
637
|
+
} | undefined;
|
|
627
638
|
ava?: string | boolean | string[] | {
|
|
628
639
|
config?: string | string[] | undefined;
|
|
629
640
|
entry?: string | string[] | undefined;
|
|
@@ -12,7 +12,7 @@ import { isAbsolute, join, normalize, toAbsolute, toPosix } from './path.js';
|
|
|
12
12
|
import { splitTags } from './tag.js';
|
|
13
13
|
const pcwd = process.cwd();
|
|
14
14
|
export const createOptions = async (options) => {
|
|
15
|
-
const { parsedCLIArgs = {}
|
|
15
|
+
const { parsedCLIArgs = {} } = options;
|
|
16
16
|
const cwd = normalize(toPosix(toAbsolute(options.cwd ?? parsedCLIArgs.directory ?? pcwd, pcwd)));
|
|
17
17
|
const manifestPath = findFile(cwd, 'package.json');
|
|
18
18
|
const manifest = manifestPath && (await loadJSON(manifestPath));
|
|
@@ -42,17 +42,17 @@ export const createOptions = async (options) => {
|
|
|
42
42
|
? manifest.workspaces
|
|
43
43
|
: (manifest.workspaces.packages ?? [])
|
|
44
44
|
: []);
|
|
45
|
-
const isStrict =
|
|
46
|
-
const isProduction =
|
|
45
|
+
const isStrict = options.isStrict ?? parsedCLIArgs.strict ?? false;
|
|
46
|
+
const isProduction = options.isProduction ?? parsedCLIArgs.production ?? isStrict;
|
|
47
47
|
const rules = { ...defaultRules, ...parsedConfig.rules };
|
|
48
48
|
const excludesFromRules = getKeysByValue(rules, 'off');
|
|
49
49
|
const includedIssueTypes = getIncludedIssueTypes({
|
|
50
50
|
isProduction,
|
|
51
51
|
exclude: [...excludesFromRules, ...(parsedConfig.exclude ?? [])],
|
|
52
52
|
include: parsedConfig.include ?? [],
|
|
53
|
-
excludeOverrides:
|
|
53
|
+
excludeOverrides: options.excludedIssueTypes ?? parsedCLIArgs.exclude ?? [],
|
|
54
54
|
includeOverrides: [
|
|
55
|
-
...(
|
|
55
|
+
...(options.includedIssueTypes ?? parsedCLIArgs.include ?? []),
|
|
56
56
|
...(parsedCLIArgs.dependencies ? shorthandDeps : []),
|
|
57
57
|
...(parsedCLIArgs.exports ? shorthandTypes : []),
|
|
58
58
|
...(parsedCLIArgs.files ? shorthandFiles : []),
|
|
@@ -62,11 +62,11 @@ export const createOptions = async (options) => {
|
|
|
62
62
|
if (!value)
|
|
63
63
|
rules[key] = 'off';
|
|
64
64
|
}
|
|
65
|
-
const fixTypes =
|
|
65
|
+
const fixTypes = options.fixTypes ?? parsedCLIArgs['fix-type'] ?? [];
|
|
66
66
|
const isFixFiles = parsedCLIArgs['allow-remove-files'] && (fixTypes.length === 0 || fixTypes.includes('files'));
|
|
67
|
-
const isIncludeLibs = parsedCLIArgs['include-libs'] ??
|
|
67
|
+
const isIncludeLibs = parsedCLIArgs['include-libs'] ?? options.isIncludeLibs ?? false;
|
|
68
68
|
const isReportClassMembers = includedIssueTypes.classMembers;
|
|
69
|
-
const tags = splitTags(parsedCLIArgs.tags ??
|
|
69
|
+
const tags = splitTags(parsedCLIArgs.tags ?? options.tags ?? parsedConfig.tags ?? parsedCLIArgs['experimental-tags'] ?? []);
|
|
70
70
|
return {
|
|
71
71
|
cacheLocation: parsedCLIArgs['cache-location'] ?? join(cwd, 'node_modules', '.cache', 'knip'),
|
|
72
72
|
config: parsedCLIArgs.config,
|
|
@@ -77,19 +77,19 @@ export const createOptions = async (options) => {
|
|
|
77
77
|
exports: parsedCLIArgs.exports ?? false,
|
|
78
78
|
files: parsedCLIArgs.files ?? false,
|
|
79
79
|
fixTypes,
|
|
80
|
-
gitignore: parsedCLIArgs['no-gitignore'] ? false : (
|
|
80
|
+
gitignore: parsedCLIArgs['no-gitignore'] ? false : (options.gitignore ?? true),
|
|
81
81
|
includedIssueTypes,
|
|
82
82
|
isCache: parsedCLIArgs.cache ?? false,
|
|
83
83
|
isDebug: parsedCLIArgs.debug ?? false,
|
|
84
84
|
isDisableConfigHints: parsedCLIArgs['no-config-hints'] || isProduction || Boolean(parsedCLIArgs.workspace),
|
|
85
|
-
isFix: parsedCLIArgs.fix ??
|
|
85
|
+
isFix: parsedCLIArgs.fix ?? options.isFix ?? isFixFiles ?? fixTypes.length > 0,
|
|
86
86
|
isFixDependencies: fixTypes.length === 0 || fixTypes.includes('dependencies'),
|
|
87
87
|
isFixFiles,
|
|
88
88
|
isFixUnusedExports: fixTypes.length === 0 || fixTypes.includes('exports'),
|
|
89
89
|
isFixUnusedTypes: fixTypes.length === 0 || fixTypes.includes('types'),
|
|
90
|
-
isFormat: parsedCLIArgs.format ??
|
|
91
|
-
isIncludeEntryExports: parsedCLIArgs['include-entry-exports'] ??
|
|
92
|
-
isIsolateWorkspaces:
|
|
90
|
+
isFormat: parsedCLIArgs.format ?? options.isFormat ?? false,
|
|
91
|
+
isIncludeEntryExports: parsedCLIArgs['include-entry-exports'] ?? options.isIncludeEntryExports ?? false,
|
|
92
|
+
isIsolateWorkspaces: options.isIsolateWorkspaces ?? parsedCLIArgs['isolate-workspaces'] ?? false,
|
|
93
93
|
isProduction,
|
|
94
94
|
isReportClassMembers,
|
|
95
95
|
isReportDependencies: includedIssueTypes.dependencies ||
|
|
@@ -98,19 +98,23 @@ export const createOptions = async (options) => {
|
|
|
98
98
|
includedIssueTypes.binaries,
|
|
99
99
|
isReportTypes: includedIssueTypes.types || includedIssueTypes.nsTypes || includedIssueTypes.enumMembers,
|
|
100
100
|
isReportValues: includedIssueTypes.exports || includedIssueTypes.nsExports || isReportClassMembers,
|
|
101
|
-
isShowProgress: parsedCLIArgs['no-progress'] !== true &&
|
|
101
|
+
isShowProgress: parsedCLIArgs['no-progress'] !== true &&
|
|
102
|
+
options.isShowProgress !== false &&
|
|
103
|
+
process.stdout.isTTY &&
|
|
104
|
+
typeof process.stdout.cursorTo === 'function',
|
|
102
105
|
isSkipLibs: !(isIncludeLibs || includedIssueTypes.classMembers),
|
|
103
106
|
isStrict,
|
|
104
107
|
isTrace: Boolean(parsedCLIArgs.trace ?? parsedCLIArgs['trace-file'] ?? parsedCLIArgs['trace-export']),
|
|
105
108
|
isTreatConfigHintsAsErrors: parsedCLIArgs['treat-config-hints-as-errors'] ?? parsedConfig.treatConfigHintsAsErrors ?? false,
|
|
106
|
-
isWatch: parsedCLIArgs.watch ??
|
|
109
|
+
isWatch: parsedCLIArgs.watch ?? options.isWatch ?? false,
|
|
110
|
+
maxShowIssues: parsedCLIArgs['max-show-issues'] ? Number(parsedCLIArgs['max-show-issues']) : undefined,
|
|
107
111
|
parsedConfig,
|
|
108
112
|
rules,
|
|
109
113
|
tags,
|
|
110
114
|
traceExport: parsedCLIArgs['trace-export'],
|
|
111
115
|
traceFile: parsedCLIArgs['trace-file'],
|
|
112
116
|
tsConfigFile: parsedCLIArgs.tsConfig,
|
|
113
|
-
workspace:
|
|
117
|
+
workspace: options.workspace ?? parsedCLIArgs.workspace,
|
|
114
118
|
workspaces,
|
|
115
119
|
};
|
|
116
120
|
};
|
|
@@ -57,7 +57,7 @@ export const removeExport = ({ text, start, end, flags }) => {
|
|
|
57
57
|
const openingBracketIndex = getOpeningBracketIndex(beforeStart);
|
|
58
58
|
if (closingBracketOffset !== -1 && openingBracketIndex !== -1) {
|
|
59
59
|
const beforeBracket = beforeStart.substring(0, openingBracketIndex).trim();
|
|
60
|
-
const exportLength = beforeBracket.endsWith('export') ? 6 : beforeBracket.endsWith('export type') ?
|
|
60
|
+
const exportLength = beforeBracket.endsWith('export') ? 6 : beforeBracket.endsWith('export type') ? 11 : 0;
|
|
61
61
|
const exportKeywordOffset = beforeBracket.length - exportLength;
|
|
62
62
|
if (exportLength) {
|
|
63
63
|
const fromBracket = afterEnd.substring(closingBracketOffset).trim();
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.67.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.67.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.67.0",
|
|
4
4
|
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"build": "tsc",
|
|
47
47
|
"qa": "pnpm lint && pnpm build && pnpm knip && pnpm knip:production && pnpm run test",
|
|
48
48
|
"release": "release-it",
|
|
49
|
-
"create-plugin": "
|
|
49
|
+
"create-plugin": "tsx ./scripts/create-new-plugin.ts",
|
|
50
50
|
"postcreate-plugin": "pnpm run build && biome format --write schema.json schema-jsonc.json src/schema/plugins.ts",
|
|
51
51
|
"generate-plugin-defs": "node ./scripts/generate-plugin-defs.js && biome check --write src/plugins/index.ts src/types/PluginNames.ts src/schema/plugins.ts"
|
|
52
52
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"jiti": "^2.6.0",
|
|
64
64
|
"js-yaml": "^4.1.0",
|
|
65
65
|
"minimist": "^1.2.8",
|
|
66
|
-
"oxc-resolver": "^11.
|
|
66
|
+
"oxc-resolver": "^11.12.0",
|
|
67
67
|
"picocolors": "^1.1.1",
|
|
68
68
|
"picomatch": "^4.0.1",
|
|
69
69
|
"smol-toml": "^1.4.1",
|
package/schema.json
CHANGED
|
@@ -334,6 +334,10 @@
|
|
|
334
334
|
"title": "astro plugin configuration (https://knip.dev/reference/plugins/astro)",
|
|
335
335
|
"$ref": "#/definitions/plugin"
|
|
336
336
|
},
|
|
337
|
+
"astro-db": {
|
|
338
|
+
"title": "astro-db plugin configuration (https://knip.dev/reference/plugins/astro-db)",
|
|
339
|
+
"$ref": "#/definitions/plugin"
|
|
340
|
+
},
|
|
337
341
|
"ava": {
|
|
338
342
|
"title": "ava plugin configuration (https://knip.dev/reference/plugins/ava)",
|
|
339
343
|
"$ref": "#/definitions/plugin"
|