knip 5.23.1 → 5.23.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.
Files changed (103) hide show
  1. package/dist/ConfigurationChief.d.ts +89 -15
  2. package/dist/ConfigurationValidator.d.ts +2897 -1141
  3. package/dist/DependencyDeputy.d.ts +21 -6
  4. package/dist/IssueCollector.d.ts +4 -4
  5. package/dist/IssueFixer.d.ts +1 -1
  6. package/dist/PrincipalFactory.d.ts +3 -3
  7. package/dist/ProjectPrincipal.d.ts +9 -9
  8. package/dist/WorkspaceWorker.d.ts +14 -9
  9. package/dist/binaries/util.d.ts +5 -5
  10. package/dist/compilers/astro.d.ts +1 -1
  11. package/dist/compilers/compilers.d.ts +2 -2
  12. package/dist/compilers/index.d.ts +695 -83
  13. package/dist/compilers/mdx.d.ts +1 -1
  14. package/dist/constants.d.ts +4 -4
  15. package/dist/index.d.ts +8 -1
  16. package/dist/manifest/helpers.d.ts +1 -1
  17. package/dist/manifest/index.d.ts +4 -6
  18. package/dist/plugins/babel/helpers.d.ts +1 -1
  19. package/dist/plugins/babel/index.d.ts +1 -1
  20. package/dist/plugins/capacitor/index.d.ts +1 -1
  21. package/dist/plugins/commitlint/index.js +2 -7
  22. package/dist/plugins/cypress/index.d.ts +1 -1
  23. package/dist/plugins/eleventy/helpers.d.ts +5 -5
  24. package/dist/plugins/eleventy/index.d.ts +5 -2
  25. package/dist/plugins/graphql-codegen/index.d.ts +1 -1
  26. package/dist/plugins/graphql-codegen/index.js +1 -1
  27. package/dist/plugins/husky/index.d.ts +1 -1
  28. package/dist/plugins/jest/index.d.ts +3 -2
  29. package/dist/plugins/lefthook/index.d.ts +1 -1
  30. package/dist/plugins/lint-staged/index.d.ts +2 -1
  31. package/dist/plugins/lint-staged/index.js +5 -6
  32. package/dist/plugins/linthtml/index.js +2 -9
  33. package/dist/plugins/lockfile-lint/index.js +2 -2
  34. package/dist/plugins/markdownlint/helpers.d.ts +1 -1
  35. package/dist/plugins/netlify/helpers.d.ts +1 -1
  36. package/dist/plugins/netlify/index.d.ts +1 -1
  37. package/dist/plugins/next/index.d.ts +1 -1
  38. package/dist/plugins/npm-package-json-lint/index.js +2 -2
  39. package/dist/plugins/nx/index.d.ts +1 -1
  40. package/dist/plugins/playwright-ct/index.d.ts +1 -1
  41. package/dist/plugins/postcss/index.js +6 -2
  42. package/dist/plugins/prettier/index.js +2 -2
  43. package/dist/plugins/release-it/index.js +1 -1
  44. package/dist/plugins/remix/index.d.ts +1 -1
  45. package/dist/plugins/semantic-release/index.js +2 -2
  46. package/dist/plugins/sentry/index.d.ts +1 -1
  47. package/dist/plugins/simple-git-hooks/index.d.ts +2 -1
  48. package/dist/plugins/size-limit/index.js +5 -2
  49. package/dist/plugins/storybook/index.d.ts +2 -2
  50. package/dist/plugins/stylelint/index.js +2 -2
  51. package/dist/plugins/svelte/index.d.ts +1 -1
  52. package/dist/plugins/syncpack/index.d.ts +1 -0
  53. package/dist/plugins/syncpack/index.js +5 -2
  54. package/dist/plugins/tsup/index.js +1 -1
  55. package/dist/plugins/typedoc/index.js +4 -4
  56. package/dist/plugins/unbuild/index.d.ts +2 -1
  57. package/dist/plugins/unocss/index.js +2 -2
  58. package/dist/plugins/vitest/helpers.d.ts +2 -2
  59. package/dist/plugins/webpack/index.d.ts +4 -1
  60. package/dist/plugins/wireit/index.d.ts +2 -3
  61. package/dist/plugins/xo/index.js +2 -2
  62. package/dist/plugins/yorkie/index.d.ts +2 -1
  63. package/dist/reporters/index.d.ts +1 -1
  64. package/dist/reporters/json.d.ts +1 -1
  65. package/dist/reporters/util.d.ts +1 -1
  66. package/dist/typescript/SourceFileManager.d.ts +5 -5
  67. package/dist/typescript/ast-helpers.d.ts +7 -7
  68. package/dist/typescript/getImportsAndExports.d.ts +11 -10
  69. package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
  70. package/dist/typescript/visitors/exports/index.d.ts +1 -1
  71. package/dist/typescript/visitors/imports/index.d.ts +1 -1
  72. package/dist/typescript/visitors/scripts/index.d.ts +1 -1
  73. package/dist/util/Performance.d.ts +2 -2
  74. package/dist/util/array.d.ts +2 -2
  75. package/dist/util/errors.d.ts +1 -1
  76. package/dist/util/file-entry-cache.d.ts +6 -3
  77. package/dist/util/fs.d.ts +6 -6
  78. package/dist/util/get-included-issue-types.d.ts +2 -1
  79. package/dist/util/get-included-issue-types.js +1 -1
  80. package/dist/util/git.d.ts +1 -1
  81. package/dist/util/glob.d.ts +6 -6
  82. package/dist/util/handle-dependency.d.ts +1 -1
  83. package/dist/util/is-identifier-referenced.d.ts +1 -1
  84. package/dist/util/loader.d.ts +1 -1
  85. package/dist/util/map-workspaces.d.ts +2 -1
  86. package/dist/util/modules.d.ts +7 -7
  87. package/dist/util/package-json.d.ts +6 -2
  88. package/dist/util/path.d.ts +6 -6
  89. package/dist/util/pkgs-graph.d.ts +1 -1
  90. package/dist/util/plugin.d.ts +33 -9
  91. package/dist/util/plugin.js +34 -2
  92. package/dist/util/protocols.d.ts +9 -9
  93. package/dist/util/regex.d.ts +3 -3
  94. package/dist/util/reporter.d.ts +1 -1
  95. package/dist/util/require.d.ts +3 -3
  96. package/dist/util/resolve.d.ts +1 -1
  97. package/dist/util/tag.d.ts +2 -2
  98. package/dist/util/trace.d.ts +2 -2
  99. package/dist/util/tsconfig-loader.d.ts +6 -1
  100. package/dist/util/unwrap-function.d.ts +1 -1
  101. package/dist/version.d.ts +1 -1
  102. package/dist/version.js +1 -1
  103. package/package.json +6 -2
@@ -1,5 +1,5 @@
1
1
  import type { Workspace } from './ConfigurationChief.js';
2
- import type { Counters, Issue, Issues, SymbolIssueType } from './types/issues.js';
2
+ import type { ConfigurationHints, Counters, Issue, Issues, SymbolIssueType } from './types/issues.js';
3
3
  import type { PackageJson } from './types/package-json.js';
4
4
  import type { DependencyArray, DependencySet, HostDependencies, InstalledBinaries, WorkspaceManifests } from './types/workspace.js';
5
5
  type Options = {
@@ -25,18 +25,33 @@ export declare class DependencyDeputy {
25
25
  ignoreDependencies: (string | RegExp)[];
26
26
  ignoreBinaries: (string | RegExp)[];
27
27
  }): void;
28
- getWorkspaceManifest(workspaceName: string): any;
28
+ getWorkspaceManifest(workspaceName: string): {
29
+ workspaceDir: string;
30
+ manifestPath: string;
31
+ dependencies: DependencyArray;
32
+ devDependencies: DependencyArray;
33
+ peerDependencies: DependencySet;
34
+ optionalPeerDependencies: DependencyArray;
35
+ allDependencies: DependencySet;
36
+ ignoreDependencies: (string | RegExp)[];
37
+ ignoreBinaries: (string | RegExp)[];
38
+ usedIgnoreDependencies: Set<string | RegExp>;
39
+ usedIgnoreBinaries: Set<string | RegExp>;
40
+ } | undefined;
29
41
  getProductionDependencies(workspaceName: string): DependencyArray;
30
42
  getDevDependencies(workspaceName: string): DependencyArray;
31
43
  getDependencies(workspaceName: string): DependencySet;
32
44
  setInstalledBinaries(workspaceName: string, installedBinaries: Map<string, Set<string>>): void;
33
- getInstalledBinaries(workspaceName: string): any;
45
+ getInstalledBinaries(workspaceName: string): InstalledBinaries | undefined;
34
46
  setHasTypesIncluded(workspaceName: string, hasTypesIncluded: Set<string>): void;
35
- getHasTypesIncluded(workspaceName: string): any;
47
+ getHasTypesIncluded(workspaceName: string): InstalledBinaries | undefined;
36
48
  addReferencedDependency(workspaceName: string, packageName: string): void;
37
49
  addReferencedBinary(workspaceName: string, binaryName: string): void;
38
50
  setHostDependencies(workspaceName: string, hostDependencies: HostDependencies): void;
39
- getHostDependenciesFor(workspaceName: string, dependency: string): any;
51
+ getHostDependenciesFor(workspaceName: string, dependency: string): {
52
+ name: string;
53
+ isPeerOptional: boolean;
54
+ }[];
40
55
  getOptionalPeerDependencies(workspaceName: string): DependencyArray;
41
56
  maybeAddReferencedExternalDependency(workspace: Workspace, packageName: string): boolean;
42
57
  maybeAddReferencedBinary(workspace: Workspace, binaryName: string): boolean;
@@ -51,6 +66,6 @@ export declare class DependencyDeputy {
51
66
  getConfigurationHints({ issues, counters }: {
52
67
  issues: Issues;
53
68
  counters: Counters;
54
- }): Set<import("./types/issues.js").ConfigurationHint>;
69
+ }): ConfigurationHints;
55
70
  }
56
71
  export {};
@@ -28,12 +28,12 @@ export declare class IssueCollector {
28
28
  addIssue(issue: Issue): Issue | undefined;
29
29
  addConfigurationHint(issue: ConfigurationHint): void;
30
30
  addTagHint(issue: TagHint): void;
31
- purge(): Set<string>;
31
+ purge(): import("./types/issues.js").IssueSet;
32
32
  getIssues(): {
33
33
  issues: import("./types/issues.js").Issues;
34
- counters: Record<keyof import("./types/issues.js").Issues | "processed" | "total", number>;
35
- tagHints: any;
36
- configurationHints: any;
34
+ counters: import("./types/issues.js").Counters;
35
+ tagHints: Set<TagHint>;
36
+ configurationHints: Set<ConfigurationHint>;
37
37
  };
38
38
  }
39
39
  export {};
@@ -18,7 +18,7 @@ export declare class IssueFixer {
18
18
  constructor({ isEnabled, cwd, fixTypes, isRemoveFiles }: Fixer);
19
19
  addUnusedTypeNode(filePath: string, fixes: Fixes | undefined): void;
20
20
  addUnusedExportNode(filePath: string, fixes: Fixes | undefined): void;
21
- fixIssues(issues: Issues): any;
21
+ fixIssues(issues: Issues): Promise<void>;
22
22
  private markExportFixed;
23
23
  private removeUnusedFiles;
24
24
  private removeUnusedExportKeywords;
@@ -21,12 +21,12 @@ export type PrincipalOptions = {
21
21
  };
22
22
  export declare class PrincipalFactory {
23
23
  principals: Principals;
24
- getPrincipal(options: PrincipalOptions): any;
24
+ getPrincipal(options: PrincipalOptions): ProjectPrincipal;
25
25
  private findReusablePrincipal;
26
26
  private linkPrincipal;
27
27
  private addNewPrincipal;
28
- getPrincipals(): any;
29
- getPrincipalByPackageName(packageName: string): any;
28
+ getPrincipals(): ProjectPrincipal[];
29
+ getPrincipalByPackageName(packageName: string): ProjectPrincipal | undefined;
30
30
  deletePrincipal(principal: ProjectPrincipal): void;
31
31
  }
32
32
  export {};
@@ -9,11 +9,11 @@ import { type GetImportsAndExportsOptions } from './typescript/getImportsAndExpo
9
9
  import type { ResolveModuleNames } from './typescript/resolveModuleNames.js';
10
10
  import type { ToSourceFilePath } from './util/to-source-path.js';
11
11
  export declare class ProjectPrincipal {
12
- entryPaths: any;
13
- projectPaths: any;
14
- nonEntryPaths: any;
12
+ entryPaths: Set<string>;
13
+ projectPaths: Set<string>;
14
+ nonEntryPaths: Set<string>;
15
15
  referencedDependencies: Set<[string, string, string]>;
16
- skipExportsAnalysis: any;
16
+ skipExportsAnalysis: Set<string>;
17
17
  cwd: string;
18
18
  compilerOptions: ts.CompilerOptions;
19
19
  extensions: Set<string>;
@@ -45,16 +45,16 @@ export declare class ProjectPrincipal {
45
45
  }): void;
46
46
  addNonEntryPath(filePath: string): void;
47
47
  addProjectPath(filePath: string): void;
48
- deletedFiles: any;
48
+ deletedFiles: Set<unknown>;
49
49
  removeProjectPath(filePath: string): void;
50
50
  addReferencedDependencies(workspaceName: string, referencedDependencies: ReferencedDependencies): void;
51
- runAsyncCompilers(): any;
52
- getUsedResolvedFiles(): any;
51
+ runAsyncCompilers(): Promise<void>;
52
+ getUsedResolvedFiles(): string[];
53
53
  private getProgramSourceFiles;
54
- getUnreferencedFiles(): any;
54
+ getUnreferencedFiles(): string[];
55
55
  analyzeSourceFile(filePath: string, options: Omit<GetImportsAndExportsOptions, 'skipExports'>, isGitIgnored: (filePath: string) => boolean, isPackageNameInternalWorkspace: (packageName: string) => boolean, getPrincipalByFilePath: (filePath: string) => undefined | ProjectPrincipal): FileNode;
56
56
  invalidateFile(filePath: string): void;
57
- findUnusedMembers(filePath: string, members: ExportMember[]): any;
57
+ findUnusedMembers(filePath: string, members: ExportMember[]): ExportMember[];
58
58
  hasExternalReferences(filePath: string, exportedItem: Export): boolean;
59
59
  reconcileCache(graph: DependencyGraph): void;
60
60
  }
@@ -32,23 +32,28 @@ export declare class WorkspaceWorker {
32
32
  isStrict: boolean;
33
33
  rootIgnore: Configuration['ignore'];
34
34
  negatedWorkspacePatterns: string[];
35
- enabledPluginsMap: any;
35
+ enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
36
36
  enabledPlugins: PluginName[];
37
37
  enabledPluginsInAncestors: string[];
38
38
  cache: CacheConsultant<CacheItem>;
39
39
  constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }: WorkspaceManagerOptions);
40
- init(): any;
40
+ init(): Promise<void>;
41
41
  private determineEnabledPlugins;
42
42
  private getConfigForPlugin;
43
- getEntryFilePatterns(): any;
44
- getProjectFilePatterns(testFilePatterns: string[]): any;
45
- getPluginProjectFilePatterns(): any;
43
+ getEntryFilePatterns(): string[];
44
+ getProjectFilePatterns(testFilePatterns: string[]): string[];
45
+ getPluginProjectFilePatterns(): string[];
46
46
  getPluginConfigPatterns(): string[];
47
- getProductionEntryFilePatterns(negatedTestFilePatterns: string[]): any;
48
- getProductionProjectFilePatterns(negatedTestFilePatterns: string[]): any;
47
+ getProductionEntryFilePatterns(negatedTestFilePatterns: string[]): string[];
48
+ getProductionProjectFilePatterns(negatedTestFilePatterns: string[]): string[];
49
49
  private getConfigurationFilePatterns;
50
- getIgnorePatterns(): any[];
51
- findDependenciesByPlugins(): unknown;
50
+ getIgnorePatterns(): string[];
51
+ findDependenciesByPlugins(): Promise<{
52
+ entryFilePatterns: Set<string>;
53
+ productionEntryFilePatterns: Set<string>;
54
+ referencedDependencies: ReferencedDependencies;
55
+ enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
56
+ }>;
52
57
  onDispose(): void;
53
58
  }
54
59
  export {};
@@ -1,5 +1,5 @@
1
- export declare const tryResolveFilePath: (cwd: string, specifier: string, acceptModuleSpecifier?: boolean) => any;
2
- export declare const tryResolveSpecifiers: (cwd: string, specifiers: string[]) => any;
3
- export declare const stripVersionFromSpecifier: (specifier: string) => any;
4
- export declare const trimBinary: (command: string) => any;
5
- export declare const argsFrom: (args: string[], from: string) => any;
1
+ export declare const tryResolveFilePath: (cwd: string, specifier: string, acceptModuleSpecifier?: boolean) => string | undefined;
2
+ export declare const tryResolveSpecifiers: (cwd: string, specifiers: string[]) => (string | undefined)[];
3
+ export declare const stripVersionFromSpecifier: (specifier: string) => string;
4
+ export declare const trimBinary: (command: string) => string;
5
+ export declare const argsFrom: (args: string[], from: string) => string[];
@@ -1,6 +1,6 @@
1
1
  import type { HasDependency } from './types.js';
2
2
  declare const _default: {
3
3
  condition: (hasDependency: HasDependency) => boolean;
4
- compiler: (text: string) => any;
4
+ compiler: (text: string) => string;
5
5
  };
6
6
  export default _default;
@@ -1,4 +1,4 @@
1
1
  import type { SyncCompilerFn } from './types.js';
2
- export declare const importMatcher: {};
3
- export declare const fencedCodeBlockMatcher: {};
2
+ export declare const importMatcher: RegExp;
3
+ export declare const fencedCodeBlockMatcher: RegExp;
4
4
  export declare const importsWithinScripts: SyncCompilerFn;