knip 5.64.0 → 5.64.2
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/CacheConsultant.js +1 -1
- package/dist/ConfigurationChief.d.ts +10 -10
- package/dist/DependencyDeputy.d.ts +2 -2
- package/dist/DependencyDeputy.js +2 -2
- package/dist/IssueCollector.js +6 -7
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/ProjectPrincipal.js +2 -2
- package/dist/WorkspaceWorker.d.ts +3 -3
- package/dist/WorkspaceWorker.js +2 -2
- package/dist/binaries/index.js +1 -1
- package/dist/cli.js +10 -10
- package/dist/compilers/index.d.ts +37 -30
- package/dist/compilers/index.js +1 -1
- package/dist/graph/build.js +2 -2
- package/dist/index.js +2 -2
- package/dist/manifest/index.js +1 -1
- package/dist/plugins/bumpp/index.js +2 -1
- package/dist/plugins/changelogen/index.js +1 -1
- package/dist/plugins/changelogithub/index.js +1 -1
- package/dist/plugins/commitlint/index.js +1 -1
- package/dist/plugins/eslint/helpers.js +2 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/lint-staged/index.js +1 -1
- package/dist/plugins/linthtml/index.js +1 -1
- package/dist/plugins/lockfile-lint/index.js +1 -1
- package/dist/plugins/next/index.js +2 -1
- package/dist/plugins/node-modules-inspector/index.js +1 -1
- package/dist/plugins/npm-package-json-lint/index.js +1 -1
- package/dist/plugins/postcss/index.js +1 -1
- package/dist/plugins/react-router/index.js +1 -1
- package/dist/plugins/semantic-release/index.js +1 -1
- package/dist/plugins/size-limit/index.js +1 -1
- package/dist/plugins/stylelint/index.js +1 -1
- package/dist/plugins/syncpack/index.js +1 -1
- package/dist/plugins/unocss/index.js +1 -1
- package/dist/plugins/vitest/index.d.ts +3 -0
- package/dist/plugins/vitest/index.js +6 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/schema/configuration.d.ts +1187 -6505
- package/dist/schema/configuration.js +54 -51
- package/dist/schema/plugins.d.ts +579 -2641
- package/dist/schema/plugins.js +4 -4
- package/dist/types/config.d.ts +2 -2
- package/dist/types/issues.d.ts +2 -2
- package/dist/typescript/get-imports-and-exports.js +1 -1
- package/dist/typescript/resolve-module-names.js +1 -1
- package/dist/util/create-options.d.ts +39 -32
- package/dist/util/errors.d.ts +4 -4
- package/dist/util/errors.js +8 -8
- package/dist/util/file-entry-cache.js +1 -1
- package/dist/util/glob-core.js +1 -1
- package/dist/util/glob.js +1 -1
- package/dist/util/input.d.ts +1 -1
- package/dist/util/loader.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +17 -18
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
2
|
import { globSchema, pluginsSchema } from './plugins.js';
|
|
3
3
|
const pathsSchema = z.record(z.string(), z.array(z.string()));
|
|
4
|
-
const syncCompilerSchema = z.union([z.
|
|
5
|
-
const asyncCompilerSchema = z.
|
|
4
|
+
const syncCompilerSchema = z.union([z.literal(true), z.custom()]);
|
|
5
|
+
const asyncCompilerSchema = z.custom();
|
|
6
6
|
const compilerSchema = z.union([syncCompilerSchema, asyncCompilerSchema]);
|
|
7
7
|
const compilersSchema = z.record(z.string(), compilerSchema);
|
|
8
8
|
const stringOrRegexSchema = z.array(z.union([z.string(), z.instanceof(RegExp)]));
|
|
@@ -22,59 +22,62 @@ const issueTypeSchema = z.union([
|
|
|
22
22
|
z.literal('enumMembers'),
|
|
23
23
|
z.literal('classMembers'),
|
|
24
24
|
]);
|
|
25
|
-
const rulesSchema = z.
|
|
26
|
-
const
|
|
27
|
-
z.boolean(),
|
|
28
|
-
z.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
]), z.boolean()),
|
|
36
|
-
]);
|
|
25
|
+
const rulesSchema = z.partialRecord(issueTypeSchema, z.enum(['error', 'warn', 'off']));
|
|
26
|
+
const ignoreExportsUsedInFileObjectSchema = z.strictObject({
|
|
27
|
+
class: z.optional(z.boolean()),
|
|
28
|
+
enum: z.optional(z.boolean()),
|
|
29
|
+
function: z.optional(z.boolean()),
|
|
30
|
+
interface: z.optional(z.boolean()),
|
|
31
|
+
member: z.optional(z.boolean()),
|
|
32
|
+
type: z.optional(z.boolean()),
|
|
33
|
+
});
|
|
34
|
+
const ignoreExportsUsedInFileSchema = z.union([z.boolean(), ignoreExportsUsedInFileObjectSchema]);
|
|
37
35
|
const rootConfigurationSchema = z.object({
|
|
38
|
-
$schema: z.
|
|
39
|
-
rules:
|
|
40
|
-
entry:
|
|
41
|
-
project:
|
|
42
|
-
paths:
|
|
43
|
-
ignore:
|
|
44
|
-
ignoreBinaries:
|
|
45
|
-
ignoreDependencies:
|
|
46
|
-
ignoreMembers:
|
|
47
|
-
ignoreUnresolved:
|
|
48
|
-
ignoreExportsUsedInFile:
|
|
49
|
-
ignoreWorkspaces: z.array(z.string())
|
|
50
|
-
includeEntryExports: z.
|
|
51
|
-
compilers:
|
|
52
|
-
syncCompilers: z.record(z.string(), syncCompilerSchema)
|
|
53
|
-
asyncCompilers: z.record(z.string(), asyncCompilerSchema)
|
|
54
|
-
tags: z.array(z.string())
|
|
55
|
-
treatConfigHintsAsErrors: z.
|
|
36
|
+
$schema: z.optional(z.string()),
|
|
37
|
+
rules: z.optional(rulesSchema),
|
|
38
|
+
entry: z.optional(globSchema),
|
|
39
|
+
project: z.optional(globSchema),
|
|
40
|
+
paths: z.optional(pathsSchema),
|
|
41
|
+
ignore: z.optional(globSchema),
|
|
42
|
+
ignoreBinaries: z.optional(stringOrRegexSchema),
|
|
43
|
+
ignoreDependencies: z.optional(stringOrRegexSchema),
|
|
44
|
+
ignoreMembers: z.optional(stringOrRegexSchema),
|
|
45
|
+
ignoreUnresolved: z.optional(stringOrRegexSchema),
|
|
46
|
+
ignoreExportsUsedInFile: z.optional(ignoreExportsUsedInFileSchema),
|
|
47
|
+
ignoreWorkspaces: z.optional(z.array(z.string())),
|
|
48
|
+
includeEntryExports: z.optional(z.boolean()),
|
|
49
|
+
compilers: z.optional(compilersSchema),
|
|
50
|
+
syncCompilers: z.optional(z.record(z.string(), syncCompilerSchema)),
|
|
51
|
+
asyncCompilers: z.optional(z.record(z.string(), asyncCompilerSchema)),
|
|
52
|
+
tags: z.optional(z.array(z.string())),
|
|
53
|
+
treatConfigHintsAsErrors: z.optional(z.boolean()),
|
|
56
54
|
});
|
|
57
55
|
const reportConfigSchema = z.object({
|
|
58
|
-
include: z.array(issueTypeSchema)
|
|
59
|
-
exclude: z.array(issueTypeSchema)
|
|
56
|
+
include: z.optional(z.array(issueTypeSchema)),
|
|
57
|
+
exclude: z.optional(z.array(issueTypeSchema)),
|
|
60
58
|
});
|
|
61
59
|
const baseWorkspaceConfigurationSchema = z.object({
|
|
62
|
-
entry:
|
|
63
|
-
project:
|
|
64
|
-
paths:
|
|
65
|
-
ignore:
|
|
66
|
-
ignoreBinaries:
|
|
67
|
-
ignoreDependencies:
|
|
68
|
-
ignoreMembers:
|
|
69
|
-
ignoreUnresolved:
|
|
70
|
-
includeEntryExports: z.
|
|
60
|
+
entry: z.optional(globSchema),
|
|
61
|
+
project: z.optional(globSchema),
|
|
62
|
+
paths: z.optional(pathsSchema),
|
|
63
|
+
ignore: z.optional(globSchema),
|
|
64
|
+
ignoreBinaries: z.optional(stringOrRegexSchema),
|
|
65
|
+
ignoreDependencies: z.optional(stringOrRegexSchema),
|
|
66
|
+
ignoreMembers: z.optional(stringOrRegexSchema),
|
|
67
|
+
ignoreUnresolved: z.optional(stringOrRegexSchema),
|
|
68
|
+
includeEntryExports: z.optional(z.boolean()),
|
|
69
|
+
});
|
|
70
|
+
const partialPluginsSchema = z.partial(pluginsSchema);
|
|
71
|
+
const workspaceConfigurationSchema = z.strictObject({
|
|
72
|
+
...baseWorkspaceConfigurationSchema.shape,
|
|
73
|
+
...partialPluginsSchema.shape,
|
|
71
74
|
});
|
|
72
|
-
const workspaceConfigurationSchema = baseWorkspaceConfigurationSchema.merge(pluginsSchema.partial());
|
|
73
75
|
const workspacesConfigurationSchema = z.object({
|
|
74
|
-
workspaces: z.record(z.string(), workspaceConfigurationSchema)
|
|
76
|
+
workspaces: z.optional(z.record(z.string(), workspaceConfigurationSchema)),
|
|
77
|
+
});
|
|
78
|
+
export const knipConfigurationSchema = z.strictObject({
|
|
79
|
+
...rootConfigurationSchema.shape,
|
|
80
|
+
...reportConfigSchema.shape,
|
|
81
|
+
...workspacesConfigurationSchema.shape,
|
|
82
|
+
...partialPluginsSchema.shape,
|
|
75
83
|
});
|
|
76
|
-
export const knipConfigurationSchema = rootConfigurationSchema
|
|
77
|
-
.merge(reportConfigSchema)
|
|
78
|
-
.merge(workspacesConfigurationSchema)
|
|
79
|
-
.merge(pluginsSchema.partial())
|
|
80
|
-
.strict();
|