knip 5.30.2 → 5.30.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/README.md +1 -1
- package/dist/ConfigurationChief.js +1 -1
- package/dist/ConfigurationValidator.d.ts +6 -6
- package/dist/IssueFixer.js +2 -2
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/compilers/index.d.ts +1 -1
- package/dist/plugins/eslint/index.js +1 -1
- package/dist/plugins/vitest/index.js +1 -1
- package/dist/util/to-source-path.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -42,6 +42,6 @@ Special thanks to the wonderful people who have contributed to this project:
|
|
|
42
42
|
[4]: https://discord.gg/r5uXTtbTpc
|
|
43
43
|
[5]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
|
|
44
44
|
[6]: https://knip.dev/sponsors
|
|
45
|
-
[7]: https://
|
|
45
|
+
[7]: https://www.youtube.com/watch?v=PE7h7KvQoUI&t=9s
|
|
46
46
|
[8]: https://github.com/webpro-nl/knip/graphs/contributors
|
|
47
47
|
[9]: https://contrib.rocks/image?repo=webpro-nl/knip
|
|
@@ -185,7 +185,7 @@ export class ConfigurationChief {
|
|
|
185
185
|
const workspaces = this.manifest?.workspaces
|
|
186
186
|
? Array.isArray(this.manifest.workspaces)
|
|
187
187
|
? this.manifest.workspaces
|
|
188
|
-
: this.manifest.workspaces.packages ?? []
|
|
188
|
+
: (this.manifest.workspaces.packages ?? [])
|
|
189
189
|
: [];
|
|
190
190
|
return workspaces.map(pattern => pattern.replace(/(?<=!?)\.\//, ''));
|
|
191
191
|
}
|
|
@@ -2775,9 +2775,9 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2775
2775
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
2776
2776
|
ignoreWorkspaces?: string[] | undefined;
|
|
2777
2777
|
includeEntryExports?: boolean | undefined;
|
|
2778
|
-
compilers?: Record<string, ((args_0: string, args_1: string, ...
|
|
2779
|
-
syncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
2780
|
-
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
2778
|
+
compilers?: Record<string, ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
|
|
2779
|
+
syncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => string> | undefined;
|
|
2780
|
+
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => Promise<string>> | undefined;
|
|
2781
2781
|
astro?: string | boolean | string[] | {
|
|
2782
2782
|
config?: string | string[] | undefined;
|
|
2783
2783
|
entry?: string | string[] | undefined;
|
|
@@ -3552,9 +3552,9 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3552
3552
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
3553
3553
|
ignoreWorkspaces?: string[] | undefined;
|
|
3554
3554
|
includeEntryExports?: boolean | undefined;
|
|
3555
|
-
compilers?: Record<string, ((args_0: string, args_1: string, ...
|
|
3556
|
-
syncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
3557
|
-
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
3555
|
+
compilers?: Record<string, ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
|
|
3556
|
+
syncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => string> | undefined;
|
|
3557
|
+
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => Promise<string>> | undefined;
|
|
3558
3558
|
astro?: string | boolean | string[] | {
|
|
3559
3559
|
config?: string | string[] | undefined;
|
|
3560
3560
|
entry?: string | string[] | undefined;
|
package/dist/IssueFixer.js
CHANGED
|
@@ -65,8 +65,8 @@ export class IssueFixer {
|
|
|
65
65
|
const filePaths = new Set([...this.unusedTypeNodes.keys(), ...this.unusedExportNodes.keys()]);
|
|
66
66
|
for (const filePath of filePaths) {
|
|
67
67
|
const exportPositions = [
|
|
68
|
-
...(this.isFixUnusedTypes ? this.unusedTypeNodes.get(filePath) ?? [] : []),
|
|
69
|
-
...(this.isFixUnusedExports ? this.unusedExportNodes.get(filePath) ?? [] : []),
|
|
68
|
+
...(this.isFixUnusedTypes ? (this.unusedTypeNodes.get(filePath) ?? []) : []),
|
|
69
|
+
...(this.isFixUnusedExports ? (this.unusedExportNodes.get(filePath) ?? []) : []),
|
|
70
70
|
].sort((a, b) => b[0] - a[0]);
|
|
71
71
|
if (exportPositions.length > 0) {
|
|
72
72
|
const sourceFileText = exportPositions.reduce((text, [start, end]) => text.substring(0, start) + text.substring(end), await readFile(filePath, 'utf-8'));
|
|
@@ -34,7 +34,7 @@ export declare class WorkspaceWorker {
|
|
|
34
34
|
isStrict: boolean;
|
|
35
35
|
rootIgnore: Configuration['ignore'];
|
|
36
36
|
negatedWorkspacePatterns: string[];
|
|
37
|
-
enabledPluginsMap: Record<"
|
|
37
|
+
enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "nest" | "netlify" | "next" | "nuxt" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "preconstruct" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vike" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
|
|
38
38
|
enabledPlugins: PluginName[];
|
|
39
39
|
enabledPluginsInAncestors: string[];
|
|
40
40
|
cache: CacheConsultant<CacheItem>;
|
|
@@ -55,7 +55,7 @@ export declare class WorkspaceWorker {
|
|
|
55
55
|
entryFilePatterns: Set<string>;
|
|
56
56
|
productionEntryFilePatterns: Set<string>;
|
|
57
57
|
referencedDependencies: ReferencedDependencies;
|
|
58
|
-
enabledPlugins: ("
|
|
58
|
+
enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "nest" | "netlify" | "next" | "nuxt" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "preconstruct" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vike" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
|
|
59
59
|
}>;
|
|
60
60
|
onDispose(): void;
|
|
61
61
|
}
|
|
@@ -17,7 +17,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
17
17
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
18
18
|
ignoreWorkspaces?: string[] | undefined;
|
|
19
19
|
includeEntryExports?: boolean | undefined;
|
|
20
|
-
compilers?: Record<string, ((args_0: string, args_1: string, ...
|
|
20
|
+
compilers?: Record<string, ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
|
|
21
21
|
astro?: string | boolean | string[] | {
|
|
22
22
|
config?: string | string[] | undefined;
|
|
23
23
|
entry?: string | string[] | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasDependency } from '#p/util/plugin.js';
|
|
2
2
|
import { getDependenciesDeep } from './helpers.js';
|
|
3
3
|
const title = 'ESLint';
|
|
4
|
-
const enablers = ['eslint'];
|
|
4
|
+
const enablers = ['eslint', '@eslint/js'];
|
|
5
5
|
const isEnabled = ({ dependencies, manifest, config }) => hasDependency(dependencies, enablers) ||
|
|
6
6
|
'eslint' in config ||
|
|
7
7
|
Boolean(manifest.name && /(^eslint-config|\/eslint-config)/.test(manifest.name));
|
|
@@ -5,7 +5,7 @@ import { getEnvPackageName, getExternalReporters } from './helpers.js';
|
|
|
5
5
|
const title = 'Vitest';
|
|
6
6
|
const enablers = ['vitest'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
-
const config = ['vitest*.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{ts,
|
|
8
|
+
const config = ['vitest*.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{js,mjs,ts,cjs,mts,cts,json}'];
|
|
9
9
|
const entry = ['**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)'];
|
|
10
10
|
const isVitestCoverageCommand = /vitest(.+)--coverage(?:\.enabled(?:=true)?)?/;
|
|
11
11
|
const hasScriptWithCoverage = (scripts) => scripts
|
|
@@ -9,7 +9,7 @@ const hasTSExt = /(?<!\.d)\.(m|c)?tsx?$/;
|
|
|
9
9
|
const matchExt = /(\.d)?\.(m|c)?(j|t)s$/;
|
|
10
10
|
export const augmentWorkspace = (workspace, dir, compilerOptions) => {
|
|
11
11
|
const srcDir = join(dir, 'src');
|
|
12
|
-
workspace.srcDir = compilerOptions.rootDir ?? isDirectory(srcDir) ? srcDir : dir;
|
|
12
|
+
workspace.srcDir = (compilerOptions.rootDir ?? isDirectory(srcDir)) ? srcDir : dir;
|
|
13
13
|
workspace.outDir = compilerOptions.outDir || workspace.srcDir;
|
|
14
14
|
};
|
|
15
15
|
export const getToSourcePathHandler = (chief) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.30.
|
|
1
|
+
export declare const version = "5.30.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.30.
|
|
1
|
+
export const version = '5.30.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.30.
|
|
3
|
+
"version": "5.30.3",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"picocolors": "^1.0.0",
|
|
73
73
|
"picomatch": "^4.0.1",
|
|
74
74
|
"pretty-ms": "^9.0.0",
|
|
75
|
-
"smol-toml": "^1.
|
|
75
|
+
"smol-toml": "^1.3.0",
|
|
76
76
|
"strip-json-comments": "5.0.1",
|
|
77
77
|
"summary": "2.1.0",
|
|
78
78
|
"zod": "^3.22.4",
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@jest/types": "^29.6.3",
|
|
87
87
|
"@release-it/bumper": "^6.0.1",
|
|
88
|
-
"@types/bun": "^1.1.
|
|
88
|
+
"@types/bun": "^1.1.10",
|
|
89
89
|
"@types/js-yaml": "^4.0.9",
|
|
90
90
|
"@types/minimist": "^1.2.5",
|
|
91
|
-
"@types/picomatch": "
|
|
91
|
+
"@types/picomatch": "3.0.1",
|
|
92
92
|
"@types/webpack": "^5.28.5",
|
|
93
|
-
"@wdio/types": "^
|
|
93
|
+
"@wdio/types": "^9.0.8",
|
|
94
94
|
"glob": "^10.4.2",
|
|
95
|
-
"release-it": "^17.
|
|
95
|
+
"release-it": "^17.6.0",
|
|
96
96
|
"type-fest": "^4.20.0",
|
|
97
97
|
"typescript": "^5.5.2"
|
|
98
98
|
},
|