knip 2.15.0 → 2.15.2

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 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
 
@@ -1,8 +1,9 @@
1
+ /// <reference types="npmcli__package-json" />
1
2
  import { Workspace } from './ConfigurationChief.js';
2
3
  import type { ConfigurationHints, Issue } from './types/issues.js';
3
4
  import type { WorkspaceManifests } from './types/workspace.js';
4
5
  import type { PeerDependencies, InstalledBinaries } from './types/workspace.js';
5
- import type { PackageJson } from 'type-fest';
6
+ import type { PackageJson } from '@npmcli/package-json';
6
7
  type Options = {
7
8
  isStrict: boolean;
8
9
  };
@@ -16,7 +17,7 @@ export declare class DependencyDeputy {
16
17
  ignoreBinaries: string[];
17
18
  ignoreDependencies: string[];
18
19
  constructor({ isStrict }: Options);
19
- addWorkspace({ name, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, }: {
20
+ addWorkspace({ name, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries }: {
20
21
  name: string;
21
22
  dir: string;
22
23
  manifestPath: string;
@@ -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) {
@@ -1,12 +1,12 @@
1
+ import { PackageJsonWithPlugins } from './types/plugins.js';
1
2
  import { InstalledBinaries, PeerDependencies } from './types/workspace.js';
2
3
  import type { Configuration, PluginName, WorkspaceConfiguration } from './types/config.js';
3
- import type { PackageJson } from 'type-fest';
4
4
  type WorkspaceManagerOptions = {
5
5
  name: string;
6
6
  dir: string;
7
7
  cwd: string;
8
8
  config: WorkspaceConfiguration;
9
- manifest: PackageJson;
9
+ manifest: PackageJsonWithPlugins;
10
10
  rootIgnore: Configuration['ignore'];
11
11
  negatedWorkspacePatterns: string[];
12
12
  enabledPluginsInAncestors: string[];
@@ -19,7 +19,7 @@ export declare class WorkspaceWorker {
19
19
  dir: string;
20
20
  cwd: string;
21
21
  config: WorkspaceConfiguration;
22
- manifest: PackageJson;
22
+ manifest: PackageJsonWithPlugins;
23
23
  isProduction: boolean;
24
24
  isStrict: boolean;
25
25
  rootIgnore: Configuration['ignore'];
@@ -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;
@@ -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
  }
@@ -1,4 +1,4 @@
1
- import type { PackageJson } from 'type-fest';
1
+ import type { PackageJson } from '@npmcli/package-json';
2
2
  export declare const getBinariesFromScript: (script: string, { cwd, manifest, knownGlobalsOnly }: {
3
3
  cwd: string;
4
4
  manifest: PackageJson;
@@ -1,4 +1,4 @@
1
- import parse from 'bash-parser';
1
+ import parse from '@ericcornelissen/bash-parser';
2
2
  import parseArgs from 'minimist';
3
3
  import { debugLogObject } from '../util/debug.js';
4
4
  import * as FallbackResolver from './resolvers/fallback.js';
@@ -1,4 +1,5 @@
1
- import type { PackageJson } from 'type-fest';
1
+ /// <reference types="npmcli__package-json" />
2
+ import type { PackageJson } from '@npmcli/package-json';
2
3
  type Options = {
3
4
  cwd?: string;
4
5
  manifest?: PackageJson;
@@ -1,5 +1,6 @@
1
+ /// <reference types="npmcli__package-json" />
1
2
  import type { InstalledBinaries, PeerDependencies } from '../types/workspace.js';
2
- import type { PackageJson } from 'type-fest';
3
+ import type { PackageJson } from '@npmcli/package-json';
3
4
  type Options = {
4
5
  manifest: PackageJson;
5
6
  isProduction: boolean;
@@ -1,5 +1,6 @@
1
+ /// <reference types="npmcli__package-json" />
1
2
  import type { ESLintConfig } from './types.js';
2
- import type { PackageJson } from 'type-fest';
3
+ import type { PackageJson } from '@npmcli/package-json';
3
4
  type Manifest = PackageJson & {
4
5
  eslintConfig?: ESLintConfig;
5
6
  };
@@ -54,7 +54,7 @@ const resolveExtendsSpecifier = (specifier) => {
54
54
  return specifier;
55
55
  const strippedSpecifier = specifier
56
56
  .replace(/(^plugin:|:.+$)/, '')
57
- .replace(/\/(eslint-)?(recommended.*|strict|all)$/, '');
57
+ .replace(/\/(eslint-)?(recommended.*|stylistic.*|strict.*|all)$/, '');
58
58
  if (/eslint-(config|plugin)-/.test(strippedSpecifier))
59
59
  return strippedSpecifier;
60
60
  const packageName = getPackageNameFromModuleSpecifier(strippedSpecifier);
@@ -1,5 +1,7 @@
1
+ /// <reference types="npmcli__package-json" />
1
2
  import type { PluginConfiguration } from './config.js';
2
- import type { PackageJson } from 'type-fest';
3
+ import type { PackageJson } from '@npmcli/package-json';
4
+ export type PackageJsonWithPlugins = PackageJson & Record<string, unknown>;
3
5
  type IsPluginEnabledCallbackOptions = {
4
6
  cwd: string;
5
7
  manifest: PackageJson;
@@ -8,7 +10,7 @@ type IsPluginEnabledCallbackOptions = {
8
10
  export type IsPluginEnabledCallback = (options: IsPluginEnabledCallbackOptions) => boolean | Promise<boolean>;
9
11
  type GenericPluginCallbackOptions = {
10
12
  cwd: string;
11
- manifest: PackageJson;
13
+ manifest: PackageJsonWithPlugins;
12
14
  config: PluginConfiguration;
13
15
  isProduction: boolean;
14
16
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.15.0";
1
+ export declare const version = "2.15.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.15.0';
1
+ export const version = '2.15.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
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",
@@ -41,9 +41,9 @@
41
41
  "schema.json"
42
42
  ],
43
43
  "dependencies": {
44
+ "@ericcornelissen/bash-parser": "^0.5.2",
44
45
  "@npmcli/map-workspaces": "^3.0.4",
45
46
  "@snyk/github-codeowners": "^1.1.0",
46
- "bash-parser": "^0.5.0",
47
47
  "chalk": "^5.2.0",
48
48
  "easy-table": "^1.2.0",
49
49
  "fast-glob": "^3.2.12",
@@ -70,8 +70,8 @@
70
70
  "@types/node": "20.4.1",
71
71
  "@types/npmcli__map-workspaces": "3.0.1",
72
72
  "@types/webpack": "5.28.1",
73
- "@typescript-eslint/eslint-plugin": "5.61.0",
74
- "@typescript-eslint/parser": "5.61.0",
73
+ "@typescript-eslint/eslint-plugin": "6.0.0",
74
+ "@typescript-eslint/parser": "6.0.0",
75
75
  "c8": "8.0.0",
76
76
  "eslint": "8.44.0",
77
77
  "eslint-import-resolver-typescript": "3.5.5",