knip 5.23.3 → 5.24.1
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/ConfigurationValidator.d.ts +9 -9
- package/dist/ConfigurationValidator.js +1 -0
- package/dist/IssueCollector.js +1 -1
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/compilers/index.d.ts +3 -3
- package/dist/plugins/vite/index.js +1 -1
- package/dist/reporters/symbols.js +2 -0
- package/dist/util/empty.d.ts +1 -0
- package/dist/util/empty.js +1 -0
- package/dist/util/plugin.js +1 -5
- package/dist/util/register.js +7 -0
- package/dist/util/require.d.ts +0 -1
- package/dist/util/require.js +0 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ export declare const pluginSchema: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodSt
|
|
|
13
13
|
project?: string | string[] | undefined;
|
|
14
14
|
}>]>;
|
|
15
15
|
export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
16
|
-
rules: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, z.ZodEnum<["error", "warn", "off"]>>>;
|
|
16
|
+
rules: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, z.ZodEnum<["error", "warn", "off"]>>>;
|
|
17
17
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
18
18
|
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
19
19
|
paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
@@ -28,8 +28,8 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
28
28
|
syncCompilers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodString], z.ZodUnknown>, z.ZodString>>>;
|
|
29
29
|
asyncCompilers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodString>>>>;
|
|
30
30
|
}, {
|
|
31
|
-
include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
|
|
32
|
-
exclude: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
|
|
31
|
+
include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
|
|
32
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
|
|
33
33
|
}>, {
|
|
34
34
|
workspaces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
|
|
35
35
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -2474,9 +2474,9 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2474
2474
|
project?: string | string[] | undefined;
|
|
2475
2475
|
}>]>>;
|
|
2476
2476
|
}>, "strip", z.ZodTypeAny, {
|
|
2477
|
-
exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
2478
|
-
include?: ("dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
2479
|
-
rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
2477
|
+
exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
2478
|
+
include?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
2479
|
+
rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
2480
2480
|
entry?: string | string[] | undefined;
|
|
2481
2481
|
project?: string | string[] | undefined;
|
|
2482
2482
|
paths?: Record<string, string[]> | undefined;
|
|
@@ -3171,9 +3171,9 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3171
3171
|
} | undefined;
|
|
3172
3172
|
}> | undefined;
|
|
3173
3173
|
}, {
|
|
3174
|
-
exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
3175
|
-
include?: ("dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
3176
|
-
rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
3174
|
+
exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
3175
|
+
include?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
3176
|
+
rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
3177
3177
|
entry?: string | string[] | undefined;
|
|
3178
3178
|
project?: string | string[] | undefined;
|
|
3179
3179
|
paths?: Record<string, string[]> | undefined;
|
package/dist/IssueCollector.js
CHANGED
|
@@ -40,7 +40,7 @@ export class IssueCollector {
|
|
|
40
40
|
if (this.isMatch(filePath))
|
|
41
41
|
continue;
|
|
42
42
|
this.issues.files.add(filePath);
|
|
43
|
-
this.issues._files.add({ type: 'files', filePath, symbol: relative(filePath) });
|
|
43
|
+
this.issues._files.add({ type: 'files', filePath, symbol: relative(filePath), severity: this.rules.files });
|
|
44
44
|
this.counters.files++;
|
|
45
45
|
this.counters.processed++;
|
|
46
46
|
}
|
|
@@ -32,7 +32,7 @@ export declare class WorkspaceWorker {
|
|
|
32
32
|
isStrict: boolean;
|
|
33
33
|
rootIgnore: Configuration['ignore'];
|
|
34
34
|
negatedWorkspacePatterns: string[];
|
|
35
|
-
enabledPluginsMap: Record<"
|
|
35
|
+
enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
|
|
36
36
|
enabledPlugins: PluginName[];
|
|
37
37
|
enabledPluginsInAncestors: string[];
|
|
38
38
|
cache: CacheConsultant<CacheItem>;
|
|
@@ -52,7 +52,7 @@ export declare class WorkspaceWorker {
|
|
|
52
52
|
entryFilePatterns: Set<string>;
|
|
53
53
|
productionEntryFilePatterns: Set<string>;
|
|
54
54
|
referencedDependencies: ReferencedDependencies;
|
|
55
|
-
enabledPlugins: ("
|
|
55
|
+
enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
|
|
56
56
|
}>;
|
|
57
57
|
onDispose(): void;
|
|
58
58
|
}
|
|
@@ -4,9 +4,9 @@ import type { AsyncCompilerFn, AsyncCompilers, SyncCompilerFn, SyncCompilers } f
|
|
|
4
4
|
export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
5
5
|
syncCompilers: Record<string, SyncCompilerFn>;
|
|
6
6
|
asyncCompilers: Record<string, AsyncCompilerFn>;
|
|
7
|
-
exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
8
|
-
include?: ("dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
9
|
-
rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
7
|
+
exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
8
|
+
include?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
|
|
9
|
+
rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
10
10
|
entry?: string | string[] | undefined;
|
|
11
11
|
project?: string | string[] | undefined;
|
|
12
12
|
paths?: Record<string, string[]> | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasDependency } from '#p/util/plugin.js';
|
|
2
2
|
import { resolveConfig, resolveEntryPaths } from '../vitest/index.js';
|
|
3
3
|
const title = 'Vite';
|
|
4
|
-
const enablers = ['vite'];
|
|
4
|
+
const enablers = ['vite', 'vitest'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
export const config = ['vite*.config.{js,mjs,ts,cjs,mts,cts}'];
|
|
7
7
|
const production = [];
|
|
@@ -36,6 +36,8 @@ export default ({ report, issues, tagHints, configurationHints, noConfigHints, i
|
|
|
36
36
|
const relPath = toRelative(issue.filePath);
|
|
37
37
|
if (issue.isFixed)
|
|
38
38
|
console.log(picocolors.gray(`${relPath} (deleted)`));
|
|
39
|
+
else if (issue.severity === 'warn')
|
|
40
|
+
console.log(picocolors.gray(relPath));
|
|
39
41
|
else
|
|
40
42
|
console.log(relPath);
|
|
41
43
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/util/plugin.js
CHANGED
|
@@ -7,7 +7,6 @@ import { _load as load } from './loader.js';
|
|
|
7
7
|
import { get } from './object.js';
|
|
8
8
|
import { basename } from './path.js';
|
|
9
9
|
import { toEntryPattern, toProductionEntryPattern } from './protocols.js';
|
|
10
|
-
import { _loadESLintConfig as loadESLintConfig } from './require.js';
|
|
11
10
|
export const toCamelCase = (name) => name.toLowerCase().replace(/(-[a-z])/g, group => group.toUpperCase().replace('-', ''));
|
|
12
11
|
export const hasDependency = (dependencies, values) => values.some(value => {
|
|
13
12
|
if (typeof value === 'string') {
|
|
@@ -44,10 +43,7 @@ export const loadConfigForPlugin = async (configFilePath, plugin, options, plugi
|
|
|
44
43
|
? typeof packageJsonPath === 'function'
|
|
45
44
|
? packageJsonPath(manifest)
|
|
46
45
|
: get(manifest, packageJsonPath ?? pluginName)
|
|
47
|
-
:
|
|
48
|
-
plugin.title === 'ESLint' && !/(\.(jsonc?|ya?ml)|rc)$/.test(configFilePath)
|
|
49
|
-
? await loadESLintConfig(configFilePath)
|
|
50
|
-
: await load(configFilePath);
|
|
46
|
+
: await load(configFilePath);
|
|
51
47
|
return localConfig;
|
|
52
48
|
};
|
|
53
49
|
export const getFinalEntryPaths = (plugin, options, configEntryPaths) => {
|
package/dist/util/register.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
1
2
|
import createJITI, {} from 'jiti';
|
|
2
3
|
import { DEFAULT_EXTENSIONS } from '../constants.js';
|
|
4
|
+
import { join } from './path.js';
|
|
5
|
+
const empty = join(fileURLToPath(import.meta.url), '../empty.js');
|
|
3
6
|
const options = {
|
|
4
7
|
interopDefault: true,
|
|
5
8
|
extensions: DEFAULT_EXTENSIONS,
|
|
6
9
|
esmResolve: false,
|
|
10
|
+
alias: {
|
|
11
|
+
'@rushstack/eslint-config/patch/modern-module-resolution': empty,
|
|
12
|
+
'@rushstack/eslint-patch/modern-module-resolution': empty,
|
|
13
|
+
},
|
|
7
14
|
};
|
|
8
15
|
const createLoader = (options) => createJITI(process.cwd(), options);
|
|
9
16
|
export const jitiCJS = createLoader(options);
|
package/dist/util/require.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const _require: NodeRequire;
|
|
2
|
-
export declare const _loadESLintConfig: (configFilePath: string) => any;
|
|
3
2
|
export declare const _resolve: (specifier: string) => string;
|
|
4
3
|
export declare const _tryResolve: (specifier: string, from: string) => string | undefined;
|
|
5
4
|
export declare const _resolveSpecifier: (dir: string, specifier: string) => string | undefined;
|
package/dist/util/require.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRequire as nodeCreateRequire } from 'node:module';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import createJITI from 'jiti';
|
|
4
|
-
import transform from 'jiti/dist/babel.js';
|
|
5
4
|
import { timerify } from './Performance.js';
|
|
6
5
|
import { debugLog } from './debug.js';
|
|
7
6
|
import { getPackageNameFromModuleSpecifier } from './modules.js';
|
|
@@ -32,18 +31,6 @@ const resolveSpecifier = (dir, specifier) => {
|
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
|
-
const rushstackMatch = /require\(("|')@rushstack\/(eslint-config\/patch|eslint-patch)\/modern-module-resolution("|')\)/;
|
|
36
|
-
const jiti = createJITI(process.cwd(), {
|
|
37
|
-
cache: false,
|
|
38
|
-
transform: (opts) => {
|
|
39
|
-
opts.source = opts.source.replace(rushstackMatch, '');
|
|
40
|
-
return transform(opts);
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
const loadESLintConfig = (configFilePath) => {
|
|
44
|
-
return jiti(configFilePath);
|
|
45
|
-
};
|
|
46
|
-
export const _loadESLintConfig = timerify(loadESLintConfig);
|
|
47
34
|
export const _resolve = timerify(resolve);
|
|
48
35
|
export const _tryResolve = timerify(tryResolve);
|
|
49
36
|
export const _resolveSpecifier = timerify(resolveSpecifier);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.24.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.24.1';
|