knip 5.77.2 → 5.77.3
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 +1 -1
- package/dist/ConfigurationChief.js +3 -3
- package/dist/DependencyDeputy.d.ts +1 -1
- package/dist/DependencyDeputy.js +4 -4
- package/dist/IssueCollector.d.ts +1 -1
- package/dist/IssueCollector.js +1 -1
- package/dist/WorkspaceWorker.d.ts +1 -1
- package/dist/WorkspaceWorker.js +4 -4
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/reporters/githubActions.js +2 -2
- package/dist/reporters/symbols.js +1 -1
- package/dist/reporters/util/configuration-hints.d.ts +1 -1
- package/dist/reporters/util/configuration-hints.js +8 -3
- package/dist/run.d.ts +2 -2
- package/dist/session/session.d.ts +0 -2
- package/dist/session/session.js +0 -2
- package/dist/types/issues.d.ts +1 -1
- package/dist/util/watch.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ export declare class ConfigurationChief {
|
|
|
36
36
|
workspaceGraph: WorkspaceGraph;
|
|
37
37
|
includedWorkspaces: Workspace[];
|
|
38
38
|
constructor(options: MainOptions);
|
|
39
|
-
getConfigurationHints():
|
|
39
|
+
getConfigurationHints(): ConfigurationHint[];
|
|
40
40
|
private normalize;
|
|
41
41
|
getWorkspaces(): Promise<Workspace[]>;
|
|
42
42
|
private getListedWorkspaces;
|
|
@@ -73,18 +73,18 @@ export class ConfigurationChief {
|
|
|
73
73
|
this.config = this.normalize(options.parsedConfig ?? {});
|
|
74
74
|
}
|
|
75
75
|
getConfigurationHints() {
|
|
76
|
-
const hints =
|
|
76
|
+
const hints = [];
|
|
77
77
|
if (this.rawConfig) {
|
|
78
78
|
if (this.workspacePackages.size > 1) {
|
|
79
79
|
const entry = arrayify(this.rawConfig.entry);
|
|
80
80
|
if (entry.length > 0) {
|
|
81
81
|
const identifier = `[${entry[0]}${entry.length > 1 ? `, ${ELLIPSIS}` : ''}]`;
|
|
82
|
-
hints.
|
|
82
|
+
hints.push({ type: 'entry-top-level', identifier });
|
|
83
83
|
}
|
|
84
84
|
const project = arrayify(this.rawConfig.project);
|
|
85
85
|
if (project.length > 0) {
|
|
86
86
|
const identifier = `[${project[0]}${project.length > 1 ? `, ${ELLIPSIS}` : ''}]`;
|
|
87
|
-
hints.
|
|
87
|
+
hints.push({ type: 'project-top-level', identifier });
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -71,7 +71,7 @@ export declare class DependencyDeputy {
|
|
|
71
71
|
issues: Issues;
|
|
72
72
|
counters: Counters;
|
|
73
73
|
}): void;
|
|
74
|
-
getConfigurationHints():
|
|
74
|
+
getConfigurationHints(): ConfigurationHint[];
|
|
75
75
|
addIgnoredDependencies(workspaceName: string, identifier: string): void;
|
|
76
76
|
addIgnoredBinaries(workspaceName: string, identifier: string): void;
|
|
77
77
|
}
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -349,16 +349,16 @@ export class DependencyDeputy {
|
|
|
349
349
|
this.handleIgnoredUnresolved(issues, counters);
|
|
350
350
|
}
|
|
351
351
|
getConfigurationHints() {
|
|
352
|
-
const configurationHints =
|
|
352
|
+
const configurationHints = [];
|
|
353
353
|
for (const [workspaceName, manifest] of this._manifests) {
|
|
354
354
|
for (const identifier of manifest.unusedIgnoreDependencies) {
|
|
355
|
-
configurationHints.
|
|
355
|
+
configurationHints.push({ workspaceName, identifier, type: 'ignoreDependencies' });
|
|
356
356
|
}
|
|
357
357
|
for (const identifier of manifest.unusedIgnoreBinaries) {
|
|
358
|
-
configurationHints.
|
|
358
|
+
configurationHints.push({ workspaceName, identifier, type: 'ignoreBinaries' });
|
|
359
359
|
}
|
|
360
360
|
for (const identifier of manifest.unusedIgnoreUnresolved) {
|
|
361
|
-
configurationHints.
|
|
361
|
+
configurationHints.push({ workspaceName, identifier, type: 'ignoreUnresolved' });
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
return configurationHints;
|
package/dist/IssueCollector.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare class IssueCollector {
|
|
|
34
34
|
issues: import("./types/issues.js").Issues;
|
|
35
35
|
counters: import("./types/issues.js").Counters;
|
|
36
36
|
tagHints: Set<TagHint>;
|
|
37
|
-
configurationHints:
|
|
37
|
+
configurationHints: ConfigurationHint[];
|
|
38
38
|
};
|
|
39
39
|
private retainedIssues;
|
|
40
40
|
retainIssue(issue: Issue): void;
|
package/dist/IssueCollector.js
CHANGED
|
@@ -120,7 +120,7 @@ export class IssueCollector {
|
|
|
120
120
|
issues: this.issues,
|
|
121
121
|
counters: this.counters,
|
|
122
122
|
tagHints: this.tagHints,
|
|
123
|
-
configurationHints:
|
|
123
|
+
configurationHints: Array.from(this.configurationHints.values()),
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
retainedIssues = [];
|
|
@@ -59,7 +59,7 @@ export declare class WorkspaceWorker {
|
|
|
59
59
|
getProductionProjectFilePatterns(negatedTestFilePatterns: string[]): string[];
|
|
60
60
|
private getConfigurationFilePatterns;
|
|
61
61
|
runPlugins(): Promise<Input[]>;
|
|
62
|
-
getConfigurationHints(type: 'entry' | 'project', patterns: string[], filePaths: string[], includedPaths: Set<string>):
|
|
62
|
+
getConfigurationHints(type: 'entry' | 'project', patterns: string[], filePaths: string[], includedPaths: Set<string>): ConfigurationHint[];
|
|
63
63
|
onDispose(): void;
|
|
64
64
|
}
|
|
65
65
|
export {};
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -335,7 +335,7 @@ export class WorkspaceWorker {
|
|
|
335
335
|
return inputs;
|
|
336
336
|
}
|
|
337
337
|
getConfigurationHints(type, patterns, filePaths, includedPaths) {
|
|
338
|
-
const hints =
|
|
338
|
+
const hints = [];
|
|
339
339
|
const entries = this.config[type].filter(pattern => !pattern.startsWith('!'));
|
|
340
340
|
const workspaceName = this.name;
|
|
341
341
|
const userDefinedPatterns = entries.filter(id => !isDefaultPattern(type, id));
|
|
@@ -343,7 +343,7 @@ export class WorkspaceWorker {
|
|
|
343
343
|
return hints;
|
|
344
344
|
if (filePaths.length === 0) {
|
|
345
345
|
const identifier = `[${entries[0]}${entries.length > 1 ? `, ${ELLIPSIS}` : ''}]`;
|
|
346
|
-
hints.
|
|
346
|
+
hints.push({ type: `${type}-empty`, identifier, workspaceName });
|
|
347
347
|
return hints;
|
|
348
348
|
}
|
|
349
349
|
for (const pattern of patterns) {
|
|
@@ -351,12 +351,12 @@ export class WorkspaceWorker {
|
|
|
351
351
|
continue;
|
|
352
352
|
const filePathOrPattern = join(this.dir, pattern.replace(/!$/, ''));
|
|
353
353
|
if (includedPaths.has(filePathOrPattern)) {
|
|
354
|
-
hints.
|
|
354
|
+
hints.push({ type: `${type}-redundant`, identifier: pattern, workspaceName });
|
|
355
355
|
}
|
|
356
356
|
else {
|
|
357
357
|
const matcher = picomatch(filePathOrPattern);
|
|
358
358
|
if (!filePaths.some(filePath => matcher(filePath))) {
|
|
359
|
-
hints.
|
|
359
|
+
hints.push({ type: `${type}-empty`, identifier: pattern, workspaceName });
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
}
|
package/dist/cli.js
CHANGED
|
@@ -74,7 +74,7 @@ const run = async () => {
|
|
|
74
74
|
logWarning('WARNING', 'Class members are not tracked when using the --isolate-workspaces flag');
|
|
75
75
|
}
|
|
76
76
|
if ((!args['no-exit-code'] && totalErrorCount > Number(args['max-issues'] ?? 0)) ||
|
|
77
|
-
(!options.isDisableConfigHints && options.isTreatConfigHintsAsErrors && configurationHints.
|
|
77
|
+
(!options.isDisableConfigHints && options.isTreatConfigHintsAsErrors && configurationHints.length > 0)) {
|
|
78
78
|
process.exit(1);
|
|
79
79
|
}
|
|
80
80
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const main: (options: MainOptions) => Promise<{
|
|
|
3
3
|
issues: import("./types/issues.js").Issues;
|
|
4
4
|
counters: import("./types/issues.js").Counters;
|
|
5
5
|
tagHints: Set<import("./types/issues.js").TagHint>;
|
|
6
|
-
configurationHints:
|
|
6
|
+
configurationHints: import("./types/issues.js").ConfigurationHint[];
|
|
7
7
|
includedWorkspaceDirs: string[];
|
|
8
8
|
enabledPlugins: {
|
|
9
9
|
[k: string]: string[];
|
|
@@ -54,9 +54,9 @@ export default ({ report, issues, cwd, configurationHints, isDisableConfigHints,
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
if (!isDisableConfigHints && configurationHints.
|
|
57
|
+
if (!isDisableConfigHints && configurationHints.length > 0) {
|
|
58
58
|
const CONFIG_HINTS_TITLE = 'Configuration hints';
|
|
59
|
-
core.info(`${CONFIG_HINTS_TITLE} (${configurationHints.
|
|
59
|
+
core.info(`${CONFIG_HINTS_TITLE} (${configurationHints.length})`);
|
|
60
60
|
const sortedHints = [...configurationHints].sort((a, b) => (a.filePath ?? '').localeCompare(b.filePath ?? ''));
|
|
61
61
|
for (const hint of sortedHints) {
|
|
62
62
|
const hintPrinter = hintPrinters.get(hint.type);
|
|
@@ -28,7 +28,7 @@ export default (options) => {
|
|
|
28
28
|
}
|
|
29
29
|
if (totalIssues === 0 &&
|
|
30
30
|
isShowProgress &&
|
|
31
|
-
(!options.isTreatConfigHintsAsErrors || options.configurationHints.
|
|
31
|
+
(!options.isTreatConfigHintsAsErrors || options.configurationHints.length === 0)) {
|
|
32
32
|
console.log('✂️ Excellent, Knip found no issues.');
|
|
33
33
|
}
|
|
34
34
|
};
|
|
@@ -12,7 +12,7 @@ declare const hintPrinters: Map<ConfigurationHintType, {
|
|
|
12
12
|
print: (options: PrintHintOptions) => string;
|
|
13
13
|
}>;
|
|
14
14
|
export { hintPrinters };
|
|
15
|
-
|
|
15
|
+
interface ProcessedHint extends ConfigurationHint {
|
|
16
16
|
message: string;
|
|
17
17
|
}
|
|
18
18
|
export declare const finalizeConfigurationHints: (results: Results, options: {
|
|
@@ -71,13 +71,18 @@ export const finalizeConfigurationHints = (results, options) => {
|
|
|
71
71
|
workspace.size++;
|
|
72
72
|
}
|
|
73
73
|
if (workspaces.length === 1) {
|
|
74
|
-
results.configurationHints.
|
|
74
|
+
results.configurationHints.push({ type: 'top-level-unconfigured', identifier: '.', size: workspaces[0].size });
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
const topWorkspaces = workspaces.sort((a, b) => b.size - a.size).filter(ws => ws.size > 1);
|
|
78
78
|
for (const { dir, size } of topWorkspaces) {
|
|
79
79
|
const identifier = toRelative(dir, options.cwd) || '.';
|
|
80
|
-
results.configurationHints.
|
|
80
|
+
results.configurationHints.push({
|
|
81
|
+
type: 'workspace-unconfigured',
|
|
82
|
+
workspaceName: identifier,
|
|
83
|
+
identifier,
|
|
84
|
+
size,
|
|
85
|
+
});
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
}
|
|
@@ -106,7 +111,7 @@ export const printConfigurationHints = ({ cwd, counters, issues, tagHints, confi
|
|
|
106
111
|
const rows = finalizeConfigurationHints({ issues, counters, configurationHints, tagHints, includedWorkspaceDirs, enabledPlugins }, { cwd, configFilePath });
|
|
107
112
|
if (rows.length > 0) {
|
|
108
113
|
const getTitle = isTreatConfigHintsAsErrors ? getColoredTitle : getDimmedTitle;
|
|
109
|
-
console.log(getTitle('Configuration hints', configurationHints.
|
|
114
|
+
console.log(getTitle('Configuration hints', configurationHints.length));
|
|
110
115
|
console.warn(getTableForHints(rows).toString());
|
|
111
116
|
}
|
|
112
117
|
if (tagHints.size > 0) {
|
package/dist/run.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const run: (options: MainOptions) => Promise<{
|
|
|
6
6
|
issues: import("./types/issues.js").Issues;
|
|
7
7
|
counters: import("./types/issues.js").Counters;
|
|
8
8
|
tagHints: Set<import("./types/issues.js").TagHint>;
|
|
9
|
-
configurationHints:
|
|
9
|
+
configurationHints: import("./types/issues.js").ConfigurationHint[];
|
|
10
10
|
includedWorkspaceDirs: string[];
|
|
11
11
|
enabledPlugins: {
|
|
12
12
|
[k: string]: string[];
|
|
@@ -24,7 +24,7 @@ export declare const run: (options: MainOptions) => Promise<{
|
|
|
24
24
|
issues: import("./types/issues.js").Issues;
|
|
25
25
|
counters: import("./types/issues.js").Counters;
|
|
26
26
|
tagHints: Set<import("./types/issues.js").TagHint>;
|
|
27
|
-
configurationHints:
|
|
27
|
+
configurationHints: import("./types/issues.js").ConfigurationHint[];
|
|
28
28
|
};
|
|
29
29
|
} | undefined;
|
|
30
30
|
streamer: ConsoleStreamer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CollectorIssues } from '../IssueCollector.js';
|
|
2
|
-
import { type ProcessedHint } from '../reporters/util/configuration-hints.js';
|
|
3
2
|
import { type Results } from '../run.js';
|
|
4
3
|
import type { MainOptions } from '../util/create-options.js';
|
|
5
4
|
import type { WatchChange } from '../util/watch.js';
|
|
@@ -14,7 +13,6 @@ export interface Session {
|
|
|
14
13
|
handleFileChanges(changes: WatchChange[]): Promise<WatchUpdate>;
|
|
15
14
|
getIssues(): CollectorIssues;
|
|
16
15
|
getResults(): Results;
|
|
17
|
-
getConfigurationHints(): ProcessedHint[];
|
|
18
16
|
describeFile(filePath: string, options?: FileDescriptorOptions): File | undefined;
|
|
19
17
|
describePackageJson(): PackageJsonFile;
|
|
20
18
|
}
|
package/dist/session/session.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { finalizeConfigurationHints } from '../reporters/util/configuration-hints.js';
|
|
2
1
|
import { run } from '../run.js';
|
|
3
2
|
import { buildFileDescriptor } from './file-descriptor.js';
|
|
4
3
|
import { buildPackageJsonDescriptor } from './package-json-descriptor.js';
|
|
@@ -13,7 +12,6 @@ const createSessionAdapter = (session, results, options) => {
|
|
|
13
12
|
handleFileChanges: session.handleFileChanges,
|
|
14
13
|
getIssues: session.getIssues,
|
|
15
14
|
getResults: () => results,
|
|
16
|
-
getConfigurationHints: () => finalizeConfigurationHints(results, options),
|
|
17
15
|
describeFile: (filePath, opts) => buildFileDescriptor(filePath, options.cwd, session.getGraph(), session.getEntryPaths(), opts),
|
|
18
16
|
describePackageJson: () => buildPackageJsonDescriptor(session.getGraph(), session.getEntryPaths()),
|
|
19
17
|
};
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type ReporterOptions = {
|
|
|
54
54
|
issues: Issues;
|
|
55
55
|
counters: Counters;
|
|
56
56
|
tagHints: TagHints;
|
|
57
|
-
configurationHints:
|
|
57
|
+
configurationHints: ConfigurationHint[];
|
|
58
58
|
enabledPlugins: Record<string, string[]>;
|
|
59
59
|
isDisableConfigHints: boolean;
|
|
60
60
|
isTreatConfigHintsAsErrors: boolean;
|
package/dist/util/watch.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare const getSessionHandler: (options: MainOptions, { analyzedFiles,
|
|
|
41
41
|
issues: Issues;
|
|
42
42
|
counters: import("../types/issues.js").Counters;
|
|
43
43
|
tagHints: Set<import("../types/issues.js").TagHint>;
|
|
44
|
-
configurationHints:
|
|
44
|
+
configurationHints: import("../types/issues.js").ConfigurationHint[];
|
|
45
45
|
};
|
|
46
46
|
}>;
|
|
47
47
|
export {};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.77.
|
|
1
|
+
export declare const version = "5.77.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.77.
|
|
1
|
+
export const version = '5.77.3';
|