knip 5.66.2 → 5.66.3

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.
@@ -163,7 +163,7 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
163
163
  for (const [filePath, file] of graph.entries()) {
164
164
  const ws = chief.findWorkspaceByFilePath(filePath);
165
165
  if (ws) {
166
- if (file.duplicates) {
166
+ if (file.duplicates && options.includedIssueTypes.duplicates) {
167
167
  for (const symbols of file.duplicates) {
168
168
  if (symbols.length > 1) {
169
169
  const symbol = symbols.map(s => s.symbol).join('|');
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import type { MainOptions } from './util/create-options.js';
2
- export type { RawConfiguration as KnipConfig } from './types/config.js';
3
- export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.js';
4
2
  export declare const main: (options: MainOptions) => Promise<{
5
3
  issues: import("./types/issues.js").Issues;
6
4
  counters: import("./types/issues.js").Counters;
@@ -7,7 +7,7 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
7
  const config = ['next.config.{js,ts,cjs,mjs}'];
8
8
  const defaultPageExtensions = ['{js,jsx,ts,tsx}'];
9
9
  const productionEntryFilePatterns = [
10
- '{instrumentation,instrumentation-client,middleware}.{js,ts}',
10
+ '{instrumentation,instrumentation-client,middleware,proxy}.{js,ts}',
11
11
  'app/global-error.{js,jsx,ts,tsx}',
12
12
  'app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx}',
13
13
  'app/**/route.{js,jsx,ts,tsx}',
@@ -16,6 +16,7 @@ export const getEnvPackageName = (env) => {
16
16
  };
17
17
  const builtInReporters = [
18
18
  'basic',
19
+ 'blob',
19
20
  'default',
20
21
  'dot',
21
22
  'github-actions',
@@ -25,6 +26,7 @@ const builtInReporters = [
25
26
  'junit',
26
27
  'tap',
27
28
  'tap-flat',
29
+ 'tree',
28
30
  'verbose',
29
31
  ];
30
32
  export const getExternalReporters = (reporters) => reporters
@@ -1,11 +1,11 @@
1
1
  declare const _default: {
2
- symbols: (options: import("../index.js").ReporterOptions) => void;
3
- compact: ({ report, issues, isShowProgress, cwd }: import("../index.js").ReporterOptions) => void;
4
- codeowners: ({ report, issues, isShowProgress, options, cwd }: import("../index.js").ReporterOptions) => void;
5
- disclosure: ({ report, issues, cwd }: import("../index.js").ReporterOptions) => void;
6
- codeclimate: ({ report, issues, cwd }: import("../index.js").ReporterOptions) => Promise<void>;
7
- json: ({ report, issues, options, cwd }: import("../index.js").ReporterOptions) => Promise<void>;
8
- markdown: ({ report, issues, cwd }: import("../index.js").ReporterOptions) => void;
9
- 'github-actions': ({ report, issues, cwd, configurationHints, isDisableConfigHints, isTreatConfigHintsAsErrors, configFilePath, }: import("../index.js").ReporterOptions) => void;
2
+ symbols: (options: import("../types.js").ReporterOptions) => void;
3
+ compact: ({ report, issues, isShowProgress, cwd }: import("../types.js").ReporterOptions) => void;
4
+ codeowners: ({ report, issues, isShowProgress, options, cwd }: import("../types.js").ReporterOptions) => void;
5
+ disclosure: ({ report, issues, cwd }: import("../types.js").ReporterOptions) => void;
6
+ codeclimate: ({ report, issues, cwd }: import("../types.js").ReporterOptions) => Promise<void>;
7
+ json: ({ report, issues, options, cwd }: import("../types.js").ReporterOptions) => Promise<void>;
8
+ markdown: ({ report, issues, cwd }: import("../types.js").ReporterOptions) => void;
9
+ 'github-actions': ({ report, issues, cwd, configurationHints, isDisableConfigHints, isTreatConfigHintsAsErrors, configFilePath, }: import("../types.js").ReporterOptions) => void;
10
10
  };
11
11
  export default _default;
@@ -0,0 +1,2 @@
1
+ export type { RawConfiguration as KnipConfig } from './types/config.js';
2
+ export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.js';
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -33,7 +33,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
33
33
  return {
34
34
  node: element,
35
35
  symbol: element.symbol,
36
- identifier: element.getText(),
36
+ identifier: element.name.getText(),
37
37
  type: SYMBOL_TYPE.UNKNOWN,
38
38
  pos: element.getStart(),
39
39
  fix,
@@ -37,7 +37,7 @@ export default visit(() => true, node => {
37
37
  specifier,
38
38
  symbol: element.symbol,
39
39
  isTypeOnly: node.importClause?.isTypeOnly,
40
- pos: element.pos,
40
+ pos: element.getStart(),
41
41
  });
42
42
  }
43
43
  }
@@ -58,6 +58,10 @@ export const createOptions = async (options) => {
58
58
  ...(parsedCLIArgs.files ? shorthandFiles : []),
59
59
  ],
60
60
  });
61
+ for (const [key, value] of Object.entries(includedIssueTypes)) {
62
+ if (!value)
63
+ rules[key] = 'off';
64
+ }
61
65
  const fixTypes = rest.fixTypes ?? parsedCLIArgs['fix-type'] ?? [];
62
66
  const isFixFiles = parsedCLIArgs['allow-remove-files'] && (fixTypes.length === 0 || fixTypes.includes('files'));
63
67
  const isIncludeLibs = parsedCLIArgs['include-libs'] ?? rest.isIncludeLibs ?? false;
@@ -24,9 +24,8 @@ export const updateImportMap = (file, importMap, graph) => {
24
24
  updateImportDetails(importedFileImports, importDetails);
25
25
  const importedFile = getOrCreateFileNode(graph, importedFilePath);
26
26
  if (!importedFile.imported)
27
- importedFile.imported = importDetails;
28
- else
29
- updateImportDetails(importedFile.imported, importDetails);
27
+ importedFile.imported = createImports();
28
+ updateImportDetails(importedFile.imported, importDetails);
30
29
  graph.set(importedFilePath, importedFile);
31
30
  }
32
31
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.66.2";
1
+ export declare const version = "5.66.3";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.66.2';
1
+ export const version = '5.66.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.66.2",
3
+ "version": "5.66.3",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "knip-bun": "bin/knip-bun.js"
31
31
  },
32
32
  "type": "module",
33
- "types": "./dist/index.d.ts",
33
+ "types": "./dist/types.d.ts",
34
34
  "scripts": {
35
35
  "knip": "node ./dist/cli.js --directory ../..",
36
36
  "knip:production": "node ./dist/cli.js --directory ../.. --production --strict",