knip 5.12.2 → 5.13.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/CacheConsultant.js +2 -1
- package/dist/ConfigurationChief.d.ts +1 -0
- package/dist/ConfigurationValidator.d.ts +435 -375
- package/dist/ConfigurationValidator.js +1 -0
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/compilers/index.d.ts +326 -316
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/xo/index.d.ts +12 -0
- package/dist/plugins/xo/index.js +21 -0
- package/dist/plugins/xo/types.d.ts +12 -0
- package/dist/plugins/xo/types.js +1 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/typescript/SourceFileManager.js +1 -1
- package/dist/util/cli-arguments.d.ts +1 -1
- package/dist/util/cli-arguments.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/schema.json +4 -0
package/dist/plugins/index.d.ts
CHANGED
|
@@ -58,3 +58,4 @@ export { default as webpack } from './webpack/index.js';
|
|
|
58
58
|
export { default as wireit } from './wireit/index.js';
|
|
59
59
|
export { default as wrangler } from './wrangler/index.js';
|
|
60
60
|
export { default as yorkie } from './yorkie/index.js';
|
|
61
|
+
export { default as xo } from './xo/index.js';
|
package/dist/plugins/index.js
CHANGED
|
@@ -58,3 +58,4 @@ export { default as webpack } from './webpack/index.js';
|
|
|
58
58
|
export { default as wireit } from './wireit/index.js';
|
|
59
59
|
export { default as wrangler } from './wrangler/index.js';
|
|
60
60
|
export { default as yorkie } from './yorkie/index.js';
|
|
61
|
+
export { default as xo } from './xo/index.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
|
|
2
|
+
import type { XOConfig } from './types.js';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: import("#p/types/config.js").IgnorePatterns;
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
packageJsonPath: string;
|
|
8
|
+
entry: string[];
|
|
9
|
+
config: string[];
|
|
10
|
+
resolveConfig: ResolveConfig<XOConfig>;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
import { getDependenciesDeep } from '../eslint/helpers.js';
|
|
3
|
+
const title = 'xo';
|
|
4
|
+
const enablers = ['xo'];
|
|
5
|
+
const isEnabled = ({ dependencies, config }) => hasDependency(dependencies, enablers) || 'xo' in config;
|
|
6
|
+
const packageJsonPath = 'xo';
|
|
7
|
+
const config = ['{.,}xo-config.{js,cjs,json,}', 'package.json'];
|
|
8
|
+
const entry = ['{.,}xo-config.{js,cjs}'];
|
|
9
|
+
const resolveConfig = async (config, options) => {
|
|
10
|
+
const dependencies = await getDependenciesDeep(config, options);
|
|
11
|
+
return [...dependencies];
|
|
12
|
+
};
|
|
13
|
+
export default {
|
|
14
|
+
title,
|
|
15
|
+
enablers,
|
|
16
|
+
isEnabled,
|
|
17
|
+
packageJsonPath,
|
|
18
|
+
entry,
|
|
19
|
+
config,
|
|
20
|
+
resolveConfig,
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ESLintConfig } from '../eslint/types.js';
|
|
2
|
+
export type XOConfig = ESLintConfig & {
|
|
3
|
+
envs?: string[] | undefined;
|
|
4
|
+
globals?: string[] | undefined;
|
|
5
|
+
ignores?: string[] | undefined;
|
|
6
|
+
nodeVersion?: string | boolean | undefined;
|
|
7
|
+
prettier?: boolean | undefined;
|
|
8
|
+
printConfig?: string | undefined;
|
|
9
|
+
semicolon?: boolean | undefined;
|
|
10
|
+
space?: boolean | number | undefined;
|
|
11
|
+
webpack?: boolean | object | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Plugin } from './types/plugins.js';
|
|
2
|
-
declare const plugins: 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" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg", Plugin>;
|
|
2
|
+
declare const plugins: 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" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg", Plugin>;
|
|
3
3
|
export { plugins };
|
|
@@ -26,7 +26,7 @@ export class SourceFileManager {
|
|
|
26
26
|
const ext = extname(filePath);
|
|
27
27
|
const compiler = this.syncCompilers.get(ext);
|
|
28
28
|
if (FOREIGN_FILE_EXTENSIONS.has(ext) && !compiler)
|
|
29
|
-
return
|
|
29
|
+
return this.createSourceFile(filePath, '');
|
|
30
30
|
if (this.isSkipLibs && isInNodeModules(filePath)) {
|
|
31
31
|
if (isDeclarationFileExtension(ext))
|
|
32
32
|
return undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const helpText = "\u2702\uFE0F Find unused files, dependencies and exports in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.js, knip.ts or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from dependencies (default: false; implied with classMembers)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --performance Measure count and running time of expensive functions and display stats table\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-knipignore\n\nWebsite: https://knip.dev";
|
|
2
2
|
declare const _default: {
|
|
3
3
|
cache: boolean | undefined;
|
|
4
|
-
|
|
4
|
+
'cache-location': string | undefined;
|
|
5
5
|
config: string | undefined;
|
|
6
6
|
debug: boolean | undefined;
|
|
7
7
|
dependencies: boolean | undefined;
|
|
@@ -57,7 +57,7 @@ try {
|
|
|
57
57
|
parsedArgs = parseArgs({
|
|
58
58
|
options: {
|
|
59
59
|
cache: { type: 'boolean' },
|
|
60
|
-
|
|
60
|
+
'cache-location': { type: 'string' },
|
|
61
61
|
config: { type: 'string', short: 'c' },
|
|
62
62
|
debug: { type: 'boolean', short: 'd' },
|
|
63
63
|
dependencies: { type: 'boolean' },
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.13.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.13.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@jest/types": "^29.6.3",
|
|
84
84
|
"@release-it/bumper": "^6.0.1",
|
|
85
|
-
"@types/bun": "^1.1.
|
|
85
|
+
"@types/bun": "^1.1.1",
|
|
86
86
|
"@types/file-entry-cache": "5.0.4",
|
|
87
87
|
"@types/js-yaml": "^4.0.9",
|
|
88
88
|
"@types/minimist": "^1.2.5",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@types/webpack": "^5.28.5",
|
|
92
92
|
"glob": "^10.3.12",
|
|
93
93
|
"playwright": "^1.43.1",
|
|
94
|
-
"release-it": "^17.2.
|
|
94
|
+
"release-it": "^17.2.1",
|
|
95
95
|
"type-fest": "^4.17.0",
|
|
96
96
|
"typescript": "^5.4.2"
|
|
97
97
|
},
|
package/schema.json
CHANGED
|
@@ -507,6 +507,10 @@
|
|
|
507
507
|
"title": "wrangler plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/wrangler/README.md)",
|
|
508
508
|
"$ref": "#/definitions/plugin"
|
|
509
509
|
},
|
|
510
|
+
"xo": {
|
|
511
|
+
"title": "xo plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/xo/README.md)",
|
|
512
|
+
"$ref": "#/definitions/plugin"
|
|
513
|
+
},
|
|
510
514
|
"yorkie": {
|
|
511
515
|
"title": "yorkie plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/yorkie/README.md)",
|
|
512
516
|
"$ref": "#/definitions/plugin"
|