knip 3.7.0 → 3.7.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.
|
@@ -218,7 +218,9 @@ export class ConfigurationChief {
|
|
|
218
218
|
!micromatch.isMatch(name, this.ignoredWorkspacePatterns)));
|
|
219
219
|
}
|
|
220
220
|
getAvailableWorkspaceNames() {
|
|
221
|
-
return [
|
|
221
|
+
return [
|
|
222
|
+
...new Set([ROOT_WORKSPACE_NAME, ...this.manifestWorkspaces.keys(), ...this.additionalWorkspaceNames]),
|
|
223
|
+
].filter(name => !micromatch.isMatch(name, this.ignoredWorkspacePatterns));
|
|
222
224
|
}
|
|
223
225
|
getAvailableWorkspaceManifests(availableWorkspaceDirs) {
|
|
224
226
|
return availableWorkspaceDirs.map(dir => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compact } from '../../util/array.js';
|
|
2
|
-
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
3
|
-
import { basename, isInternal, dirname, toAbsolute } from '../../util/path.js';
|
|
2
|
+
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
3
|
+
import { basename, isInternal, dirname, toAbsolute, isAbsolute } from '../../util/path.js';
|
|
4
4
|
import { load } from '../../util/plugin.js';
|
|
5
5
|
import { _resolve } from '../../util/require.js';
|
|
6
6
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
@@ -72,10 +72,20 @@ const getDependenciesFromSettings = (settings = {}) => {
|
|
|
72
72
|
if (settingKey === 'import/resolver') {
|
|
73
73
|
return (typeof settings === 'string' ? [settings] : Object.keys(settings))
|
|
74
74
|
.filter(key => key !== 'node')
|
|
75
|
-
.map(key =>
|
|
75
|
+
.map(key => {
|
|
76
|
+
if (isInternal(key))
|
|
77
|
+
return key;
|
|
78
|
+
if (isAbsolute(key))
|
|
79
|
+
return getPackageNameFromFilePath(key);
|
|
80
|
+
return `eslint-import-resolver-${key}`;
|
|
81
|
+
});
|
|
76
82
|
}
|
|
77
83
|
if (settingKey === 'import/parsers') {
|
|
78
|
-
return typeof settings === 'string' ? [settings] : Object.keys(settings)
|
|
84
|
+
return (typeof settings === 'string' ? [settings] : Object.keys(settings)).map(key => {
|
|
85
|
+
if (isAbsolute(key))
|
|
86
|
+
return getPackageNameFromFilePath(key);
|
|
87
|
+
return key;
|
|
88
|
+
});
|
|
79
89
|
}
|
|
80
90
|
});
|
|
81
91
|
};
|
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { importVisitor as visit } from '../index.js';
|
|
3
3
|
const extractImportSpecifiers = (node) => {
|
|
4
|
-
const
|
|
4
|
+
const imports = [];
|
|
5
5
|
function visit(node) {
|
|
6
|
-
if (ts.
|
|
7
|
-
const
|
|
8
|
-
if (ts.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const importClause = arg.argument;
|
|
12
|
-
if (ts.isLiteralTypeNode(importClause) && ts.isStringLiteral(importClause.literal)) {
|
|
13
|
-
importSpecifiers.push(importClause.literal.text);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if (ts.isJSDocTypeTag(node)) {
|
|
20
|
-
const typeNode = node.typeExpression?.type;
|
|
21
|
-
if (ts.isImportTypeNode(typeNode)) {
|
|
22
|
-
const importClause = typeNode.argument;
|
|
23
|
-
if (ts.isLiteralTypeNode(importClause) && ts.isStringLiteral(importClause.literal)) {
|
|
24
|
-
importSpecifiers.push(importClause.literal.text);
|
|
25
|
-
}
|
|
6
|
+
if (ts.isImportTypeNode(node)) {
|
|
7
|
+
const importClause = node.argument;
|
|
8
|
+
if (ts.isLiteralTypeNode(importClause) && ts.isStringLiteral(importClause.literal)) {
|
|
9
|
+
const identifier = node.qualifier && ts.isIdentifier(node.qualifier) ? String(node.qualifier.escapedText) : 'default';
|
|
10
|
+
imports.push({ specifier: importClause.literal.text, identifier });
|
|
26
11
|
}
|
|
27
12
|
}
|
|
28
13
|
ts.forEachChild(node, visit);
|
|
29
14
|
}
|
|
30
15
|
visit(node);
|
|
31
|
-
return
|
|
16
|
+
return imports;
|
|
32
17
|
};
|
|
33
18
|
export default visit(() => true, node => {
|
|
34
19
|
if ('jsDoc' in node && node.jsDoc) {
|
|
35
20
|
const jsDoc = node.jsDoc;
|
|
36
21
|
if (jsDoc.length > 0 && jsDoc[0].parent.parent === node.parent) {
|
|
37
|
-
return jsDoc
|
|
38
|
-
.flatMap(jsDoc => (jsDoc.tags ?? []).flatMap(extractImportSpecifiers))
|
|
39
|
-
.map(specifier => ({ specifier }));
|
|
22
|
+
return jsDoc.flatMap(jsDoc => (jsDoc.tags ?? []).flatMap(extractImportSpecifiers));
|
|
40
23
|
}
|
|
41
24
|
}
|
|
42
25
|
return [];
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.7.
|
|
1
|
+
export declare const version = "3.7.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.7.
|
|
1
|
+
export const version = '3.7.1';
|