knip 5.42.3 → 5.43.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 +1 -0
- package/dist/ConfigurationChief.js +4 -2
- package/dist/ConfigurationValidator.d.ts +8 -0
- package/dist/ConfigurationValidator.js +2 -0
- package/dist/DependencyDeputy.d.ts +5 -1
- package/dist/DependencyDeputy.js +26 -1
- package/dist/compilers/index.d.ts +2 -0
- package/dist/index.js +1 -2
- package/dist/plugins/metro/index.js +1 -1
- package/dist/types/issues.d.ts +1 -1
- package/dist/types/workspace.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -68,6 +68,7 @@ export declare class ConfigurationChief {
|
|
|
68
68
|
getIgnores(workspaceName: string): {
|
|
69
69
|
ignoreBinaries: any[];
|
|
70
70
|
ignoreDependencies: any[];
|
|
71
|
+
ignoreUnresolved: any[];
|
|
71
72
|
};
|
|
72
73
|
getConfigForWorkspace(workspaceName: string, extensions?: string[]): {
|
|
73
74
|
node?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -312,14 +312,16 @@ export class ConfigurationChief {
|
|
|
312
312
|
const workspaceConfig = this.getWorkspaceConfig(workspaceName);
|
|
313
313
|
const ignoreBinaries = arrayify(workspaceConfig.ignoreBinaries);
|
|
314
314
|
const ignoreDependencies = arrayify(workspaceConfig.ignoreDependencies);
|
|
315
|
+
const ignoreUnresolved = arrayify(workspaceConfig.ignoreUnresolved);
|
|
315
316
|
if (workspaceName === ROOT_WORKSPACE_NAME) {
|
|
316
|
-
const { ignoreBinaries: rootIgnoreBinaries, ignoreDependencies: rootIgnoreDependencies } = this.rawConfig ?? {};
|
|
317
|
+
const { ignoreBinaries: rootIgnoreBinaries, ignoreDependencies: rootIgnoreDependencies, ignoreUnresolved: rootIgnoreUnresolved, } = this.rawConfig ?? {};
|
|
317
318
|
return {
|
|
318
319
|
ignoreBinaries: compact([...ignoreBinaries, ...(rootIgnoreBinaries ?? [])]),
|
|
319
320
|
ignoreDependencies: compact([...ignoreDependencies, ...(rootIgnoreDependencies ?? [])]),
|
|
321
|
+
ignoreUnresolved: compact([...ignoreUnresolved, ...(rootIgnoreUnresolved ?? [])]),
|
|
320
322
|
};
|
|
321
323
|
}
|
|
322
|
-
return { ignoreBinaries, ignoreDependencies };
|
|
324
|
+
return { ignoreBinaries, ignoreDependencies, ignoreUnresolved };
|
|
323
325
|
}
|
|
324
326
|
getConfigForWorkspace(workspaceName, extensions) {
|
|
325
327
|
const baseConfig = getDefaultWorkspaceConfig(extensions);
|
|
@@ -8,6 +8,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
8
8
|
ignoreBinaries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
9
9
|
ignoreDependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
10
10
|
ignoreMembers: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
11
|
+
ignoreUnresolved: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
11
12
|
ignoreExportsUsedInFile: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"class">, z.ZodLiteral<"enum">, z.ZodLiteral<"function">, z.ZodLiteral<"interface">, z.ZodLiteral<"member">, z.ZodLiteral<"type">]>, z.ZodBoolean>]>>;
|
|
12
13
|
ignoreWorkspaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
14
|
includeEntryExports: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -26,6 +27,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
26
27
|
ignoreBinaries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
27
28
|
ignoreDependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
28
29
|
ignoreMembers: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
30
|
+
ignoreUnresolved: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
29
31
|
includeEntryExports: z.ZodOptional<z.ZodBoolean>;
|
|
30
32
|
}, {
|
|
31
33
|
angular: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
@@ -1674,6 +1676,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1674
1676
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
1675
1677
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
1676
1678
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
1679
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1677
1680
|
includeEntryExports?: boolean | undefined;
|
|
1678
1681
|
}, {
|
|
1679
1682
|
node?: string | boolean | string[] | {
|
|
@@ -2138,6 +2141,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2138
2141
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
2139
2142
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
2140
2143
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
2144
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
2141
2145
|
includeEntryExports?: boolean | undefined;
|
|
2142
2146
|
}>>>;
|
|
2143
2147
|
}>, {
|
|
@@ -3790,6 +3794,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3790
3794
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
3791
3795
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
3792
3796
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
3797
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
3793
3798
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
3794
3799
|
ignoreWorkspaces?: string[] | undefined;
|
|
3795
3800
|
includeEntryExports?: boolean | undefined;
|
|
@@ -4259,6 +4264,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4259
4264
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
4260
4265
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
4261
4266
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
4267
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
4262
4268
|
includeEntryExports?: boolean | undefined;
|
|
4263
4269
|
}> | undefined;
|
|
4264
4270
|
}, {
|
|
@@ -4727,6 +4733,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4727
4733
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
4728
4734
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
4729
4735
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
4736
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
4730
4737
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
4731
4738
|
ignoreWorkspaces?: string[] | undefined;
|
|
4732
4739
|
includeEntryExports?: boolean | undefined;
|
|
@@ -5196,6 +5203,7 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
5196
5203
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
5197
5204
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
5198
5205
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
5206
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
5199
5207
|
includeEntryExports?: boolean | undefined;
|
|
5200
5208
|
}> | undefined;
|
|
5201
5209
|
}>;
|
|
@@ -43,6 +43,7 @@ const rootConfigurationSchema = z.object({
|
|
|
43
43
|
ignoreBinaries: stringOrRegexSchema.optional(),
|
|
44
44
|
ignoreDependencies: stringOrRegexSchema.optional(),
|
|
45
45
|
ignoreMembers: stringOrRegexSchema.optional(),
|
|
46
|
+
ignoreUnresolved: stringOrRegexSchema.optional(),
|
|
46
47
|
ignoreExportsUsedInFile: ignoreExportsUsedInFileSchema.optional(),
|
|
47
48
|
ignoreWorkspaces: z.array(z.string()).optional(),
|
|
48
49
|
includeEntryExports: z.boolean().optional(),
|
|
@@ -62,6 +63,7 @@ const baseWorkspaceConfigurationSchema = z.object({
|
|
|
62
63
|
ignoreBinaries: stringOrRegexSchema.optional(),
|
|
63
64
|
ignoreDependencies: stringOrRegexSchema.optional(),
|
|
64
65
|
ignoreMembers: stringOrRegexSchema.optional(),
|
|
66
|
+
ignoreUnresolved: stringOrRegexSchema.optional(),
|
|
65
67
|
includeEntryExports: z.boolean().optional(),
|
|
66
68
|
});
|
|
67
69
|
const workspaceConfigurationSchema = baseWorkspaceConfigurationSchema.merge(pluginsSchema.partial());
|
|
@@ -16,7 +16,7 @@ export declare class DependencyDeputy {
|
|
|
16
16
|
installedBinaries: Map<string, InstalledBinaries>;
|
|
17
17
|
hasTypesIncluded: Map<string, Set<string>>;
|
|
18
18
|
constructor({ isProduction, isStrict }: Options);
|
|
19
|
-
addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, }: {
|
|
19
|
+
addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, ignoreUnresolved, }: {
|
|
20
20
|
name: string;
|
|
21
21
|
cwd: string;
|
|
22
22
|
dir: string;
|
|
@@ -24,6 +24,7 @@ export declare class DependencyDeputy {
|
|
|
24
24
|
manifest: PackageJson;
|
|
25
25
|
ignoreDependencies: (string | RegExp)[];
|
|
26
26
|
ignoreBinaries: (string | RegExp)[];
|
|
27
|
+
ignoreUnresolved: (string | RegExp)[];
|
|
27
28
|
}): void;
|
|
28
29
|
getWorkspaceManifest(workspaceName: string): {
|
|
29
30
|
workspaceDir: string;
|
|
@@ -35,8 +36,10 @@ export declare class DependencyDeputy {
|
|
|
35
36
|
allDependencies: DependencySet;
|
|
36
37
|
ignoreDependencies: (string | RegExp)[];
|
|
37
38
|
ignoreBinaries: (string | RegExp)[];
|
|
39
|
+
ignoreUnresolved: (string | RegExp)[];
|
|
38
40
|
usedIgnoreDependencies: Set<string | RegExp>;
|
|
39
41
|
usedIgnoreBinaries: Set<string | RegExp>;
|
|
42
|
+
usedIgnoreUnresolved: Set<string | RegExp>;
|
|
40
43
|
} | undefined;
|
|
41
44
|
getProductionDependencies(workspaceName: string): DependencyArray;
|
|
42
45
|
getDevDependencies(workspaceName: string): DependencyArray;
|
|
@@ -63,6 +66,7 @@ export declare class DependencyDeputy {
|
|
|
63
66
|
};
|
|
64
67
|
handleIgnoredDependencies(issues: Issues, counters: Counters, type: SymbolIssueType): void;
|
|
65
68
|
handleIgnoredBinaries(issues: Issues, counters: Counters, type: SymbolIssueType): void;
|
|
69
|
+
handleIgnoredUnresolved(issues: Issues, counters: Counters): void;
|
|
66
70
|
removeIgnoredIssues({ issues, counters }: {
|
|
67
71
|
issues: Issues;
|
|
68
72
|
counters: Counters;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -21,7 +21,7 @@ export class DependencyDeputy {
|
|
|
21
21
|
this.installedBinaries = new Map();
|
|
22
22
|
this.hasTypesIncluded = new Map();
|
|
23
23
|
}
|
|
24
|
-
addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, }) {
|
|
24
|
+
addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, ignoreUnresolved, }) {
|
|
25
25
|
const dependencies = Object.keys(manifest.dependencies ?? {});
|
|
26
26
|
const peerDependencies = Object.keys(manifest.peerDependencies ?? {});
|
|
27
27
|
const optionalDependencies = Object.keys(manifest.optionalDependencies ?? {});
|
|
@@ -50,8 +50,10 @@ export class DependencyDeputy {
|
|
|
50
50
|
manifestPath,
|
|
51
51
|
ignoreDependencies: ignoreDependencies.map(toRegexOrString),
|
|
52
52
|
ignoreBinaries: ignoreBinaries.map(toRegexOrString),
|
|
53
|
+
ignoreUnresolved: ignoreUnresolved.map(toRegexOrString),
|
|
53
54
|
usedIgnoreDependencies: new Set(),
|
|
54
55
|
usedIgnoreBinaries: new Set(),
|
|
56
|
+
usedIgnoreUnresolved: new Set(),
|
|
55
57
|
dependencies,
|
|
56
58
|
devDependencies,
|
|
57
59
|
peerDependencies: new Set(peerDependencies),
|
|
@@ -284,6 +286,23 @@ export class DependencyDeputy {
|
|
|
284
286
|
}
|
|
285
287
|
}
|
|
286
288
|
}
|
|
289
|
+
handleIgnoredUnresolved(issues, counters) {
|
|
290
|
+
for (const key in issues.unresolved) {
|
|
291
|
+
const issueSet = issues.unresolved[key];
|
|
292
|
+
for (const issueKey in issueSet) {
|
|
293
|
+
const issue = issueSet[issueKey];
|
|
294
|
+
const manifest = this.getWorkspaceManifest(issue.workspace);
|
|
295
|
+
if (manifest) {
|
|
296
|
+
const ignoreItem = findMatch(manifest.ignoreUnresolved, issue.symbol);
|
|
297
|
+
if (ignoreItem) {
|
|
298
|
+
delete issueSet[issueKey];
|
|
299
|
+
counters.unresolved--;
|
|
300
|
+
manifest.usedIgnoreUnresolved.add(ignoreItem);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
287
306
|
removeIgnoredIssues({ issues, counters }) {
|
|
288
307
|
this.handleIgnoredDependencies(issues, counters, 'dependencies');
|
|
289
308
|
this.handleIgnoredDependencies(issues, counters, 'devDependencies');
|
|
@@ -291,6 +310,7 @@ export class DependencyDeputy {
|
|
|
291
310
|
this.handleIgnoredDependencies(issues, counters, 'unlisted');
|
|
292
311
|
this.handleIgnoredDependencies(issues, counters, 'unresolved');
|
|
293
312
|
this.handleIgnoredBinaries(issues, counters, 'binaries');
|
|
313
|
+
this.handleIgnoredUnresolved(issues, counters);
|
|
294
314
|
}
|
|
295
315
|
getConfigurationHints() {
|
|
296
316
|
const configurationHints = new Set();
|
|
@@ -305,6 +325,11 @@ export class DependencyDeputy {
|
|
|
305
325
|
configurationHints.add({ workspaceName, identifier, type: 'ignoreBinaries' });
|
|
306
326
|
}
|
|
307
327
|
}
|
|
328
|
+
for (const identifier of manifest.ignoreUnresolved) {
|
|
329
|
+
if (!manifest.usedIgnoreUnresolved.has(identifier)) {
|
|
330
|
+
configurationHints.add({ workspaceName, identifier, type: 'ignoreUnresolved' });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
308
333
|
}
|
|
309
334
|
return configurationHints;
|
|
310
335
|
}
|
|
@@ -469,6 +469,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
469
469
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
470
470
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
471
471
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
472
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
472
473
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
473
474
|
ignoreWorkspaces?: string[] | undefined;
|
|
474
475
|
includeEntryExports?: boolean | undefined;
|
|
@@ -936,6 +937,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
936
937
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
937
938
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
938
939
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
940
|
+
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
939
941
|
includeEntryExports?: boolean | undefined;
|
|
940
942
|
}> | undefined;
|
|
941
943
|
};
|
package/dist/index.js
CHANGED
|
@@ -68,8 +68,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
68
68
|
const manifest = chief.getManifestForWorkspace(name);
|
|
69
69
|
if (!manifest)
|
|
70
70
|
continue;
|
|
71
|
-
|
|
72
|
-
deputy.addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreBinaries, ignoreDependencies });
|
|
71
|
+
deputy.addWorkspace({ name, cwd, dir, manifestPath, manifest, ...chief.getIgnores(name) });
|
|
73
72
|
}
|
|
74
73
|
for (const workspace of workspaces) {
|
|
75
74
|
const { name, dir, ancestors, pkgName } = workspace;
|
|
@@ -35,7 +35,7 @@ const resolveConfig = async (config) => {
|
|
|
35
35
|
return [...inputs].map(toDeferResolve);
|
|
36
36
|
};
|
|
37
37
|
const note = `False positives for platform-specific unused files?
|
|
38
|
-
Override the entry patterns
|
|
38
|
+
Override the default \`entry\` patterns to match platforms and extensions.`;
|
|
39
39
|
export const docs = { note, production };
|
|
40
40
|
export default {
|
|
41
41
|
title,
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export type IssueSeverity = 'error' | 'warn' | 'off';
|
|
|
72
72
|
export type Rules = Record<IssueType, IssueSeverity>;
|
|
73
73
|
export type ConfigurationHints = Set<ConfigurationHint>;
|
|
74
74
|
export type ConfigurationHint = {
|
|
75
|
-
type: 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreWorkspaces';
|
|
75
|
+
type: 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'ignoreWorkspaces';
|
|
76
76
|
identifier: string | RegExp;
|
|
77
77
|
workspaceName?: string;
|
|
78
78
|
};
|
|
@@ -10,8 +10,10 @@ type WorkspaceManifest = {
|
|
|
10
10
|
allDependencies: DependencySet;
|
|
11
11
|
ignoreDependencies: (string | RegExp)[];
|
|
12
12
|
ignoreBinaries: (string | RegExp)[];
|
|
13
|
+
ignoreUnresolved: (string | RegExp)[];
|
|
13
14
|
usedIgnoreDependencies: Set<string | RegExp>;
|
|
14
15
|
usedIgnoreBinaries: Set<string | RegExp>;
|
|
16
|
+
usedIgnoreUnresolved: Set<string | RegExp>;
|
|
15
17
|
};
|
|
16
18
|
export type WorkspaceManifests = Map<string, WorkspaceManifest>;
|
|
17
19
|
export type HostDependencies = Map<string, Array<{
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.43.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.43.0';
|