knip 2.2.3 → 2.2.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/dist/index.js CHANGED
@@ -201,6 +201,9 @@ export const main = async (unresolvedConfiguration) => {
201
201
  importedModule.isReExported = importItems.isReExported;
202
202
  importedModule.isReExportedBy.add(filePath);
203
203
  }
204
+ if (importItems.isDynamic) {
205
+ importedModule.isDynamic = importItems.isDynamic;
206
+ }
204
207
  }
205
208
  }
206
209
  duplicate.forEach(symbols => {
@@ -1,4 +1,5 @@
1
1
  import { compact } from '../../util/array.js';
2
+ import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
2
3
  import { isAbsolute, isInternal, join, dirname } from '../../util/path.js';
3
4
  import { load } from '../../util/plugin.js';
4
5
  import { _resolve } from '../../util/require.js';
@@ -11,7 +12,8 @@ const getDependencies = (config) => {
11
12
  const parser = config.parser;
12
13
  const extraParsers = config.parserOptions?.babelOptions?.presets ?? [];
13
14
  const settings = config.settings ? getDependenciesFromSettings(config.settings) : [];
14
- return compact([...extendsSpecifiers, ...plugins, parser, ...extraParsers, ...settings]);
15
+ const overrides = config.overrides ? [config.overrides].flat().flatMap(getDependencies) : [];
16
+ return compact([...extendsSpecifiers, ...plugins, parser, ...extraParsers, ...settings, ...overrides]);
15
17
  };
16
18
  export const getDependenciesDeep = async (configFilePath, dependencies = new Set(), options) => {
17
19
  const addAll = (deps) => deps.forEach(dependency => dependencies.add(dependency));
@@ -41,9 +43,6 @@ export const getDependenciesDeep = async (configFilePath, dependencies = new Set
41
43
  }
42
44
  }
43
45
  }
44
- if (config.overrides)
45
- for (const override of [config.overrides].flat())
46
- addAll(getDependencies(override));
47
46
  addAll(getDependencies(config));
48
47
  }
49
48
  return dependencies;
@@ -60,9 +59,12 @@ const resolveExtendsSpecifier = (specifier) => {
60
59
  if (isInternal(specifier))
61
60
  return;
62
61
  if (specifier.includes(':')) {
63
- const pluginName = specifier.replace(/^plugin:/, '').replace(/(\/|:).+$/, '');
62
+ const strippedSpecifier = specifier.replace(/(^plugin:|:.+$)/, '').replace(/\/(eslint-)?recommended$/, '');
63
+ const pluginName = getPackageNameFromModuleSpecifier(strippedSpecifier);
64
64
  if (pluginName === 'eslint')
65
65
  return;
66
+ if (pluginName.includes('eslint-'))
67
+ return pluginName;
66
68
  return resolvePackageName('eslint-plugin', pluginName);
67
69
  }
68
70
  return specifier.includes('eslint') ? specifier : resolvePackageName('eslint-config', specifier);
@@ -15,8 +15,9 @@ type BaseConfig = {
15
15
  settings?: Settings;
16
16
  rules?: Rules;
17
17
  };
18
- type OverrideConfig = BaseConfig & {
18
+ export type OverrideConfig = BaseConfig & {
19
19
  files: string[];
20
+ overrides: OverrideConfig;
20
21
  };
21
22
  export type ESLintConfig = BaseConfig & {
22
23
  env?: Record<string, boolean>;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.2.3";
1
+ export declare const version = "2.2.4";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.2.3';
1
+ export const version = '2.2.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://github.com/webpro/knip",
6
6
  "repository": "github:webpro/knip",