knip 2.8.0 → 2.8.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/README.md CHANGED
@@ -136,6 +136,7 @@ Using workspaces in a monorepo? Please see [workspaces][1] for more details abou
136
136
  -n, --no-progress Don't show dynamic progress updates
137
137
  --reporter Select reporter: symbols, compact, codeowners, json (default: symbols)
138
138
  --reporter-options Pass extra options to the reporter (as JSON string, see example)
139
+ --no-config-hints Suppress configuration hints
139
140
  --no-exit-code Always exit with code zero (0)
140
141
  --max-issues Maximum number of issues before non-zero exit code (default: 0)
141
142
  -d, --debug Show debug output
@@ -166,7 +166,7 @@ export class DependencyDeputy {
166
166
  .filter(isNotIgnoredBinary)
167
167
  .filter(isNotReferencedDependency)
168
168
  .forEach(symbol => devDependencyIssues.push({ type: 'devDependencies', filePath: manifestPath, symbol }));
169
- const isReferencedDep = (name) => ![...pd, ...dd].includes(name) && referencedDependencies?.has(name);
169
+ const isReferencedDep = (name) => !([...pd, ...dd].includes(name) && referencedDependencies?.has(name));
170
170
  const isReferencedBin = (name) => !installedBinaries?.has(name) && referencedBinaries?.has(name);
171
171
  ignoreDependencies
172
172
  .filter(packageName => IGNORED_DEPENDENCIES.includes(packageName) || !isReferencedDep(packageName))
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { cwd, resolve } from './util/path.js';
9
9
  import { Performance } from './util/Performance.js';
10
10
  import { version } from './version.js';
11
11
  import { main } from './index.js';
12
- const { debug: isDebug = false, help: isHelp, 'max-issues': maxIssues = '0', 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = false, performance: isObservePerf = false, production: isProduction = false, reporter = 'symbols', 'reporter-options': reporterOptions = '', strict: isStrict = false, tsConfig, version: isVersion, } = parsedArgValues;
12
+ const { debug: isDebug = false, help: isHelp, 'max-issues': maxIssues = '0', 'no-config-hints': noConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = false, performance: isObservePerf = false, production: isProduction = false, reporter = 'symbols', 'reporter-options': reporterOptions = '', strict: isStrict = false, tsConfig, version: isVersion, } = parsedArgValues;
13
13
  if (isHelp) {
14
14
  console.log(helpText);
15
15
  process.exit(0);
@@ -31,7 +31,15 @@ const run = async () => {
31
31
  isProduction,
32
32
  isShowProgress,
33
33
  });
34
- await printReport({ report, issues, configurationHints, cwd, isProduction, options: reporterOptions });
34
+ await printReport({
35
+ report,
36
+ issues,
37
+ configurationHints,
38
+ noConfigHints,
39
+ cwd,
40
+ isProduction,
41
+ options: reporterOptions,
42
+ });
35
43
  const totalErrorCount = Object.keys(report)
36
44
  .filter(reportGroup => report[reportGroup] && rules[reportGroup] === 'error')
37
45
  .reduce((errorCount, reportGroup) => errorCount + counters[reportGroup], 0);
@@ -1,5 +1,5 @@
1
1
  declare const _default: {
2
- symbols: ({ report, issues, configurationHints }: import("../index.js").ReporterOptions) => void;
2
+ symbols: ({ report, issues, configurationHints, noConfigHints }: import("../index.js").ReporterOptions) => void;
3
3
  compact: ({ report, issues }: import("../index.js").ReporterOptions) => void;
4
4
  codeowners: ({ report, issues, options }: import("../index.js").ReporterOptions) => void;
5
5
  json: ({ report, issues, options }: import("../index.js").ReporterOptions) => Promise<void>;
@@ -1,3 +1,3 @@
1
1
  import type { ReporterOptions } from '../types/issues.js';
2
- declare const _default: ({ report, issues, configurationHints }: ReporterOptions) => void;
2
+ declare const _default: ({ report, issues, configurationHints, noConfigHints }: ReporterOptions) => void;
3
3
  export default _default;
@@ -17,7 +17,7 @@ const logIssueRecord = (issues) => {
17
17
  });
18
18
  console.log(table.sort(['filePath', 'parentSymbol', 'symbol']).print().trim());
19
19
  };
20
- export default ({ report, issues, configurationHints }) => {
20
+ export default ({ report, issues, configurationHints, noConfigHints }) => {
21
21
  const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
22
22
  let totalIssues = 0;
23
23
  for (const [reportType, isReportType] of Object.entries(report)) {
@@ -39,7 +39,7 @@ export default ({ report, issues, configurationHints }) => {
39
39
  totalIssues = totalIssues + issuesForType.length;
40
40
  }
41
41
  }
42
- if (configurationHints.size > 0) {
42
+ if (!noConfigHints && configurationHints.size > 0) {
43
43
  logTitle('Configuration issues', configurationHints.size);
44
44
  configurationHints.forEach(hint => {
45
45
  const { type, workspaceName, identifier } = hint;
@@ -43,6 +43,7 @@ export type ReporterOptions = {
43
43
  report: Report;
44
44
  issues: Issues;
45
45
  configurationHints: ConfigurationHints;
46
+ noConfigHints: boolean;
46
47
  cwd: string;
47
48
  workingDir: string;
48
49
  isProduction: boolean;
@@ -1,4 +1,4 @@
1
- export declare const helpText = "\u2702\uFE0F Find unused files, dependencies and exports in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.js, knip.ts or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no tests, devDependencies, exported types)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n --workspace Analyze a single workspace (default: analyze all configured workspaces)\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n -n, --no-progress Don't show dynamic progress updates\n --reporter Select reporter: symbols, compact, codeowners, json (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --debug-file-filter Filter for files in debug output (regex as string)\n --performance Measure count and running time of expensive functions and display stats table\n --h, --help Print this help text\n --V, version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --debug --debug-file-filter '(specific|particular)-module'\n\nMore documentation and bug reports: https://github.com/webpro/knip";
1
+ export declare const helpText = "\u2702\uFE0F Find unused files, dependencies and exports in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.js, knip.ts or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no tests, devDependencies, exported types)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n --workspace Analyze a single workspace (default: analyze all configured workspaces)\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n -n, --no-progress Don't show dynamic progress updates\n --reporter Select reporter: symbols, compact, codeowners, json (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --no-config-hints Suppress configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --debug-file-filter Filter for files in debug output (regex as string)\n --performance Measure count and running time of expensive functions and display stats table\n --h, --help Print this help text\n --V, version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --debug --debug-file-filter '(specific|particular)-module'\n\nMore documentation and bug reports: https://github.com/webpro/knip";
2
2
  declare const _default: {
3
3
  config: string | undefined;
4
4
  debug: boolean | undefined;
@@ -9,6 +9,7 @@ declare const _default: {
9
9
  help: boolean | undefined;
10
10
  include: string[] | undefined;
11
11
  'max-issues': string | undefined;
12
+ 'no-config-hints': boolean | undefined;
12
13
  'no-exit-code': boolean | undefined;
13
14
  'no-gitignore': boolean | undefined;
14
15
  'no-progress': boolean | undefined;
@@ -17,6 +17,7 @@ Options:
17
17
  -n, --no-progress Don't show dynamic progress updates
18
18
  --reporter Select reporter: symbols, compact, codeowners, json (default: symbols)
19
19
  --reporter-options Pass extra options to the reporter (as JSON string, see example)
20
+ --no-config-hints Suppress configuration hints
20
21
  --no-exit-code Always exit with code zero (0)
21
22
  --max-issues Maximum number of issues before non-zero exit code (default: 0)
22
23
  -d, --debug Show debug output
@@ -50,6 +51,7 @@ try {
50
51
  help: { type: 'boolean', short: 'h' },
51
52
  include: { type: 'string', multiple: true },
52
53
  'max-issues': { type: 'string' },
54
+ 'no-config-hints': { type: 'boolean' },
53
55
  'no-exit-code': { type: 'boolean' },
54
56
  'no-gitignore': { type: 'boolean' },
55
57
  'no-progress': { type: 'boolean', short: 'n' },
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.8.0";
1
+ export declare const version = "2.8.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.8.0';
1
+ export const version = '2.8.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
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",