knip 2.15.2 → 2.15.4
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 +3 -3
- package/dist/DependencyDeputy.d.ts +1 -1
- package/dist/DependencyDeputy.js +3 -3
- package/dist/WorkspaceWorker.d.ts +1 -1
- package/dist/WorkspaceWorker.js +6 -6
- package/dist/constants.js +1 -0
- package/dist/plugins/eslint/helpers.js +11 -2
- package/dist/plugins/eslint/types.d.ts +1 -0
- package/dist/plugins/jest/index.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +28 -0
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ import type { KnipConfig } from 'knip';
|
|
|
103
103
|
|
|
104
104
|
const config: KnipConfig = {
|
|
105
105
|
entry: ['src/index.ts'],
|
|
106
|
-
project: ['src/**/*.ts']
|
|
106
|
+
project: ['src/**/*.ts'],
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
export default config;
|
|
@@ -476,8 +476,8 @@ import { compileSync } from 'mdx-js/mdx';
|
|
|
476
476
|
|
|
477
477
|
export default {
|
|
478
478
|
compilers: {
|
|
479
|
-
mdx: compileSync
|
|
480
|
-
}
|
|
479
|
+
mdx: compileSync,
|
|
480
|
+
},
|
|
481
481
|
};
|
|
482
482
|
```
|
|
483
483
|
|
|
@@ -17,7 +17,7 @@ export declare class DependencyDeputy {
|
|
|
17
17
|
ignoreBinaries: string[];
|
|
18
18
|
ignoreDependencies: string[];
|
|
19
19
|
constructor({ isStrict }: Options);
|
|
20
|
-
addWorkspace({ name, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries }: {
|
|
20
|
+
addWorkspace({ name, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, }: {
|
|
21
21
|
name: string;
|
|
22
22
|
dir: string;
|
|
23
23
|
manifestPath: string;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
|
-
import { IGNORE_DEFINITELY_TYPED, IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES, ROOT_WORKSPACE_NAME } from './constants.js';
|
|
2
|
+
import { IGNORE_DEFINITELY_TYPED, IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES, ROOT_WORKSPACE_NAME, } from './constants.js';
|
|
3
3
|
import { isDefinitelyTyped, getDefinitelyTypedFor, getPackageFromDefinitelyTyped } from './util/modules.js';
|
|
4
4
|
export class DependencyDeputy {
|
|
5
5
|
isStrict;
|
|
@@ -17,7 +17,7 @@ export class DependencyDeputy {
|
|
|
17
17
|
this.peerDependencies = new Map();
|
|
18
18
|
this.installedBinaries = new Map();
|
|
19
19
|
}
|
|
20
|
-
addWorkspace({ name, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries }) {
|
|
20
|
+
addWorkspace({ name, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, }) {
|
|
21
21
|
const scripts = Object.values(manifest.scripts ?? {});
|
|
22
22
|
const dependencies = Object.keys(manifest.dependencies ?? {});
|
|
23
23
|
const peerDependencies = Object.keys(manifest.peerDependencies ?? {});
|
|
@@ -34,7 +34,7 @@ export class DependencyDeputy {
|
|
|
34
34
|
peerDependencies,
|
|
35
35
|
optionalDependencies,
|
|
36
36
|
devDependencies,
|
|
37
|
-
allDependencies
|
|
37
|
+
allDependencies,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
addIgnored(ignoreBinaries, ignoreDependencies) {
|
|
@@ -30,7 +30,7 @@ export declare class WorkspaceWorker {
|
|
|
30
30
|
referencedDependencies: ReferencedDependencies;
|
|
31
31
|
peerDependencies: PeerDependencies;
|
|
32
32
|
installedBinaries: InstalledBinaries;
|
|
33
|
-
constructor({ name, dir, cwd, config, manifest, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors }: WorkspaceManagerOptions);
|
|
33
|
+
constructor({ name, dir, cwd, config, manifest, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }: WorkspaceManagerOptions);
|
|
34
34
|
init(): Promise<void>;
|
|
35
35
|
private setEnabledPlugins;
|
|
36
36
|
private initReferencedDependencies;
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -22,7 +22,7 @@ export class WorkspaceWorker {
|
|
|
22
22
|
referencedDependencies = new Set();
|
|
23
23
|
peerDependencies = new Map();
|
|
24
24
|
installedBinaries = new Map();
|
|
25
|
-
constructor({ name, dir, cwd, config, manifest, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors }) {
|
|
25
|
+
constructor({ name, dir, cwd, config, manifest, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }) {
|
|
26
26
|
this.name = name;
|
|
27
27
|
this.dir = dir;
|
|
28
28
|
this.cwd = cwd;
|
|
@@ -63,7 +63,7 @@ export class WorkspaceWorker {
|
|
|
63
63
|
isProduction: this.isProduction,
|
|
64
64
|
isStrict: this.isStrict,
|
|
65
65
|
dir: this.dir,
|
|
66
|
-
cwd: this.cwd
|
|
66
|
+
cwd: this.cwd,
|
|
67
67
|
});
|
|
68
68
|
const filePath = join(this.dir, 'package.json');
|
|
69
69
|
dependencies.forEach(dependency => this.referencedDependencies.add([filePath, dependency]));
|
|
@@ -92,7 +92,7 @@ export class WorkspaceWorker {
|
|
|
92
92
|
negatedPluginEntryFilePatterns,
|
|
93
93
|
negatedPluginProjectFilePatterns,
|
|
94
94
|
TEST_FILE_PATTERNS,
|
|
95
|
-
this.negatedWorkspacePatterns
|
|
95
|
+
this.negatedWorkspacePatterns,
|
|
96
96
|
].flat();
|
|
97
97
|
}
|
|
98
98
|
getPluginEntryFilePatterns(isIncludeProductionEntryFiles = true) {
|
|
@@ -167,7 +167,7 @@ export class WorkspaceWorker {
|
|
|
167
167
|
negatedPluginEntryFilePatterns,
|
|
168
168
|
negatedPluginProjectFilePatterns,
|
|
169
169
|
negatedTestFilePatterns,
|
|
170
|
-
this.negatedWorkspacePatterns
|
|
170
|
+
this.negatedWorkspacePatterns,
|
|
171
171
|
].flat();
|
|
172
172
|
}
|
|
173
173
|
getProductionPluginEntryFilePatterns() {
|
|
@@ -218,7 +218,7 @@ export class WorkspaceWorker {
|
|
|
218
218
|
cwd,
|
|
219
219
|
manifest: this.manifest,
|
|
220
220
|
config: pluginConfig,
|
|
221
|
-
isProduction: this.isProduction
|
|
221
|
+
isProduction: this.isProduction,
|
|
222
222
|
});
|
|
223
223
|
dependencies.map(toPosix).forEach(specifier => {
|
|
224
224
|
pluginDependencies.add(specifier);
|
|
@@ -237,7 +237,7 @@ export class WorkspaceWorker {
|
|
|
237
237
|
peerDependencies: this.peerDependencies,
|
|
238
238
|
installedBinaries: this.installedBinaries,
|
|
239
239
|
referencedDependencies: this.referencedDependencies,
|
|
240
|
-
enabledPlugins: this.enabledPlugins
|
|
240
|
+
enabledPlugins: this.enabledPlugins,
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
}
|
package/dist/constants.js
CHANGED
|
@@ -6,14 +6,23 @@ import { _resolve } from '../../util/require.js';
|
|
|
6
6
|
import { fallback } from './fallback.js';
|
|
7
7
|
const getDependencies = (config) => {
|
|
8
8
|
const extendsSpecifiers = config.extends ? [config.extends].flat().map(resolveExtendsSpecifier) : [];
|
|
9
|
-
const plugins = config.plugins ? config.plugins.map(resolvePluginPackageName) : [];
|
|
10
9
|
if (extendsSpecifiers.includes('eslint-plugin-prettier'))
|
|
11
10
|
extendsSpecifiers.push('eslint-config-prettier');
|
|
11
|
+
const plugins = config.plugins ? config.plugins.map(resolvePluginPackageName) : [];
|
|
12
12
|
const parser = config.parser;
|
|
13
|
+
const extraPlugins = config.parserOptions?.babelOptions?.plugins ?? [];
|
|
13
14
|
const extraParsers = config.parserOptions?.babelOptions?.presets ?? [];
|
|
14
15
|
const settings = config.settings ? getDependenciesFromSettings(config.settings) : [];
|
|
15
16
|
const overrides = config.overrides ? [config.overrides].flat().flatMap(getDependencies) : [];
|
|
16
|
-
return compact([
|
|
17
|
+
return compact([
|
|
18
|
+
...extendsSpecifiers,
|
|
19
|
+
...plugins,
|
|
20
|
+
...extraPlugins,
|
|
21
|
+
parser,
|
|
22
|
+
...extraParsers,
|
|
23
|
+
...settings,
|
|
24
|
+
...overrides,
|
|
25
|
+
]);
|
|
17
26
|
};
|
|
18
27
|
export const getDependenciesDeep = async (configFilePath, dependencies = new Set(), options) => {
|
|
19
28
|
const addAll = (deps) => deps.forEach(dependency => dependencies.add(dependency));
|
|
@@ -40,9 +40,9 @@ const findJestDependencies = async (configFilePath, { cwd, manifest }) => {
|
|
|
40
40
|
const transform = config.transform
|
|
41
41
|
? Object.values(config.transform).map(transform => (typeof transform === 'string' ? transform : transform[0]))
|
|
42
42
|
: [];
|
|
43
|
-
const moduleNameMapper = config.moduleNameMapper
|
|
43
|
+
const moduleNameMapper = (config.moduleNameMapper
|
|
44
44
|
? Object.values(config.moduleNameMapper).map(mapper => (typeof mapper === 'string' ? mapper : mapper[0]))
|
|
45
|
-
: [];
|
|
45
|
+
: []).filter(value => !/\$[0-9]/.test(value));
|
|
46
46
|
return [
|
|
47
47
|
...presets,
|
|
48
48
|
...environments,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.15.
|
|
1
|
+
export declare const version = "2.15.4";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.15.
|
|
1
|
+
export const version = '2.15.4';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -46,6 +46,34 @@
|
|
|
46
46
|
"examples": ["classMembers", "enumMembers"],
|
|
47
47
|
"$ref": "#/definitions/issueTypes"
|
|
48
48
|
},
|
|
49
|
+
"ignoreExportsUsedInFile": {
|
|
50
|
+
"title": "Ignore exports used in file",
|
|
51
|
+
"examples": [
|
|
52
|
+
{ "ignoreExportsUsedInFile": true },
|
|
53
|
+
{
|
|
54
|
+
"ignoreExportsUsedInFile": {
|
|
55
|
+
"interface": true,
|
|
56
|
+
"type": true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"anyOf": [
|
|
61
|
+
{
|
|
62
|
+
"type": "boolean"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "object",
|
|
66
|
+
"properties": {
|
|
67
|
+
"class": { "type": "boolean" },
|
|
68
|
+
"enum": { "type": "boolean" },
|
|
69
|
+
"function": { "type": "boolean" },
|
|
70
|
+
"interface": { "type": "boolean" },
|
|
71
|
+
"member": { "type": "boolean" },
|
|
72
|
+
"type": { "type": "boolean" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
49
77
|
"workspaces": {
|
|
50
78
|
"title": "Configuration for workspaces",
|
|
51
79
|
"type": "object",
|