knip 5.35.1 → 5.36.0
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.
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import EasyTable from 'easy-table';
|
|
2
|
+
import { relative, toRelative } from '../util/path.js';
|
|
3
|
+
import { getTitle } from './util.js';
|
|
4
|
+
const printHeader = (size, title) => console.log(`<details>${title ? `<summary>${title} (${size})</summary>` : ''}\n\n\`\`\``);
|
|
5
|
+
const printFooter = () => console.log('```\n\n</details>\n');
|
|
6
|
+
const logIssueRecord = (issues) => {
|
|
7
|
+
const table = new EasyTable();
|
|
8
|
+
for (const issue of issues) {
|
|
9
|
+
table.cell('symbol', issue.symbols ? issue.symbols.map(s => s.symbol).join(', ') : issue.symbol);
|
|
10
|
+
issue.parentSymbol && table.cell('parentSymbol', issue.parentSymbol);
|
|
11
|
+
issue.symbolType && table.cell('symbolType', issue.symbolType);
|
|
12
|
+
const pos = issue.line === undefined ? '' : `:${issue.line}${issue.col === undefined ? '' : `:${issue.col}`}`;
|
|
13
|
+
const cell = `${relative(issue.filePath)}${pos}`;
|
|
14
|
+
table.cell('filePath', cell);
|
|
15
|
+
table.newRow();
|
|
16
|
+
}
|
|
17
|
+
console.log(table.sort(['filePath', 'parentSymbol', 'symbol']).print().trim());
|
|
18
|
+
};
|
|
19
|
+
export default ({ report, issues }) => {
|
|
20
|
+
const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
|
|
21
|
+
let totalIssues = 0;
|
|
22
|
+
for (const [reportType, isReportType] of Object.entries(report)) {
|
|
23
|
+
if (reportType === '_files')
|
|
24
|
+
continue;
|
|
25
|
+
if (isReportType) {
|
|
26
|
+
const title = reportMultipleGroups ? getTitle(reportType) : undefined;
|
|
27
|
+
if (reportType === 'files') {
|
|
28
|
+
const issuesForType = Array.from(issues._files);
|
|
29
|
+
if (issuesForType.length > 0) {
|
|
30
|
+
printHeader(issuesForType.length, title);
|
|
31
|
+
const sortedIssues = issuesForType.sort((a, b) => a.filePath.localeCompare(b.filePath));
|
|
32
|
+
for (const issue of sortedIssues)
|
|
33
|
+
console.log(toRelative(issue.filePath));
|
|
34
|
+
totalIssues = totalIssues + issuesForType.length;
|
|
35
|
+
printFooter();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const issuesForType = Object.values(issues[reportType]).flatMap(Object.values);
|
|
40
|
+
if (issuesForType.length > 0) {
|
|
41
|
+
printHeader(issuesForType.length, title);
|
|
42
|
+
logIssueRecord(issuesForType);
|
|
43
|
+
totalIssues = totalIssues + issuesForType.length;
|
|
44
|
+
printFooter();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -2,6 +2,7 @@ declare const _default: {
|
|
|
2
2
|
symbols: ({ report, issues, tagHints, configurationHints, noConfigHints, isShowProgress }: import("../index.js").ReporterOptions) => void;
|
|
3
3
|
compact: ({ report, issues, isShowProgress }: import("../index.js").ReporterOptions) => void;
|
|
4
4
|
codeowners: ({ report, issues, isShowProgress, options }: import("../index.js").ReporterOptions) => void;
|
|
5
|
+
disclosure: ({ report, issues }: import("../index.js").ReporterOptions) => void;
|
|
5
6
|
json: ({ report, issues, options }: import("../index.js").ReporterOptions) => Promise<void>;
|
|
6
7
|
markdown: ({ report, issues }: import("../index.js").ReporterOptions) => void;
|
|
7
8
|
};
|
package/dist/reporters/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import codeowners from './codeowners.js';
|
|
2
2
|
import compact from './compact.js';
|
|
3
|
+
import disclosure from './disclosure.js';
|
|
3
4
|
import json from './json.js';
|
|
4
5
|
import markdown from './markdown.js';
|
|
5
6
|
import symbols from './symbols.js';
|
|
@@ -7,6 +8,7 @@ export default {
|
|
|
7
8
|
symbols,
|
|
8
9
|
compact,
|
|
9
10
|
codeowners,
|
|
11
|
+
disclosure,
|
|
10
12
|
json,
|
|
11
13
|
markdown,
|
|
12
14
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.36.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.36.0';
|