tz-clean 2.0.0 → 2.0.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/.dependency-cruiser.cjs +94 -94
- package/.github/workflows/ci.yml +42 -42
- package/.husky/commit-msg +1 -1
- package/.husky/pre-commit +1 -1
- package/.husky/pre-push +3 -3
- package/.prettierrc +9 -9
- package/README-DEV.md +123 -123
- package/README-USER.md +56 -56
- package/README.md +16 -16
- package/__tests__/cli.test.js +8 -8
- package/commitlint.config.js +1 -1
- package/cspell.json +33 -33
- package/eslint.config.mjs +52 -52
- package/index.js +262 -261
- package/knip.json +5 -5
- package/package.json +67 -67
- package/report-template.html +357 -357
- package/tsconfig.json +16 -16
- package/.tz-clean-report.html +0 -413
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"checkJs": false,
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
15
|
-
"exclude": ["node_modules", "dist", "coverage"]
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"checkJs": false,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
15
|
+
"exclude": ["node_modules", "dist", "coverage"]
|
|
16
|
+
}
|
package/.tz-clean-report.html
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>tz-clean Analysis Report</title>
|
|
7
|
-
<style>
|
|
8
|
-
:root {
|
|
9
|
-
--bg-color: #0f172a;
|
|
10
|
-
--card-bg: #1e293b;
|
|
11
|
-
--text-main: #f8fafc;
|
|
12
|
-
--text-muted: #94a3b8;
|
|
13
|
-
--accent: #3b82f6;
|
|
14
|
-
--error: #ef4444;
|
|
15
|
-
--warning: #f59e0b;
|
|
16
|
-
--success: #10b981;
|
|
17
|
-
--border: #334155;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
* {
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
margin: 0;
|
|
23
|
-
padding: 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
body {
|
|
27
|
-
font-family:
|
|
28
|
-
'Inter',
|
|
29
|
-
-apple-system,
|
|
30
|
-
BlinkMacSystemFont,
|
|
31
|
-
'Segoe UI',
|
|
32
|
-
Roboto,
|
|
33
|
-
Helvetica,
|
|
34
|
-
Arial,
|
|
35
|
-
sans-serif;
|
|
36
|
-
background-color: var(--bg-color);
|
|
37
|
-
color: var(--text-main);
|
|
38
|
-
line-height: 1.6;
|
|
39
|
-
padding: 2rem;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.container {
|
|
43
|
-
max-width: 1000px;
|
|
44
|
-
margin: 0 auto;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
header {
|
|
48
|
-
text-align: center;
|
|
49
|
-
margin-bottom: 2rem;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
h1 {
|
|
53
|
-
font-size: 2.5rem;
|
|
54
|
-
font-weight: 700;
|
|
55
|
-
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
|
56
|
-
-webkit-background-clip: text;
|
|
57
|
-
background-clip: text;
|
|
58
|
-
-webkit-text-fill-color: transparent;
|
|
59
|
-
margin-bottom: 0.5rem;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.dashboard-grid {
|
|
63
|
-
display: grid;
|
|
64
|
-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
65
|
-
gap: 1.5rem;
|
|
66
|
-
margin-bottom: 2.5rem;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.stat-card {
|
|
70
|
-
background-color: var(--card-bg);
|
|
71
|
-
border: 1px solid var(--border);
|
|
72
|
-
border-radius: 12px;
|
|
73
|
-
padding: 1.5rem;
|
|
74
|
-
text-align: center;
|
|
75
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
76
|
-
transition:
|
|
77
|
-
transform 0.2s ease,
|
|
78
|
-
box-shadow 0.2s ease;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.stat-card:hover {
|
|
82
|
-
transform: translateY(-5px);
|
|
83
|
-
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.stat-title {
|
|
87
|
-
font-size: 1rem;
|
|
88
|
-
color: var(--text-muted);
|
|
89
|
-
text-transform: uppercase;
|
|
90
|
-
letter-spacing: 1px;
|
|
91
|
-
}
|
|
92
|
-
.stat-value {
|
|
93
|
-
font-size: 3rem;
|
|
94
|
-
font-weight: 800;
|
|
95
|
-
margin-top: 0.5rem;
|
|
96
|
-
}
|
|
97
|
-
.stat-value.error {
|
|
98
|
-
color: var(--error);
|
|
99
|
-
}
|
|
100
|
-
.stat-value.warning {
|
|
101
|
-
color: var(--warning);
|
|
102
|
-
}
|
|
103
|
-
.stat-value.success {
|
|
104
|
-
color: var(--success);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.file-list {
|
|
108
|
-
display: flex;
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
gap: 1rem;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.file-card {
|
|
114
|
-
background-color: var(--card-bg);
|
|
115
|
-
border: 1px solid var(--border);
|
|
116
|
-
border-radius: 12px;
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.file-header {
|
|
121
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
122
|
-
padding: 1rem 1.5rem;
|
|
123
|
-
display: flex;
|
|
124
|
-
justify-content: space-between;
|
|
125
|
-
align-items: center;
|
|
126
|
-
border-bottom: 1px solid var(--border);
|
|
127
|
-
font-weight: 600;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.file-path {
|
|
131
|
-
font-family: monospace;
|
|
132
|
-
font-size: 0.95rem;
|
|
133
|
-
color: #e2e8f0;
|
|
134
|
-
word-break: break-all;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.badges {
|
|
138
|
-
display: flex;
|
|
139
|
-
gap: 0.5rem;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.badge {
|
|
143
|
-
padding: 0.25rem 0.75rem;
|
|
144
|
-
border-radius: 9999px;
|
|
145
|
-
font-size: 0.75rem;
|
|
146
|
-
font-weight: 700;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.badge.error {
|
|
150
|
-
background-color: rgba(239, 68, 68, 0.2);
|
|
151
|
-
color: #fca5a5;
|
|
152
|
-
border: 1px solid rgba(239, 68, 68, 0.3);
|
|
153
|
-
}
|
|
154
|
-
.badge.warning {
|
|
155
|
-
background-color: rgba(245, 158, 11, 0.2);
|
|
156
|
-
color: #fcd34d;
|
|
157
|
-
border: 1px solid rgba(245, 158, 11, 0.3);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.issue-list {
|
|
161
|
-
list-style: none;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.issue-item {
|
|
165
|
-
padding: 1rem 1.5rem;
|
|
166
|
-
border-bottom: 1px solid rgba(51, 65, 85, 0.5);
|
|
167
|
-
display: flex;
|
|
168
|
-
gap: 1rem;
|
|
169
|
-
align-items: flex-start;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.issue-item:last-child {
|
|
173
|
-
border-bottom: none;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.issue-line {
|
|
177
|
-
font-family: monospace;
|
|
178
|
-
background-color: #0f172a;
|
|
179
|
-
padding: 0.25rem 0.5rem;
|
|
180
|
-
border-radius: 4px;
|
|
181
|
-
color: var(--text-muted);
|
|
182
|
-
font-size: 0.85rem;
|
|
183
|
-
min-width: 60px;
|
|
184
|
-
text-align: center;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.issue-content {
|
|
188
|
-
flex: 1;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.issue-message {
|
|
192
|
-
font-size: 0.95rem;
|
|
193
|
-
margin-bottom: 0.25rem;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.issue-rule {
|
|
197
|
-
font-size: 0.8rem;
|
|
198
|
-
color: var(--text-muted);
|
|
199
|
-
font-family: monospace;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.empty-state {
|
|
203
|
-
text-align: center;
|
|
204
|
-
padding: 4rem 2rem;
|
|
205
|
-
background-color: var(--card-bg);
|
|
206
|
-
border-radius: 12px;
|
|
207
|
-
border: 1px dashed var(--border);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.empty-icon {
|
|
211
|
-
font-size: 4rem;
|
|
212
|
-
margin-bottom: 1rem;
|
|
213
|
-
}
|
|
214
|
-
</style>
|
|
215
|
-
</head>
|
|
216
|
-
<body>
|
|
217
|
-
<div class="container">
|
|
218
|
-
<header>
|
|
219
|
-
<h1>tz-clean Analysis Report</h1>
|
|
220
|
-
<p style="color: var(--text-muted)" id="timestamp"></p>
|
|
221
|
-
</header>
|
|
222
|
-
|
|
223
|
-
<div class="dashboard-grid">
|
|
224
|
-
<div class="stat-card">
|
|
225
|
-
<div class="stat-title">Files Analyzed</div>
|
|
226
|
-
<div class="stat-value" id="stat-files">0</div>
|
|
227
|
-
</div>
|
|
228
|
-
<div class="stat-card">
|
|
229
|
-
<div class="stat-title">Errors</div>
|
|
230
|
-
<div class="stat-value error" id="stat-errors">0</div>
|
|
231
|
-
</div>
|
|
232
|
-
<div class="stat-card">
|
|
233
|
-
<div class="stat-title">Warnings</div>
|
|
234
|
-
<div class="stat-value warning" id="stat-warnings">0</div>
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
|
|
238
|
-
<div id="fixed-results" class="file-list" style="margin-bottom: 2rem; display: none">
|
|
239
|
-
<h2 style="margin-bottom: 1rem; color: var(--text-main)">✨ Auto-Fixed (Formatted)</h2>
|
|
240
|
-
<div
|
|
241
|
-
id="fixed-files-list"
|
|
242
|
-
style="
|
|
243
|
-
background: var(--card-bg);
|
|
244
|
-
padding: 1rem 1.5rem;
|
|
245
|
-
border-radius: 8px;
|
|
246
|
-
border: 1px solid var(--border);
|
|
247
|
-
"></div>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<div id="results" class="file-list">
|
|
251
|
-
<!-- Generated content goes here -->
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
<script>
|
|
256
|
-
// Injected by CLI
|
|
257
|
-
const REPORT_DATA = [
|
|
258
|
-
{
|
|
259
|
-
filePath: 'C:\\Users\\Admin\\Downloads\\clean-code\\.dependency-cruiser.cjs',
|
|
260
|
-
messages: [],
|
|
261
|
-
suppressedMessages: [],
|
|
262
|
-
errorCount: 0,
|
|
263
|
-
fatalErrorCount: 0,
|
|
264
|
-
warningCount: 0,
|
|
265
|
-
fixableErrorCount: 0,
|
|
266
|
-
fixableWarningCount: 0,
|
|
267
|
-
usedDeprecatedRules: [],
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
filePath: 'C:\\Users\\Admin\\Downloads\\clean-code\\__tests__\\cli.test.js',
|
|
271
|
-
messages: [],
|
|
272
|
-
suppressedMessages: [],
|
|
273
|
-
errorCount: 0,
|
|
274
|
-
fatalErrorCount: 0,
|
|
275
|
-
warningCount: 0,
|
|
276
|
-
fixableErrorCount: 0,
|
|
277
|
-
fixableWarningCount: 0,
|
|
278
|
-
usedDeprecatedRules: [],
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
filePath: 'C:\\Users\\Admin\\Downloads\\clean-code\\commitlint.config.js',
|
|
282
|
-
messages: [],
|
|
283
|
-
suppressedMessages: [],
|
|
284
|
-
errorCount: 0,
|
|
285
|
-
fatalErrorCount: 0,
|
|
286
|
-
warningCount: 0,
|
|
287
|
-
fixableErrorCount: 0,
|
|
288
|
-
fixableWarningCount: 0,
|
|
289
|
-
usedDeprecatedRules: [],
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
filePath: 'C:\\Users\\Admin\\Downloads\\clean-code\\eslint.config.mjs',
|
|
293
|
-
messages: [],
|
|
294
|
-
suppressedMessages: [],
|
|
295
|
-
errorCount: 0,
|
|
296
|
-
fatalErrorCount: 0,
|
|
297
|
-
warningCount: 0,
|
|
298
|
-
fixableErrorCount: 0,
|
|
299
|
-
fixableWarningCount: 0,
|
|
300
|
-
usedDeprecatedRules: [],
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
filePath: 'C:\\Users\\Admin\\Downloads\\clean-code\\index.js',
|
|
304
|
-
messages: [],
|
|
305
|
-
suppressedMessages: [],
|
|
306
|
-
errorCount: 0,
|
|
307
|
-
fatalErrorCount: 0,
|
|
308
|
-
warningCount: 0,
|
|
309
|
-
fixableErrorCount: 0,
|
|
310
|
-
fixableWarningCount: 0,
|
|
311
|
-
usedDeprecatedRules: [],
|
|
312
|
-
},
|
|
313
|
-
];
|
|
314
|
-
const FIXED_FILES = [];
|
|
315
|
-
|
|
316
|
-
document.getElementById('timestamp').innerText = new Date().toLocaleString();
|
|
317
|
-
|
|
318
|
-
let totalErrors = 0;
|
|
319
|
-
let totalWarnings = 0;
|
|
320
|
-
let filesWithIssues = 0;
|
|
321
|
-
|
|
322
|
-
if (FIXED_FILES && FIXED_FILES.length > 0) {
|
|
323
|
-
document.getElementById('fixed-results').style.display = 'block';
|
|
324
|
-
const fixedList = document.getElementById('fixed-files-list');
|
|
325
|
-
let fixedHtml = '<ul style="list-style: none; padding: 0;">';
|
|
326
|
-
FIXED_FILES.forEach((file) => {
|
|
327
|
-
fixedHtml += `<li style="margin-bottom: 0.5rem; color: var(--success); font-family: monospace;">✔️ ${file}</li>`;
|
|
328
|
-
});
|
|
329
|
-
fixedHtml += '</ul>';
|
|
330
|
-
fixedList.innerHTML = fixedHtml;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const resultsContainer = document.getElementById('results');
|
|
334
|
-
|
|
335
|
-
if (!REPORT_DATA || REPORT_DATA.length === 0) {
|
|
336
|
-
resultsContainer.innerHTML = `
|
|
337
|
-
<div class="empty-state">
|
|
338
|
-
<div class="empty-icon">🎉</div>
|
|
339
|
-
<h2>Perfect Code!</h2>
|
|
340
|
-
<p style="color: var(--text-muted); margin-top: 0.5rem">No issues found. Your code is clean.</p>
|
|
341
|
-
</div>
|
|
342
|
-
`;
|
|
343
|
-
} else {
|
|
344
|
-
const problematicFiles = REPORT_DATA.filter((file) => file.errorCount > 0 || file.warningCount > 0);
|
|
345
|
-
|
|
346
|
-
if (problematicFiles.length === 0) {
|
|
347
|
-
resultsContainer.innerHTML = `
|
|
348
|
-
<div class="empty-state">
|
|
349
|
-
<div class="empty-icon">🎉</div>
|
|
350
|
-
<h2>Perfect Code!</h2>
|
|
351
|
-
<p style="color: var(--text-muted); margin-top: 0.5rem">No issues found. Your code is clean.</p>
|
|
352
|
-
</div>
|
|
353
|
-
`;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
problematicFiles.forEach((file) => {
|
|
357
|
-
totalErrors += file.errorCount;
|
|
358
|
-
totalWarnings += file.warningCount;
|
|
359
|
-
filesWithIssues++;
|
|
360
|
-
|
|
361
|
-
const relativePath = file.filePath.replace(window.location.origin, '').split('\\').pop().split('/').pop();
|
|
362
|
-
|
|
363
|
-
const fileCard = document.createElement('div');
|
|
364
|
-
fileCard.className = 'file-card';
|
|
365
|
-
|
|
366
|
-
let badgesHtml = '';
|
|
367
|
-
if (file.errorCount > 0) badgesHtml += `<span class="badge error">${file.errorCount} Errors</span>`;
|
|
368
|
-
if (file.warningCount > 0) badgesHtml += `<span class="badge warning">${file.warningCount} Warnings</span>`;
|
|
369
|
-
|
|
370
|
-
let messagesHtml = '<ul class="issue-list">';
|
|
371
|
-
file.messages.forEach((msg) => {
|
|
372
|
-
const typeColor = msg.severity === 2 ? 'var(--error)' : 'var(--warning)';
|
|
373
|
-
messagesHtml += `
|
|
374
|
-
<li class="issue-item">
|
|
375
|
-
<div class="issue-line">L${msg.line}:${msg.column}</div>
|
|
376
|
-
<div class="issue-content">
|
|
377
|
-
<div class="issue-message" style="color: ${typeColor}">${msg.message}</div>
|
|
378
|
-
<div class="issue-rule">${msg.ruleId || 'syntax'}</div>
|
|
379
|
-
</div>
|
|
380
|
-
</li>
|
|
381
|
-
`;
|
|
382
|
-
});
|
|
383
|
-
messagesHtml += '</ul>';
|
|
384
|
-
|
|
385
|
-
fileCard.innerHTML = `
|
|
386
|
-
<div class="file-header">
|
|
387
|
-
<div class="file-path">${file.filePath}</div>
|
|
388
|
-
<div class="badges">${badgesHtml}</div>
|
|
389
|
-
</div>
|
|
390
|
-
${messagesHtml}
|
|
391
|
-
`;
|
|
392
|
-
resultsContainer.appendChild(fileCard);
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
document.getElementById('stat-files').innerText = REPORT_DATA ? REPORT_DATA.length : 0;
|
|
397
|
-
|
|
398
|
-
const errEl = document.getElementById('stat-errors');
|
|
399
|
-
errEl.innerText = totalErrors;
|
|
400
|
-
if (totalErrors === 0) {
|
|
401
|
-
errEl.classList.remove('error');
|
|
402
|
-
errEl.classList.add('success');
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const warnEl = document.getElementById('stat-warnings');
|
|
406
|
-
warnEl.innerText = totalWarnings;
|
|
407
|
-
if (totalWarnings === 0) {
|
|
408
|
-
warnEl.classList.remove('warning');
|
|
409
|
-
warnEl.classList.add('success');
|
|
410
|
-
}
|
|
411
|
-
</script>
|
|
412
|
-
</body>
|
|
413
|
-
</html>
|