knip 5.28.0 → 5.29.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/constants.js +52 -1
- package/dist/plugins/eslint/helpers.js +3 -1
- package/dist/plugins/nuxt/index.d.ts +1 -0
- package/dist/plugins/nuxt/index.js +3 -0
- package/dist/plugins/nx/index.js +4 -3
- package/dist/plugins/release-it/index.js +1 -1
- package/dist/types/plugins.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/constants.js
CHANGED
|
@@ -20,51 +20,102 @@ export const ALIAS_TAG = '@alias';
|
|
|
20
20
|
export const DT_SCOPE = '@types';
|
|
21
21
|
export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
22
22
|
'aws',
|
|
23
|
+
'base64',
|
|
24
|
+
'basename',
|
|
23
25
|
'bash',
|
|
24
26
|
'bun',
|
|
25
27
|
'bundle',
|
|
26
28
|
'bunx',
|
|
27
29
|
'cat',
|
|
28
30
|
'cd',
|
|
31
|
+
'chown',
|
|
29
32
|
'chmod',
|
|
33
|
+
'cksum',
|
|
34
|
+
'comm',
|
|
30
35
|
'command',
|
|
31
36
|
'corepack',
|
|
32
37
|
'cp',
|
|
33
38
|
'curl',
|
|
39
|
+
'cut',
|
|
34
40
|
'deno',
|
|
41
|
+
'df',
|
|
42
|
+
'dir',
|
|
35
43
|
'dirname',
|
|
36
44
|
'docker',
|
|
37
45
|
'echo',
|
|
38
46
|
'env',
|
|
39
47
|
'exec',
|
|
40
48
|
'exit',
|
|
49
|
+
'expand',
|
|
50
|
+
'expr',
|
|
51
|
+
'factor',
|
|
52
|
+
'false',
|
|
41
53
|
'find',
|
|
42
54
|
'gem',
|
|
43
55
|
'git',
|
|
44
56
|
'grep',
|
|
57
|
+
'groups',
|
|
45
58
|
'gzip',
|
|
59
|
+
'head',
|
|
60
|
+
'id',
|
|
61
|
+
'join',
|
|
46
62
|
'kill',
|
|
47
63
|
'ln',
|
|
64
|
+
'logname',
|
|
48
65
|
'ls',
|
|
66
|
+
'md5sum',
|
|
49
67
|
'mkdir',
|
|
68
|
+
'mknod',
|
|
50
69
|
'mv',
|
|
70
|
+
'nice',
|
|
71
|
+
'nl',
|
|
72
|
+
'nohup',
|
|
51
73
|
'node',
|
|
52
74
|
'npm',
|
|
75
|
+
'nproc',
|
|
53
76
|
'npx',
|
|
77
|
+
'paste',
|
|
54
78
|
'pnpm',
|
|
55
79
|
'pnpx',
|
|
80
|
+
'pr',
|
|
81
|
+
'printenv',
|
|
82
|
+
'pwd',
|
|
56
83
|
'rm',
|
|
84
|
+
'rmdir',
|
|
85
|
+
'seq',
|
|
57
86
|
'set',
|
|
87
|
+
'sha1sum',
|
|
88
|
+
'sha512sum',
|
|
58
89
|
'sh',
|
|
90
|
+
'shred',
|
|
91
|
+
'shuf',
|
|
92
|
+
'sort',
|
|
93
|
+
'split',
|
|
59
94
|
'ssh',
|
|
95
|
+
'stat',
|
|
96
|
+
'stty',
|
|
60
97
|
'sudo',
|
|
98
|
+
'sync',
|
|
99
|
+
'tac',
|
|
100
|
+
'tee',
|
|
61
101
|
'test',
|
|
102
|
+
'timeout',
|
|
62
103
|
'touch',
|
|
104
|
+
'tr',
|
|
63
105
|
'true',
|
|
64
|
-
'
|
|
106
|
+
'tsort',
|
|
107
|
+
'tty',
|
|
108
|
+
'uname',
|
|
109
|
+
'unexpand',
|
|
110
|
+
'uniq',
|
|
111
|
+
'wc',
|
|
112
|
+
'who',
|
|
113
|
+
'whoami',
|
|
65
114
|
'xargs',
|
|
66
115
|
'xcodebuild',
|
|
67
116
|
'xvfb-run',
|
|
117
|
+
'yarn',
|
|
118
|
+
'yes',
|
|
68
119
|
]);
|
|
69
120
|
export const IGNORED_DEPENDENCIES = new Set(['knip', 'typescript']);
|
|
70
121
|
export const IGNORED_RUNTIME_DEPENDENCIES = new Set(['bun']);
|
|
@@ -13,8 +13,9 @@ const getDependencies = (config) => {
|
|
|
13
13
|
? getDependenciesFromConfig(config.parserOptions.babelOptions)
|
|
14
14
|
: [];
|
|
15
15
|
const settings = config.settings ? getDependenciesFromSettings(config.settings) : [];
|
|
16
|
+
const rules = getDependenciesFromRules(config.rules);
|
|
16
17
|
const overrides = config.overrides ? [config.overrides].flat().flatMap(getDependencies) : [];
|
|
17
|
-
return compact([...extendsSpecifiers, ...plugins, parser, ...babelDependencies, ...settings, ...overrides]);
|
|
18
|
+
return compact([...extendsSpecifiers, ...plugins, parser, ...babelDependencies, ...settings, ...rules, ...overrides]);
|
|
18
19
|
};
|
|
19
20
|
export const getDependenciesDeep = async (localConfig, options, dependencies = new Set()) => {
|
|
20
21
|
const { configFileDir } = options;
|
|
@@ -66,6 +67,7 @@ const resolveExtendSpecifier = (specifier) => {
|
|
|
66
67
|
const namespace = specifier.startsWith('plugin:') ? 'eslint-plugin' : 'eslint-config';
|
|
67
68
|
return resolveSpecifier(namespace, specifier);
|
|
68
69
|
};
|
|
70
|
+
const getDependenciesFromRules = (rules = {}) => Object.keys(rules).flatMap(ruleKey => ruleKey.includes('/') ? [resolveSpecifier('eslint-plugin', ruleKey.split('/').slice(0, -1).join('/'))] : []);
|
|
69
71
|
const getDependenciesFromSettings = (settings = {}) => {
|
|
70
72
|
return Object.entries(settings).flatMap(([settingKey, settings]) => {
|
|
71
73
|
if (settingKey === 'import/resolver') {
|
|
@@ -2,6 +2,8 @@ import { join } from '#p/util/path.js';
|
|
|
2
2
|
import { hasDependency } from '#p/util/plugin.js';
|
|
3
3
|
import { toProductionEntryPattern } from '#p/util/protocols.js';
|
|
4
4
|
const title = 'Nuxt';
|
|
5
|
+
const note = `Knip works best with [explicit imports](https://nuxt.com/docs/guide/concepts/auto-imports#explicit-imports).
|
|
6
|
+
Nuxt allows to [disable auto-imports](https://nuxt.com/docs/guide/concepts/auto-imports#disabling-auto-imports).`;
|
|
5
7
|
const enablers = ['nuxt'];
|
|
6
8
|
const isEnabled = ({ dependencies }) => {
|
|
7
9
|
const isEnabled = hasDependency(dependencies, enablers);
|
|
@@ -38,6 +40,7 @@ const resolveEntryPaths = async (localConfig) => {
|
|
|
38
40
|
};
|
|
39
41
|
export default {
|
|
40
42
|
title,
|
|
43
|
+
note,
|
|
41
44
|
enablers,
|
|
42
45
|
isEnabled,
|
|
43
46
|
entry,
|
package/dist/plugins/nx/index.js
CHANGED
|
@@ -13,14 +13,15 @@ const findNxDependenciesInNxJson = async (localConfig) => {
|
|
|
13
13
|
: [];
|
|
14
14
|
const plugins = localConfig.plugins && Array.isArray(localConfig.plugins)
|
|
15
15
|
? localConfig.plugins
|
|
16
|
-
.map(
|
|
17
|
-
.map(
|
|
16
|
+
.map(value => (typeof value === 'string' ? value : value.plugin))
|
|
17
|
+
.map(value => getPackageNameFromModuleSpecifier(value))
|
|
18
18
|
.filter(value => value !== undefined)
|
|
19
19
|
: [];
|
|
20
20
|
const generators = localConfig.generators
|
|
21
21
|
? Object.keys(localConfig.generators)
|
|
22
|
-
.map(
|
|
22
|
+
.map(value => getPackageNameFromModuleSpecifier(value))
|
|
23
23
|
.filter(value => value !== undefined)
|
|
24
|
+
.map(value => value.split(':')[0])
|
|
24
25
|
: [];
|
|
25
26
|
return compact([...targetsDefault, ...plugins, ...generators]);
|
|
26
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDependenciesFromScripts, hasDependency } from '#p/util/plugin.js';
|
|
2
|
-
const title = 'Release It';
|
|
2
|
+
const title = 'Release It!';
|
|
3
3
|
const enablers = ['release-it'];
|
|
4
4
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
5
|
const packageJsonPath = 'release-it';
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export type Resolve = (options: PluginOptions) => Promise<string[]> | string[];
|
|
|
28
28
|
export interface Plugin {
|
|
29
29
|
title: string;
|
|
30
30
|
enablers: IgnorePatterns | string;
|
|
31
|
+
note?: string;
|
|
31
32
|
packageJsonPath?: string | ((manifest: PackageJson) => string);
|
|
32
33
|
isEnabled: IsPluginEnabled;
|
|
33
34
|
config?: string[];
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.29.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.29.0';
|