knip 6.44.2 → 6.45.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/ConfigurationChief.d.ts +23 -1033
- package/dist/ConfigurationChief.js +71 -15
- package/dist/DependencyDeputy.d.ts +10 -6
- package/dist/DependencyDeputy.js +51 -27
- package/dist/IssueCollector.d.ts +14 -11
- package/dist/IssueCollector.js +25 -20
- package/dist/IssueFixer.js +1 -1
- package/dist/PackagePeeker.d.ts +6 -0
- package/dist/PackagePeeker.js +43 -14
- package/dist/ProjectPrincipal.d.ts +6 -3
- package/dist/ProjectPrincipal.js +83 -32
- package/dist/WorkspaceWorker.d.ts +5 -1
- package/dist/WorkspaceWorker.js +39 -22
- package/dist/binaries/bash-parser.js +1 -7
- package/dist/binaries/command.d.ts +3 -3
- package/dist/binaries/command.js +6 -2
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/plugins.d.ts +4 -1
- package/dist/binaries/plugins.js +66 -18
- package/dist/binaries/resolvers/npm.js +7 -5
- package/dist/binaries/resolvers/npx.js +8 -40
- package/dist/binaries/util.d.ts +13 -1
- package/dist/binaries/util.js +35 -1
- package/dist/cli.js +10 -84
- package/dist/configuration-hints.d.ts +16 -0
- package/dist/configuration-hints.js +64 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -0
- package/dist/graph/SubpathReferences.d.ts +33 -0
- package/dist/graph/SubpathReferences.js +114 -0
- package/dist/graph/analyze.d.ts +4 -1
- package/dist/graph/analyze.js +16 -5
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +47 -23
- package/dist/graph-explorer/operations/resolve-export-origins.js +1 -1
- package/dist/plugins/angular/index.js +10 -17
- package/dist/plugins/aws-cdk/index.d.ts +3 -0
- package/dist/plugins/aws-cdk/index.js +32 -0
- package/dist/plugins/aws-cdk/types.d.ts +5 -0
- package/dist/plugins/aws-cdk/types.js +1 -0
- package/dist/plugins/babel/index.d.ts +1 -1
- package/dist/plugins/babel/index.js +19 -5
- package/dist/plugins/bun/index.js +8 -7
- package/dist/plugins/c8/index.js +17 -4
- package/dist/plugins/changesets/index.js +3 -2
- package/dist/plugins/commitizen/index.js +6 -3
- package/dist/plugins/commitlint/index.js +10 -11
- package/dist/plugins/cypress/index.js +4 -2
- package/dist/plugins/danger/index.js +1 -1
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +2 -2
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +2 -2
- package/dist/plugins/eleventy/index.js +3 -2
- package/dist/plugins/eslint/helpers.js +4 -3
- package/dist/plugins/eslint/resolveFromAST.js +2 -2
- package/dist/plugins/evalite/index.d.ts +3 -0
- package/dist/plugins/evalite/index.js +26 -0
- package/dist/plugins/flue/index.js +2 -2
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/github-actions/index.js +2 -2
- package/dist/plugins/graphql-codegen/index.js +13 -9
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/jest/index.js +5 -5
- package/dist/plugins/knex/index.js +2 -2
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/lunaria/index.js +5 -2
- package/dist/plugins/markdownlint/index.js +8 -2
- package/dist/plugins/marko/index.js +2 -2
- package/dist/plugins/marko/taglibs.d.ts +1 -1
- package/dist/plugins/marko/taglibs.js +4 -28
- package/dist/plugins/mdx/index.d.ts +2 -1
- package/dist/plugins/mdx/index.js +7 -4
- package/dist/plugins/mdxlint/index.js +18 -15
- package/dist/plugins/mikro-orm/index.d.ts +3 -0
- package/dist/plugins/mikro-orm/index.js +77 -0
- package/dist/plugins/mikro-orm/types.d.ts +21 -0
- package/dist/plugins/mikro-orm/types.js +1 -0
- package/dist/plugins/msw/index.js +6 -3
- package/dist/plugins/msw/types.d.ts +1 -1
- package/dist/plugins/netlify/index.js +7 -3
- package/dist/plugins/next/index.js +63 -9
- package/dist/plugins/next/types.d.ts +5 -0
- package/dist/plugins/next-mdx/resolveFromAST.js +15 -10
- package/dist/plugins/nitro/index.js +5 -6
- package/dist/plugins/node/index.js +4 -4
- package/dist/plugins/npm-package-json-lint/index.js +10 -3
- package/dist/plugins/nuxt/index.js +18 -10
- package/dist/plugins/nuxt/types.d.ts +4 -0
- package/dist/plugins/nx/index.js +6 -3
- package/dist/plugins/openclaw/index.js +11 -11
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/panda-css/index.js +5 -0
- package/dist/plugins/payload/index.js +1 -1
- package/dist/plugins/playwright/index.js +3 -3
- package/dist/plugins/pm2/index.js +7 -7
- package/dist/plugins/prettier/index.js +2 -1
- package/dist/plugins/prisma/index.js +2 -2
- package/dist/plugins/quasar/resolveFromAST.js +14 -9
- package/dist/plugins/react-router/index.js +2 -2
- package/dist/plugins/release-it/index.js +6 -2
- package/dist/plugins/remix/index.js +3 -3
- package/dist/plugins/retry-cli/index.d.ts +3 -0
- package/dist/plugins/retry-cli/index.js +14 -0
- package/dist/plugins/rollup/index.js +1 -4
- package/dist/plugins/rstest/index.js +3 -3
- package/dist/plugins/semantic-release/index.js +3 -3
- package/dist/plugins/serverless-framework/index.js +10 -8
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/swc/index.js +4 -3
- package/dist/plugins/tailwind/index.js +2 -2
- package/dist/plugins/tanstack-router/index.js +2 -2
- package/dist/plugins/ts-node/index.js +6 -1
- package/dist/plugins/turbo/index.js +3 -3
- package/dist/plugins/typedoc/index.js +2 -2
- package/dist/plugins/typescript/content-mappers.d.ts +1 -1
- package/dist/plugins/typescript/index.js +6 -9
- package/dist/plugins/varlock/scan.js +1 -1
- package/dist/plugins/vite/helpers.d.ts +1 -0
- package/dist/plugins/vite/helpers.js +13 -3
- package/dist/plugins/vite/index.js +5 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vitest/index.js +14 -16
- package/dist/plugins/vue/index.js +1 -1
- package/dist/plugins/web-test-runner/index.d.ts +3 -0
- package/dist/plugins/web-test-runner/index.js +86 -0
- package/dist/plugins/webdriver-io/index.js +22 -17
- package/dist/plugins/webdriver-io/types.d.ts +3 -2
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/plugins.js +2 -5
- package/dist/reporters/github-actions.js +3 -7
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/util/configuration-hints.d.ts +3 -1
- package/dist/reporters/util/configuration-hints.js +40 -21
- package/dist/reporters/util/util.d.ts +1 -1
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +82 -0
- package/dist/run.js +12 -0
- package/dist/session/incremental.d.ts +1 -0
- package/dist/session/incremental.js +1 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/watch.js +2 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +5 -0
- package/dist/types/args.d.ts +3 -1
- package/dist/types/config.d.ts +17 -10
- package/dist/types/configuration.d.ts +45 -0
- package/dist/types/configuration.js +1 -0
- package/dist/types/issues.d.ts +4 -0
- package/dist/types/module-graph.d.ts +1 -0
- package/dist/types/options.d.ts +1 -0
- package/dist/types/package-json.d.ts +3 -8
- package/dist/types/workspace.d.ts +1 -0
- package/dist/typescript/ast-nodes.js +47 -1
- package/dist/typescript/get-imports-and-exports.js +18 -6
- package/dist/typescript/resolve-module-names.js +7 -45
- package/dist/typescript/visitors/calls.d.ts +1 -1
- package/dist/typescript/visitors/calls.js +14 -10
- package/dist/typescript/visitors/exports.js +16 -26
- package/dist/typescript/visitors/imports.d.ts +2 -1
- package/dist/typescript/visitors/imports.js +41 -24
- package/dist/typescript/visitors/members.d.ts +1 -1
- package/dist/typescript/visitors/members.js +38 -24
- package/dist/typescript/visitors/shadow.d.ts +2 -0
- package/dist/typescript/visitors/shadow.js +25 -0
- package/dist/typescript/visitors/walk.d.ts +20 -12
- package/dist/typescript/visitors/walk.js +78 -48
- package/dist/util/Performance.d.ts +25 -3
- package/dist/util/Performance.js +51 -27
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +4 -2
- package/dist/util/create-input-handler.js +138 -119
- package/dist/util/create-options.d.ts +4 -2071
- package/dist/util/create-options.js +6 -4
- package/dist/util/create-workspace-graph.js +2 -1
- package/dist/util/errors.d.ts +5 -2
- package/dist/util/errors.js +11 -18
- package/dist/util/fs.js +4 -2
- package/dist/util/get-included-issue-types.js +1 -0
- package/dist/util/input.d.ts +2 -2
- package/dist/util/input.js +2 -2
- package/dist/util/is-plugin-name.d.ts +2 -0
- package/dist/util/is-plugin-name.js +3 -0
- package/dist/util/jiti.d.ts +2 -1
- package/dist/util/jiti.js +10 -3
- package/dist/util/load-config.d.ts +1 -1
- package/dist/util/load-config.js +3 -2
- package/dist/util/loader.js +3 -2
- package/dist/util/map-workspaces.js +23 -1
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.d.ts +2 -0
- package/dist/util/modules.js +78 -0
- package/dist/util/package-json.d.ts +12 -5
- package/dist/util/package-json.js +54 -26
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +5 -5
- package/dist/util/parse-configuration.d.ts +2 -0
- package/dist/util/parse-configuration.js +66 -0
- package/dist/util/plugin.js +8 -12
- package/dist/util/regex.js +10 -1
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/resolve.js +3 -2
- package/dist/util/scripts.d.ts +0 -5
- package/dist/util/scripts.js +1 -32
- package/dist/util/to-source-path.d.ts +4 -1
- package/dist/util/to-source-path.js +2 -2
- package/dist/util/unhandled-rejection.d.ts +8 -0
- package/dist/util/unhandled-rejection.js +29 -0
- package/dist/util/validation.d.ts +11 -0
- package/dist/util/validation.js +68 -0
- package/dist/util/watch.d.ts +3 -1
- package/dist/util/watch.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -7
- package/schema.json +34 -0
- package/dist/schema/configuration.d.ts +0 -3103
- package/dist/schema/configuration.js +0 -94
- package/dist/schema/plugins.d.ts +0 -1019
- package/dist/schema/plugins.js +0 -215
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import picomatch from 'picomatch';
|
|
2
2
|
import { normalizeCompilers } from './compilers/index.js';
|
|
3
3
|
import { DEFAULT_EXTENSIONS, ROOT_WORKSPACE_NAME } from './constants.js';
|
|
4
|
-
import { pluginNames } from './types/PluginNames.js';
|
|
5
4
|
import { arrayify, compact, partition } from './util/array.js';
|
|
6
5
|
import { createWorkspaceGraph } from './util/create-workspace-graph.js';
|
|
7
6
|
import { isDirectory, isFile } from './util/fs.js';
|
|
8
7
|
import { _dirGlob, prependDirToPattern, removeProductionSuffix } from './util/glob.js';
|
|
9
8
|
import { graphSequencer } from './util/graph-sequencer.js';
|
|
9
|
+
import { isPluginName } from './util/is-plugin-name.js';
|
|
10
10
|
import mapWorkspaces from './util/map-workspaces.js';
|
|
11
11
|
import { join, relative } from './util/path.js';
|
|
12
12
|
import { normalizePluginConfig } from './util/plugin.js';
|
|
@@ -29,7 +29,6 @@ const getDefaultWorkspaceConfig = (extensions = []) => {
|
|
|
29
29
|
project: [`**/*.{${exts}}!`],
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
const isPluginName = (name) => pluginNames.includes(name);
|
|
33
32
|
const defaultConfig = {
|
|
34
33
|
ignore: [],
|
|
35
34
|
ignoreBinaries: [],
|
|
@@ -43,15 +42,25 @@ const defaultConfig = {
|
|
|
43
42
|
ignoreWorkspaces: [],
|
|
44
43
|
ignoreExportsUsedInFile: false,
|
|
45
44
|
isIncludeEntryExports: false,
|
|
45
|
+
isIncludeSubpathExports: false,
|
|
46
46
|
compilers: new Map(),
|
|
47
47
|
rootPluginConfigs: {},
|
|
48
48
|
};
|
|
49
|
+
const toIgnoreItems = (values, configKey) => {
|
|
50
|
+
const items = [];
|
|
51
|
+
if (values)
|
|
52
|
+
for (const value of values)
|
|
53
|
+
if (value)
|
|
54
|
+
items.push({ value, configKey });
|
|
55
|
+
return items;
|
|
56
|
+
};
|
|
49
57
|
export class ConfigurationChief {
|
|
50
58
|
cwd;
|
|
51
59
|
rawConfig;
|
|
52
60
|
isProduction;
|
|
53
61
|
isStrict;
|
|
54
62
|
isIncludeEntryExports;
|
|
63
|
+
isIncludeSubpathExports;
|
|
55
64
|
config;
|
|
56
65
|
workspace;
|
|
57
66
|
selectedWorkspaces;
|
|
@@ -64,6 +73,7 @@ export class ConfigurationChief {
|
|
|
64
73
|
additionalWorkspaceNames = new Set();
|
|
65
74
|
availableWorkspaceNames = [];
|
|
66
75
|
availableWorkspacePkgNames = new Set();
|
|
76
|
+
workspaceAliasNames = new Set();
|
|
67
77
|
availableWorkspaceDirs = [];
|
|
68
78
|
availableWorkspaceDirsWithSlash = [];
|
|
69
79
|
workspaceGraph = new Map();
|
|
@@ -73,6 +83,7 @@ export class ConfigurationChief {
|
|
|
73
83
|
this.isProduction = options.isProduction;
|
|
74
84
|
this.isStrict = options.isStrict;
|
|
75
85
|
this.isIncludeEntryExports = options.isIncludeEntryExports;
|
|
86
|
+
this.isIncludeSubpathExports = options.isIncludeSubpathExports;
|
|
76
87
|
this.workspace = options.workspace;
|
|
77
88
|
this.workspaces = options.workspaces;
|
|
78
89
|
this.rawConfig = options.parsedConfig;
|
|
@@ -110,9 +121,10 @@ export class ConfigurationChief {
|
|
|
110
121
|
const ignoreIssues = rawConfig.ignoreIssues ?? {};
|
|
111
122
|
const ignoreWorkspaces = rawConfig.ignoreWorkspaces ?? defaultConfig.ignoreWorkspaces;
|
|
112
123
|
const isIncludeEntryExports = rawConfig.includeEntryExports ?? this.isIncludeEntryExports;
|
|
124
|
+
const isIncludeSubpathExports = rawConfig.includeSubpathExports ?? this.isIncludeSubpathExports;
|
|
113
125
|
const rootPluginConfigs = {};
|
|
114
126
|
for (const [pluginName, pluginConfig] of Object.entries(rawConfig)) {
|
|
115
|
-
if (isPluginName(pluginName)) {
|
|
127
|
+
if (isPluginName(pluginName) && pluginConfig !== undefined) {
|
|
116
128
|
rootPluginConfigs[pluginName] = normalizePluginConfig(pluginConfig);
|
|
117
129
|
}
|
|
118
130
|
}
|
|
@@ -129,6 +141,7 @@ export class ConfigurationChief {
|
|
|
129
141
|
ignoreIssues,
|
|
130
142
|
ignoreWorkspaces,
|
|
131
143
|
isIncludeEntryExports,
|
|
144
|
+
isIncludeSubpathExports,
|
|
132
145
|
compilers: normalizeCompilers(rawConfig),
|
|
133
146
|
rootPluginConfigs,
|
|
134
147
|
};
|
|
@@ -139,6 +152,9 @@ export class ConfigurationChief {
|
|
|
139
152
|
const workspaceNames = compact([...this.getListedWorkspaces(), ...this.additionalWorkspaceNames]);
|
|
140
153
|
const [packages, wsPkgNames] = await mapWorkspaces(this.cwd, [...workspaceNames, '.']);
|
|
141
154
|
this.workspacePackages = packages;
|
|
155
|
+
for (const pkg of packages.values())
|
|
156
|
+
for (const alias of pkg.aliases.keys())
|
|
157
|
+
this.workspaceAliasNames.add(alias);
|
|
142
158
|
this.availableWorkspaceNames = this.getAvailableWorkspaceNames(packages.keys());
|
|
143
159
|
this.availableWorkspacePkgNames = wsPkgNames;
|
|
144
160
|
this.availableWorkspaceDirs = this.availableWorkspaceNames
|
|
@@ -204,6 +220,16 @@ export class ConfigurationChief {
|
|
|
204
220
|
const selectedWorkspaces = this.selectedWorkspaces;
|
|
205
221
|
const isAncestor = (name, ancestor) => ancestor !== name && (ancestor === ROOT_WORKSPACE_NAME || name.startsWith(`${ancestor}/`));
|
|
206
222
|
const getAncestors = (name) => this.availableWorkspaceNames.filter(a => isAncestor(name, a));
|
|
223
|
+
const getAliases = (name, ancestors) => {
|
|
224
|
+
const aliases = new Map();
|
|
225
|
+
for (const workspaceName of ancestors.toSorted(byPathDepth).concat(name)) {
|
|
226
|
+
const pkg = this.workspacePackages.get(workspaceName);
|
|
227
|
+
if (pkg)
|
|
228
|
+
for (const [alias, pkgName] of pkg.aliases)
|
|
229
|
+
aliases.set(alias, pkgName);
|
|
230
|
+
}
|
|
231
|
+
return aliases;
|
|
232
|
+
};
|
|
207
233
|
const workspaceNames = selectedWorkspaces
|
|
208
234
|
? Array.from(selectedWorkspaces).flatMap(name => [...getAncestors(name), name])
|
|
209
235
|
: this.availableWorkspaceNames;
|
|
@@ -245,15 +271,18 @@ export class ConfigurationChief {
|
|
|
245
271
|
const manifestStr = pkg?.manifestStr ?? '';
|
|
246
272
|
const workspaceConfig = this.getWorkspaceConfig(name);
|
|
247
273
|
const ignoreMembers = workspaceConfig.ignoreMembers?.map(toRegexOrString) ?? [];
|
|
274
|
+
const ancestors = getAncestors(name);
|
|
248
275
|
return {
|
|
249
276
|
name,
|
|
250
277
|
pkgName,
|
|
251
278
|
dir,
|
|
252
279
|
config: this.getConfigForWorkspace(name),
|
|
253
|
-
ancestors
|
|
280
|
+
ancestors,
|
|
281
|
+
aliases: getAliases(name, ancestors),
|
|
254
282
|
manifestPath,
|
|
255
283
|
manifestStr,
|
|
256
284
|
ignoreMembers,
|
|
285
|
+
configKey: this.getConfigKey(name),
|
|
257
286
|
};
|
|
258
287
|
});
|
|
259
288
|
}
|
|
@@ -285,6 +314,21 @@ export class ConfigurationChief {
|
|
|
285
314
|
.map(workspaceName => workspaceName.replace(matchName, ''))
|
|
286
315
|
.map(workspaceName => `!${workspaceName.replace(endMatch, '/**')}`);
|
|
287
316
|
}
|
|
317
|
+
countWorkspacesForConfigKey(configKey) {
|
|
318
|
+
let count = 0;
|
|
319
|
+
for (const workspace of this.workspacesByDir.values())
|
|
320
|
+
if (workspace.configKey === configKey)
|
|
321
|
+
count++;
|
|
322
|
+
return count;
|
|
323
|
+
}
|
|
324
|
+
getConfigKey(workspaceName) {
|
|
325
|
+
if (workspaceName === ROOT_WORKSPACE_NAME) {
|
|
326
|
+
const workspaces = this.rawConfig?.workspaces;
|
|
327
|
+
return workspaces && ROOT_WORKSPACE_NAME in workspaces ? ROOT_WORKSPACE_NAME : undefined;
|
|
328
|
+
}
|
|
329
|
+
const key = this.getConfigKeyForWorkspace(workspaceName);
|
|
330
|
+
return key !== workspaceName ? key : undefined;
|
|
331
|
+
}
|
|
288
332
|
getConfigKeyForWorkspace(workspaceName) {
|
|
289
333
|
return this.getConfiguredWorkspaceKeys()
|
|
290
334
|
.sort(byPathDepth)
|
|
@@ -308,16 +352,14 @@ export class ConfigurationChief {
|
|
|
308
352
|
}
|
|
309
353
|
getIgnores(workspaceName) {
|
|
310
354
|
const workspaceConfig = this.getWorkspaceConfig(workspaceName);
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
ignoreUnresolved: compact([...ignoreUnresolved, ...(rootIgnoreUnresolved ?? [])]),
|
|
320
|
-
};
|
|
355
|
+
const configKey = this.getConfigKey(workspaceName);
|
|
356
|
+
const ignoreBinaries = toIgnoreItems(workspaceConfig.ignoreBinaries, configKey);
|
|
357
|
+
const ignoreDependencies = toIgnoreItems(workspaceConfig.ignoreDependencies, configKey);
|
|
358
|
+
const ignoreUnresolved = toIgnoreItems(workspaceConfig.ignoreUnresolved, configKey);
|
|
359
|
+
if (workspaceName === ROOT_WORKSPACE_NAME && this.rawConfig && workspaceConfig !== this.rawConfig) {
|
|
360
|
+
ignoreBinaries.push(...toIgnoreItems(this.rawConfig.ignoreBinaries));
|
|
361
|
+
ignoreDependencies.push(...toIgnoreItems(this.rawConfig.ignoreDependencies));
|
|
362
|
+
ignoreUnresolved.push(...toIgnoreItems(this.rawConfig.ignoreUnresolved));
|
|
321
363
|
}
|
|
322
364
|
return { ignoreBinaries, ignoreDependencies, ignoreUnresolved };
|
|
323
365
|
}
|
|
@@ -347,13 +389,15 @@ export class ConfigurationChief {
|
|
|
347
389
|
const ignoreGlobalBinaries = workspaceConfig.ignoreGlobalBinaries ?? this.config.ignoreGlobalBinaries;
|
|
348
390
|
const ignoreExportsUsedInFile = workspaceConfig.ignoreExportsUsedInFile ?? this.config.ignoreExportsUsedInFile;
|
|
349
391
|
const isIncludeEntryExports = workspaceConfig.includeEntryExports ?? this.config.isIncludeEntryExports;
|
|
392
|
+
const isIncludeSubpathExports = !(this.isStrict && this.selectedWorkspaces) &&
|
|
393
|
+
(workspaceConfig.includeSubpathExports ?? this.config.isIncludeSubpathExports);
|
|
350
394
|
const plugins = {};
|
|
351
395
|
for (const [pluginName, pluginConfig] of Object.entries(this.config.rootPluginConfigs)) {
|
|
352
396
|
if (typeof pluginConfig !== 'undefined')
|
|
353
397
|
plugins[pluginName] = pluginConfig;
|
|
354
398
|
}
|
|
355
399
|
for (const [pluginName, pluginConfig] of Object.entries(workspaceConfig)) {
|
|
356
|
-
if (isPluginName(pluginName)) {
|
|
400
|
+
if (isPluginName(pluginName) && pluginConfig !== undefined) {
|
|
357
401
|
plugins[pluginName] = normalizePluginConfig(pluginConfig);
|
|
358
402
|
}
|
|
359
403
|
}
|
|
@@ -366,9 +410,21 @@ export class ConfigurationChief {
|
|
|
366
410
|
ignoreGlobalBinaries,
|
|
367
411
|
ignoreExportsUsedInFile,
|
|
368
412
|
isIncludeEntryExports,
|
|
413
|
+
isIncludeSubpathExports,
|
|
369
414
|
...plugins,
|
|
370
415
|
};
|
|
371
416
|
}
|
|
417
|
+
isWorkspacePackageName(packageName) {
|
|
418
|
+
return this.availableWorkspacePkgNames.has(packageName) || this.workspaceAliasNames.has(packageName);
|
|
419
|
+
}
|
|
420
|
+
findWorkspaceByPackageName(packageName, filePath) {
|
|
421
|
+
const workspace = this.workspacesByPkgName.get(packageName);
|
|
422
|
+
if (workspace || !this.workspaceAliasNames.has(packageName))
|
|
423
|
+
return workspace;
|
|
424
|
+
const pkgName = this.findWorkspaceByFilePath(filePath)?.aliases.get(packageName);
|
|
425
|
+
if (pkgName)
|
|
426
|
+
return this.workspacesByPkgName.get(pkgName);
|
|
427
|
+
}
|
|
372
428
|
findWorkspaceByFilePath(filePath) {
|
|
373
429
|
if (this.workspaceByFileCache.has(filePath))
|
|
374
430
|
return this.workspaceByFileCache.get(filePath);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Workspace } from './ConfigurationChief.ts';
|
|
1
|
+
import type { IgnoreItem, Workspace } from './ConfigurationChief.ts';
|
|
2
2
|
import type { ConfigurationHint, Counters, Issue, Issues, IssueType } from './types/issues.ts';
|
|
3
3
|
import type { PackageJson } from './types/package-json.ts';
|
|
4
4
|
import type { DependencyArray, DependencySet, HostDependencies, InstalledBinaries, WorkspaceManifests } from './types/workspace.ts';
|
|
@@ -10,6 +10,7 @@ interface DependencyReferenceOptions {
|
|
|
10
10
|
isResolved?: boolean;
|
|
11
11
|
isPublishedType?: boolean;
|
|
12
12
|
isCaught?: boolean;
|
|
13
|
+
isDevelopment?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare class DependencyDeputy {
|
|
15
16
|
isProduction: boolean;
|
|
@@ -28,9 +29,9 @@ export declare class DependencyDeputy {
|
|
|
28
29
|
manifestPath: string;
|
|
29
30
|
manifestStr: string;
|
|
30
31
|
manifest: PackageJson;
|
|
31
|
-
ignoreDependencies:
|
|
32
|
-
ignoreBinaries:
|
|
33
|
-
ignoreUnresolved:
|
|
32
|
+
ignoreDependencies: IgnoreItem[];
|
|
33
|
+
ignoreBinaries: IgnoreItem[];
|
|
34
|
+
ignoreUnresolved: IgnoreItem[];
|
|
34
35
|
}): void;
|
|
35
36
|
getWorkspaceManifest(workspaceName: string): {
|
|
36
37
|
workspaceDir: string;
|
|
@@ -51,21 +52,24 @@ export declare class DependencyDeputy {
|
|
|
51
52
|
unusedIgnoreDependencies: Set<string | RegExp>;
|
|
52
53
|
unusedIgnoreBinaries: Set<string | RegExp>;
|
|
53
54
|
unusedIgnoreUnresolved: Set<string | RegExp>;
|
|
55
|
+
ignoreConfigKeys: Record<'ignoreDependencies' | 'ignoreBinaries' | 'ignoreUnresolved', Map<string | RegExp, string | undefined>>;
|
|
54
56
|
} | undefined;
|
|
55
57
|
setWorkspacePkgNames(pkgNames: Iterable<string>): void;
|
|
56
58
|
getProductionDependencies(workspaceName: string): DependencyArray;
|
|
57
59
|
getDevDependencies(workspaceName: string): DependencyArray;
|
|
58
60
|
private dependencyCache;
|
|
59
61
|
getDependencies(workspaceName: string): DependencySet;
|
|
62
|
+
getAllDependencies(workspaceName: string): DependencySet;
|
|
60
63
|
addReferencedDependency(workspaceName: string, packageName: string): void;
|
|
64
|
+
private addReference;
|
|
61
65
|
setHostDependencies(workspaceName: string, hostDependencies: HostDependencies): void;
|
|
62
66
|
getHostDependenciesFor(workspaceName: string, dependency: string): {
|
|
63
67
|
name: string;
|
|
64
68
|
isPeerOptional: boolean;
|
|
65
69
|
}[];
|
|
66
70
|
getOptionalPeerDependencies(workspaceName: string): DependencySet;
|
|
67
|
-
maybeAddReferencedExternalDependency(workspace: Workspace, packageName: string, { specifier, isDevOnly, isTypeOnly, isResolved, isPublishedType, isCaught }: DependencyReferenceOptions): boolean;
|
|
68
|
-
maybeAddReferencedBinary(workspace: Workspace, binaryName: string): Set<string> | undefined;
|
|
71
|
+
maybeAddReferencedExternalDependency(workspace: Workspace, packageName: string, { specifier, isDevOnly, isTypeOnly, isResolved, isPublishedType, isCaught, isDevelopment, }: DependencyReferenceOptions): boolean;
|
|
72
|
+
maybeAddReferencedBinary(workspace: Workspace, binaryName: string, isDevelopment?: boolean): Set<string> | undefined;
|
|
69
73
|
private isInDependencies;
|
|
70
74
|
settleDependencyIssues(): {
|
|
71
75
|
dependencyIssues: Issue[];
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import { isBuiltin } from 'node:module';
|
|
2
1
|
import { DT_SCOPE, IGNORE_DEFINITELY_TYPED, IGNORED_DEPENDENCIES, IGNORED_RUNTIME_DEPENDENCIES, PROTOCOL_CLOUDFLARE, ROOT_WORKSPACE_NAME, } from './constants.js';
|
|
3
2
|
import { getDependencyMetaData } from './manifest/index.js';
|
|
4
3
|
import { PackagePeeker } from './PackagePeeker.js';
|
|
5
|
-
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, getPackageNameFromModuleSpecifier, isDefinitelyTyped, } from './util/modules.js';
|
|
4
|
+
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, getPackageNameFromModuleSpecifier, isBuiltin, isDefinitelyTyped, } from './util/modules.js';
|
|
6
5
|
import { findMatch, toRegexOrString } from './util/regex.js';
|
|
7
|
-
const filterIsProduction = (id, isProduction) => typeof id === 'string' ? (isProduction || !id.endsWith('!') ? id.replace(/!$/, '') :
|
|
6
|
+
const filterIsProduction = (id, isProduction) => typeof id === 'string' ? (isProduction || !id.endsWith('!') ? id.replace(/!$/, '') : undefined) : id;
|
|
7
|
+
const toIgnoreMap = (items, toId = id => id) => {
|
|
8
|
+
const ids = new Set();
|
|
9
|
+
const ignores = new Map();
|
|
10
|
+
for (const item of items) {
|
|
11
|
+
const id = toId(item.value);
|
|
12
|
+
if (id === undefined || ids.has(id))
|
|
13
|
+
continue;
|
|
14
|
+
ids.add(id);
|
|
15
|
+
ignores.set(toRegexOrString(id), item.configKey);
|
|
16
|
+
}
|
|
17
|
+
return ignores;
|
|
18
|
+
};
|
|
8
19
|
export class DependencyDeputy {
|
|
9
20
|
isProduction;
|
|
10
21
|
isStrict;
|
|
@@ -58,19 +69,23 @@ export class DependencyDeputy {
|
|
|
58
69
|
uninstalledOptionalDependencies.add(dependency);
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
72
|
+
const toId = (id) => filterIsProduction(id, this.isProduction);
|
|
73
|
+
const ignoreConfigKeys = {
|
|
74
|
+
ignoreDependencies: toIgnoreMap(id, toId),
|
|
75
|
+
ignoreBinaries: toIgnoreMap(ib, toId),
|
|
76
|
+
ignoreUnresolved: toIgnoreMap(iu),
|
|
77
|
+
};
|
|
64
78
|
this._manifests.set(name, {
|
|
65
79
|
workspaceDir: dir,
|
|
66
80
|
manifestPath,
|
|
67
81
|
manifestStr,
|
|
68
|
-
ignoreDependencies,
|
|
69
|
-
ignoreBinaries,
|
|
70
|
-
ignoreUnresolved,
|
|
71
|
-
unusedIgnoreDependencies: new Set(ignoreDependencies),
|
|
72
|
-
unusedIgnoreBinaries: new Set(ignoreBinaries),
|
|
73
|
-
unusedIgnoreUnresolved: new Set(ignoreUnresolved),
|
|
82
|
+
ignoreDependencies: [...ignoreConfigKeys.ignoreDependencies.keys()],
|
|
83
|
+
ignoreBinaries: [...ignoreConfigKeys.ignoreBinaries.keys()],
|
|
84
|
+
ignoreUnresolved: [...ignoreConfigKeys.ignoreUnresolved.keys()],
|
|
85
|
+
unusedIgnoreDependencies: new Set(ignoreConfigKeys.ignoreDependencies.keys()),
|
|
86
|
+
unusedIgnoreBinaries: new Set(ignoreConfigKeys.ignoreBinaries.keys()),
|
|
87
|
+
unusedIgnoreUnresolved: new Set(ignoreConfigKeys.ignoreUnresolved.keys()),
|
|
88
|
+
ignoreConfigKeys,
|
|
74
89
|
dependencies,
|
|
75
90
|
devDependencies,
|
|
76
91
|
peerDependencies: new Set(peerDependencies),
|
|
@@ -109,12 +124,19 @@ export class DependencyDeputy {
|
|
|
109
124
|
this.dependencyCache.set(workspaceName, deps);
|
|
110
125
|
return deps;
|
|
111
126
|
}
|
|
127
|
+
getAllDependencies(workspaceName) {
|
|
128
|
+
return this._manifests.get(workspaceName)?.allDependencies ?? new Set();
|
|
129
|
+
}
|
|
112
130
|
addReferencedDependency(workspaceName, packageName) {
|
|
113
131
|
if (!this.referencedDependencies.has(workspaceName)) {
|
|
114
132
|
this.referencedDependencies.set(workspaceName, new Set());
|
|
115
133
|
}
|
|
116
134
|
this.referencedDependencies.get(workspaceName)?.add(packageName);
|
|
117
135
|
}
|
|
136
|
+
addReference(workspaceName, packageName, isDevelopment) {
|
|
137
|
+
if (!this.isProduction || !isDevelopment)
|
|
138
|
+
this.addReferencedDependency(workspaceName, packageName);
|
|
139
|
+
}
|
|
118
140
|
setHostDependencies(workspaceName, hostDependencies) {
|
|
119
141
|
this.hostDependencies.set(workspaceName, hostDependencies);
|
|
120
142
|
}
|
|
@@ -124,10 +146,8 @@ export class DependencyDeputy {
|
|
|
124
146
|
getOptionalPeerDependencies(workspaceName) {
|
|
125
147
|
return this._manifests.get(workspaceName)?.optionalPeerDependencies ?? new Set();
|
|
126
148
|
}
|
|
127
|
-
maybeAddReferencedExternalDependency(workspace, packageName, { specifier, isDevOnly, isTypeOnly, isResolved, isPublishedType, isCaught }) {
|
|
128
|
-
if (
|
|
129
|
-
return true;
|
|
130
|
-
if (specifier.startsWith('node:') || specifier.startsWith(PROTOCOL_CLOUDFLARE) || isBuiltin(specifier))
|
|
149
|
+
maybeAddReferencedExternalDependency(workspace, packageName, { specifier, isDevOnly, isTypeOnly, isResolved, isPublishedType, isCaught, isDevelopment, }) {
|
|
150
|
+
if (isBuiltin(specifier) || specifier.startsWith(PROTOCOL_CLOUDFLARE))
|
|
131
151
|
return true;
|
|
132
152
|
if (IGNORED_RUNTIME_DEPENDENCIES.has(packageName))
|
|
133
153
|
return true;
|
|
@@ -141,9 +161,9 @@ export class DependencyDeputy {
|
|
|
141
161
|
const typesPackageName = !isDefinitelyTyped(packageName) && getDefinitelyTypedFor(packageName);
|
|
142
162
|
const closestWorkspaceNameForTypes = typesPackageName && workspaceNames.find(name => this.isInDependencies(name, typesPackageName, isDevOrTypeOnly));
|
|
143
163
|
if (closestWorkspaceNameForTypes && !this.hasTypesIncluded.get(closestWorkspaceNameForTypes)?.has(packageName))
|
|
144
|
-
this.
|
|
164
|
+
this.addReference(closestWorkspaceNameForTypes, typesPackageName, isDevelopment);
|
|
145
165
|
if (closestWorkspaceName) {
|
|
146
|
-
this.
|
|
166
|
+
this.addReference(closestWorkspaceName, packageName, isDevelopment);
|
|
147
167
|
return true;
|
|
148
168
|
}
|
|
149
169
|
if (closestWorkspaceNameForTypes && isTypeOnly)
|
|
@@ -151,7 +171,7 @@ export class DependencyDeputy {
|
|
|
151
171
|
if (this._manifests.get(workspace.name)?.engines[packageName])
|
|
152
172
|
return true;
|
|
153
173
|
if (!this.isStrict && this.workspacePkgNames.has(packageName) && this._manifests.get(workspace.name)?.isPrivate) {
|
|
154
|
-
this.
|
|
174
|
+
this.addReference(workspace.name, packageName, isDevelopment);
|
|
155
175
|
return true;
|
|
156
176
|
}
|
|
157
177
|
if (!this.isStrict && isResolved !== false) {
|
|
@@ -161,15 +181,15 @@ export class DependencyDeputy {
|
|
|
161
181
|
continue;
|
|
162
182
|
const m = this._manifests.get(name);
|
|
163
183
|
if (m && hosts.some(h => m.allDependencies.has(h.name))) {
|
|
164
|
-
this.
|
|
184
|
+
this.addReference(name, packageName, isDevelopment);
|
|
165
185
|
return true;
|
|
166
186
|
}
|
|
167
187
|
}
|
|
168
188
|
}
|
|
169
|
-
this.
|
|
189
|
+
this.addReference(workspace.name, packageName, isDevelopment);
|
|
170
190
|
return false;
|
|
171
191
|
}
|
|
172
|
-
maybeAddReferencedBinary(workspace, binaryName) {
|
|
192
|
+
maybeAddReferencedBinary(workspace, binaryName, isDevelopment) {
|
|
173
193
|
if (!this.isReportDependencies)
|
|
174
194
|
return new Set();
|
|
175
195
|
const workspaceNames = this.isStrict ? [workspace.name] : [workspace.name, ...workspace.ancestors.toReversed()];
|
|
@@ -179,7 +199,7 @@ export class DependencyDeputy {
|
|
|
179
199
|
const dependencies = binaries.get(binaryName);
|
|
180
200
|
if (dependencies?.size) {
|
|
181
201
|
for (const dependency of dependencies)
|
|
182
|
-
this.
|
|
202
|
+
this.addReference(name, dependency, isDevelopment);
|
|
183
203
|
return dependencies;
|
|
184
204
|
}
|
|
185
205
|
}
|
|
@@ -193,7 +213,7 @@ export class DependencyDeputy {
|
|
|
193
213
|
const defaultBinaryName = dependency.replace(/^@[^/]+\//, '');
|
|
194
214
|
if (defaultBinaryName === binaryName) {
|
|
195
215
|
optionalDependencies.add(dependency);
|
|
196
|
-
this.
|
|
216
|
+
this.addReference(name, dependency, isDevelopment);
|
|
197
217
|
}
|
|
198
218
|
}
|
|
199
219
|
}
|
|
@@ -386,14 +406,18 @@ export class DependencyDeputy {
|
|
|
386
406
|
getConfigurationHints() {
|
|
387
407
|
const configurationHints = [];
|
|
388
408
|
for (const [workspaceName, manifest] of this._manifests) {
|
|
409
|
+
const toHint = (type, identifier) => {
|
|
410
|
+
const configKey = manifest.ignoreConfigKeys[type].get(identifier);
|
|
411
|
+
return configKey ? { workspaceName, identifier, type, configKey } : { workspaceName, identifier, type };
|
|
412
|
+
};
|
|
389
413
|
for (const identifier of manifest.unusedIgnoreDependencies) {
|
|
390
|
-
configurationHints.push(
|
|
414
|
+
configurationHints.push(toHint('ignoreDependencies', identifier));
|
|
391
415
|
}
|
|
392
416
|
for (const identifier of manifest.unusedIgnoreBinaries) {
|
|
393
|
-
configurationHints.push(
|
|
417
|
+
configurationHints.push(toHint('ignoreBinaries', identifier));
|
|
394
418
|
}
|
|
395
419
|
for (const identifier of manifest.unusedIgnoreUnresolved) {
|
|
396
|
-
configurationHints.push(
|
|
420
|
+
configurationHints.push(toHint('ignoreUnresolved', identifier));
|
|
397
421
|
}
|
|
398
422
|
}
|
|
399
423
|
return configurationHints;
|
package/dist/IssueCollector.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import type { UnusedIgnorePattern } from './configuration-hints.ts';
|
|
1
2
|
import type { IgnoreIssues } from './types/config.ts';
|
|
2
3
|
import type { ConfigurationHint, Issue, TagHint } from './types/issues.ts';
|
|
3
4
|
import type { MainOptions } from './util/create-options.ts';
|
|
4
5
|
import type { WorkspaceFilePathFilter } from './util/workspace-file-filter.ts';
|
|
6
|
+
type IgnorePatternEntry = {
|
|
7
|
+
pattern: string;
|
|
8
|
+
id: string;
|
|
9
|
+
workspaceName?: string;
|
|
10
|
+
configKey?: string;
|
|
11
|
+
};
|
|
5
12
|
export type CollectorIssues = ReturnType<IssueCollector['getIssues']>;
|
|
6
13
|
export declare class IssueCollector {
|
|
7
14
|
private cwd;
|
|
@@ -10,6 +17,7 @@ export declare class IssueCollector {
|
|
|
10
17
|
private issues;
|
|
11
18
|
private counters;
|
|
12
19
|
private referencedFiles;
|
|
20
|
+
private configurationHintCandidates;
|
|
13
21
|
private configurationHints;
|
|
14
22
|
private tagHints;
|
|
15
23
|
private hasConfigLoadErrors;
|
|
@@ -26,16 +34,8 @@ export declare class IssueCollector {
|
|
|
26
34
|
setWorkspaceFilter(workspaceFilePathFilter: WorkspaceFilePathFilter | undefined): void;
|
|
27
35
|
setSelectedWorkspaces(selectedWorkspaces: Set<string> | undefined): void;
|
|
28
36
|
private collectIgnorePatterns;
|
|
29
|
-
addIgnorePatterns(entries:
|
|
30
|
-
|
|
31
|
-
id: string;
|
|
32
|
-
workspaceName?: string;
|
|
33
|
-
}[]): void;
|
|
34
|
-
addIgnoreFilesPatterns(entries: {
|
|
35
|
-
pattern: string;
|
|
36
|
-
id: string;
|
|
37
|
-
workspaceName?: string;
|
|
38
|
-
}[]): void;
|
|
37
|
+
addIgnorePatterns(entries: IgnorePatternEntry[]): void;
|
|
38
|
+
addIgnoreFilesPatterns(entries: IgnorePatternEntry[]): void;
|
|
39
39
|
private markUsedPatterns;
|
|
40
40
|
setIgnoreIssues(ignoreIssues?: IgnoreIssues): void;
|
|
41
41
|
private shouldIgnoreIssue;
|
|
@@ -46,6 +46,8 @@ export declare class IssueCollector {
|
|
|
46
46
|
addFilesIssues(filePaths: string[]): void;
|
|
47
47
|
addIssue(issue: Issue): true | undefined;
|
|
48
48
|
addConfigurationHint(issue: ConfigurationHint): void;
|
|
49
|
+
getConfigurationHintCandidates(): MapIterator<ConfigurationHint>;
|
|
50
|
+
setConfigurationHints(hints: ConfigurationHint[]): void;
|
|
49
51
|
addTagHint(issue: TagHint): void;
|
|
50
52
|
addConfigLoadError(): void;
|
|
51
53
|
purge(): Set<string>;
|
|
@@ -56,8 +58,9 @@ export declare class IssueCollector {
|
|
|
56
58
|
configurationHints: ConfigurationHint[];
|
|
57
59
|
hasConfigLoadErrors: boolean;
|
|
58
60
|
};
|
|
59
|
-
|
|
61
|
+
getUnusedIgnorePatterns(): UnusedIgnorePattern[];
|
|
60
62
|
private retainedIssues;
|
|
61
63
|
retainIssue(issue: Issue): void;
|
|
62
64
|
getRetainedIssues(): Issue[];
|
|
63
65
|
}
|
|
66
|
+
export {};
|
package/dist/IssueCollector.js
CHANGED
|
@@ -19,7 +19,8 @@ export class IssueCollector {
|
|
|
19
19
|
issues = initIssues();
|
|
20
20
|
counters = initCounters();
|
|
21
21
|
referencedFiles = new Set();
|
|
22
|
-
|
|
22
|
+
configurationHintCandidates = new Map();
|
|
23
|
+
configurationHints = [];
|
|
23
24
|
tagHints = new Set();
|
|
24
25
|
hasConfigLoadErrors = false;
|
|
25
26
|
ignorePatterns = new Set();
|
|
@@ -53,12 +54,19 @@ export class IssueCollector {
|
|
|
53
54
|
continue;
|
|
54
55
|
if (entry.pattern.startsWith('!'))
|
|
55
56
|
continue;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const { id: identifier, workspaceName, configKey } = entry;
|
|
58
|
+
const hint = configKey
|
|
59
|
+
? { type, identifier, workspaceName, configKey }
|
|
60
|
+
: { type, identifier, workspaceName };
|
|
61
|
+
const tracked = unused.get(entry.pattern);
|
|
62
|
+
if (!tracked) {
|
|
63
|
+
unused.set(entry.pattern, { hints: [hint], isMatch: picomatch(entry.pattern, { dot: true }) });
|
|
64
|
+
}
|
|
65
|
+
else if (entry.workspaceName &&
|
|
66
|
+
entry.workspaceName !== ROOT_WORKSPACE_NAME &&
|
|
67
|
+
!tracked.hints.some(h => h.workspaceName === entry.workspaceName)) {
|
|
68
|
+
tracked.hints.push(hint);
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
71
|
return createMatcher(patterns);
|
|
64
72
|
}
|
|
@@ -154,9 +162,13 @@ export class IssueCollector {
|
|
|
154
162
|
if (workspaceName === ROOT_WORKSPACE_NAME || !this.selectedWorkspaces.has(workspaceName))
|
|
155
163
|
return;
|
|
156
164
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
this.configurationHintCandidates.set(`${issue.workspaceName}::${issue.type}::${issue.identifier}`, issue);
|
|
166
|
+
}
|
|
167
|
+
getConfigurationHintCandidates() {
|
|
168
|
+
return this.configurationHintCandidates.values();
|
|
169
|
+
}
|
|
170
|
+
setConfigurationHints(hints) {
|
|
171
|
+
this.configurationHints = hints;
|
|
160
172
|
}
|
|
161
173
|
addTagHint(issue) {
|
|
162
174
|
this.tagHints.add(issue);
|
|
@@ -180,19 +192,12 @@ export class IssueCollector {
|
|
|
180
192
|
issues: this.issues,
|
|
181
193
|
counters: this.counters,
|
|
182
194
|
tagHints: this.tagHints,
|
|
183
|
-
configurationHints:
|
|
195
|
+
configurationHints: this.configurationHints,
|
|
184
196
|
hasConfigLoadErrors: this.hasConfigLoadErrors,
|
|
185
197
|
};
|
|
186
198
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return [];
|
|
190
|
-
const hints = [];
|
|
191
|
-
for (const p of this.unusedIgnorePatterns.values())
|
|
192
|
-
hints.push(p.hint);
|
|
193
|
-
for (const p of this.unusedIgnoreFilesPatterns.values())
|
|
194
|
-
hints.push(p.hint);
|
|
195
|
-
return hints;
|
|
199
|
+
getUnusedIgnorePatterns() {
|
|
200
|
+
return [...this.unusedIgnorePatterns.values(), ...this.unusedIgnoreFilesPatterns.values()];
|
|
196
201
|
}
|
|
197
202
|
retainedIssues = [];
|
|
198
203
|
retainIssue(issue) {
|
package/dist/IssueFixer.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { formatly } from 'formatly';
|
|
3
2
|
import { DEFAULT_CATALOG } from './util/catalog.js';
|
|
4
3
|
import { debugLogArray, debugLogObject } from './util/debug.js';
|
|
5
4
|
import { load, save } from './util/package-json.js';
|
|
@@ -20,6 +19,7 @@ export const fix = async (issues, counters, options) => {
|
|
|
20
19
|
counters[counterType]--;
|
|
21
20
|
}
|
|
22
21
|
if (options.isFormat) {
|
|
22
|
+
const { formatly } = await import('formatly');
|
|
23
23
|
const report = await formatly(Array.from(touchedFiles));
|
|
24
24
|
if (report.ran && report.result.runner !== 'dry-run' && report.result.code === 0) {
|
|
25
25
|
debugLogArray('*', `Formatted files using ${report.formatter.name} (${report.formatter.runner})`, touchedFiles);
|
package/dist/PackagePeeker.d.ts
CHANGED