tz-clean 2.3.2 → 2.4.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.
- package/.dependency-cruiser.cjs +93 -94
- package/.github/workflows/ci.yml +42 -42
- package/.prettierrc +9 -9
- package/README-DEV.md +123 -123
- package/README-USER.md +105 -105
- 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 +72 -66
- package/index.js +386 -428
- package/knip.json +5 -5
- package/package.json +67 -67
- package/report-template.html +357 -357
- package/tsconfig.json +16 -16
package/report-template.html
CHANGED
|
@@ -1,357 +1,357 @@
|
|
|
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 = /* REPORT_DATA_PLACEHOLDER */ null;
|
|
258
|
-
const FIXED_FILES = /* FIXED_FILES_PLACEHOLDER */ [];
|
|
259
|
-
|
|
260
|
-
document.getElementById('timestamp').innerText = new Date().toLocaleString();
|
|
261
|
-
|
|
262
|
-
let totalErrors = 0;
|
|
263
|
-
let totalWarnings = 0;
|
|
264
|
-
let filesWithIssues = 0;
|
|
265
|
-
|
|
266
|
-
if (FIXED_FILES && FIXED_FILES.length > 0) {
|
|
267
|
-
document.getElementById('fixed-results').style.display = 'block';
|
|
268
|
-
const fixedList = document.getElementById('fixed-files-list');
|
|
269
|
-
let fixedHtml = '<ul style="list-style: none; padding: 0;">';
|
|
270
|
-
FIXED_FILES.forEach((file) => {
|
|
271
|
-
fixedHtml += `<li style="margin-bottom: 0.5rem; color: var(--success); font-family: monospace;">✔️ ${file}</li>`;
|
|
272
|
-
});
|
|
273
|
-
fixedHtml += '</ul>';
|
|
274
|
-
fixedList.innerHTML = fixedHtml;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
const resultsContainer = document.getElementById('results');
|
|
278
|
-
|
|
279
|
-
if (!REPORT_DATA || REPORT_DATA.length === 0) {
|
|
280
|
-
resultsContainer.innerHTML = `
|
|
281
|
-
<div class="empty-state">
|
|
282
|
-
<div class="empty-icon">🎉</div>
|
|
283
|
-
<h2>Perfect Code!</h2>
|
|
284
|
-
<p style="color: var(--text-muted); margin-top: 0.5rem">No issues found. Your code is clean.</p>
|
|
285
|
-
</div>
|
|
286
|
-
`;
|
|
287
|
-
} else {
|
|
288
|
-
const problematicFiles = REPORT_DATA.filter((file) => file.errorCount > 0 || file.warningCount > 0);
|
|
289
|
-
|
|
290
|
-
if (problematicFiles.length === 0) {
|
|
291
|
-
resultsContainer.innerHTML = `
|
|
292
|
-
<div class="empty-state">
|
|
293
|
-
<div class="empty-icon">🎉</div>
|
|
294
|
-
<h2>Perfect Code!</h2>
|
|
295
|
-
<p style="color: var(--text-muted); margin-top: 0.5rem">No issues found. Your code is clean.</p>
|
|
296
|
-
</div>
|
|
297
|
-
`;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
problematicFiles.forEach((file) => {
|
|
301
|
-
totalErrors += file.errorCount;
|
|
302
|
-
totalWarnings += file.warningCount;
|
|
303
|
-
filesWithIssues++;
|
|
304
|
-
|
|
305
|
-
const relativePath = file.filePath.replace(window.location.origin, '').split('\\').pop().split('/').pop();
|
|
306
|
-
|
|
307
|
-
const fileCard = document.createElement('div');
|
|
308
|
-
fileCard.className = 'file-card';
|
|
309
|
-
|
|
310
|
-
let badgesHtml = '';
|
|
311
|
-
if (file.errorCount > 0) badgesHtml += `<span class="badge error">${file.errorCount} Errors</span>`;
|
|
312
|
-
if (file.warningCount > 0) badgesHtml += `<span class="badge warning">${file.warningCount} Warnings</span>`;
|
|
313
|
-
|
|
314
|
-
let messagesHtml = '<ul class="issue-list">';
|
|
315
|
-
file.messages.forEach((msg) => {
|
|
316
|
-
const typeColor = msg.severity === 2 ? 'var(--error)' : 'var(--warning)';
|
|
317
|
-
messagesHtml += `
|
|
318
|
-
<li class="issue-item">
|
|
319
|
-
<div class="issue-line">L${msg.line}:${msg.column}</div>
|
|
320
|
-
<div class="issue-content">
|
|
321
|
-
<div class="issue-message" style="color: ${typeColor}">${msg.message}</div>
|
|
322
|
-
<div class="issue-rule">${msg.ruleId || 'syntax'}</div>
|
|
323
|
-
</div>
|
|
324
|
-
</li>
|
|
325
|
-
`;
|
|
326
|
-
});
|
|
327
|
-
messagesHtml += '</ul>';
|
|
328
|
-
|
|
329
|
-
fileCard.innerHTML = `
|
|
330
|
-
<div class="file-header">
|
|
331
|
-
<div class="file-path">${file.filePath}</div>
|
|
332
|
-
<div class="badges">${badgesHtml}</div>
|
|
333
|
-
</div>
|
|
334
|
-
${messagesHtml}
|
|
335
|
-
`;
|
|
336
|
-
resultsContainer.appendChild(fileCard);
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
document.getElementById('stat-files').innerText = REPORT_DATA ? REPORT_DATA.length : 0;
|
|
341
|
-
|
|
342
|
-
const errEl = document.getElementById('stat-errors');
|
|
343
|
-
errEl.innerText = totalErrors;
|
|
344
|
-
if (totalErrors === 0) {
|
|
345
|
-
errEl.classList.remove('error');
|
|
346
|
-
errEl.classList.add('success');
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const warnEl = document.getElementById('stat-warnings');
|
|
350
|
-
warnEl.innerText = totalWarnings;
|
|
351
|
-
if (totalWarnings === 0) {
|
|
352
|
-
warnEl.classList.remove('warning');
|
|
353
|
-
warnEl.classList.add('success');
|
|
354
|
-
}
|
|
355
|
-
</script>
|
|
356
|
-
</body>
|
|
357
|
-
</html>
|
|
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 = /* REPORT_DATA_PLACEHOLDER */ null;
|
|
258
|
+
const FIXED_FILES = /* FIXED_FILES_PLACEHOLDER */ [];
|
|
259
|
+
|
|
260
|
+
document.getElementById('timestamp').innerText = new Date().toLocaleString();
|
|
261
|
+
|
|
262
|
+
let totalErrors = 0;
|
|
263
|
+
let totalWarnings = 0;
|
|
264
|
+
let filesWithIssues = 0;
|
|
265
|
+
|
|
266
|
+
if (FIXED_FILES && FIXED_FILES.length > 0) {
|
|
267
|
+
document.getElementById('fixed-results').style.display = 'block';
|
|
268
|
+
const fixedList = document.getElementById('fixed-files-list');
|
|
269
|
+
let fixedHtml = '<ul style="list-style: none; padding: 0;">';
|
|
270
|
+
FIXED_FILES.forEach((file) => {
|
|
271
|
+
fixedHtml += `<li style="margin-bottom: 0.5rem; color: var(--success); font-family: monospace;">✔️ ${file}</li>`;
|
|
272
|
+
});
|
|
273
|
+
fixedHtml += '</ul>';
|
|
274
|
+
fixedList.innerHTML = fixedHtml;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const resultsContainer = document.getElementById('results');
|
|
278
|
+
|
|
279
|
+
if (!REPORT_DATA || REPORT_DATA.length === 0) {
|
|
280
|
+
resultsContainer.innerHTML = `
|
|
281
|
+
<div class="empty-state">
|
|
282
|
+
<div class="empty-icon">🎉</div>
|
|
283
|
+
<h2>Perfect Code!</h2>
|
|
284
|
+
<p style="color: var(--text-muted); margin-top: 0.5rem">No issues found. Your code is clean.</p>
|
|
285
|
+
</div>
|
|
286
|
+
`;
|
|
287
|
+
} else {
|
|
288
|
+
const problematicFiles = REPORT_DATA.filter((file) => file.errorCount > 0 || file.warningCount > 0);
|
|
289
|
+
|
|
290
|
+
if (problematicFiles.length === 0) {
|
|
291
|
+
resultsContainer.innerHTML = `
|
|
292
|
+
<div class="empty-state">
|
|
293
|
+
<div class="empty-icon">🎉</div>
|
|
294
|
+
<h2>Perfect Code!</h2>
|
|
295
|
+
<p style="color: var(--text-muted); margin-top: 0.5rem">No issues found. Your code is clean.</p>
|
|
296
|
+
</div>
|
|
297
|
+
`;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
problematicFiles.forEach((file) => {
|
|
301
|
+
totalErrors += file.errorCount;
|
|
302
|
+
totalWarnings += file.warningCount;
|
|
303
|
+
filesWithIssues++;
|
|
304
|
+
|
|
305
|
+
const relativePath = file.filePath.replace(window.location.origin, '').split('\\').pop().split('/').pop();
|
|
306
|
+
|
|
307
|
+
const fileCard = document.createElement('div');
|
|
308
|
+
fileCard.className = 'file-card';
|
|
309
|
+
|
|
310
|
+
let badgesHtml = '';
|
|
311
|
+
if (file.errorCount > 0) badgesHtml += `<span class="badge error">${file.errorCount} Errors</span>`;
|
|
312
|
+
if (file.warningCount > 0) badgesHtml += `<span class="badge warning">${file.warningCount} Warnings</span>`;
|
|
313
|
+
|
|
314
|
+
let messagesHtml = '<ul class="issue-list">';
|
|
315
|
+
file.messages.forEach((msg) => {
|
|
316
|
+
const typeColor = msg.severity === 2 ? 'var(--error)' : 'var(--warning)';
|
|
317
|
+
messagesHtml += `
|
|
318
|
+
<li class="issue-item">
|
|
319
|
+
<div class="issue-line">L${msg.line}:${msg.column}</div>
|
|
320
|
+
<div class="issue-content">
|
|
321
|
+
<div class="issue-message" style="color: ${typeColor}">${msg.message}</div>
|
|
322
|
+
<div class="issue-rule">${msg.ruleId || 'syntax'}</div>
|
|
323
|
+
</div>
|
|
324
|
+
</li>
|
|
325
|
+
`;
|
|
326
|
+
});
|
|
327
|
+
messagesHtml += '</ul>';
|
|
328
|
+
|
|
329
|
+
fileCard.innerHTML = `
|
|
330
|
+
<div class="file-header">
|
|
331
|
+
<div class="file-path">${file.filePath}</div>
|
|
332
|
+
<div class="badges">${badgesHtml}</div>
|
|
333
|
+
</div>
|
|
334
|
+
${messagesHtml}
|
|
335
|
+
`;
|
|
336
|
+
resultsContainer.appendChild(fileCard);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
document.getElementById('stat-files').innerText = REPORT_DATA ? REPORT_DATA.length : 0;
|
|
341
|
+
|
|
342
|
+
const errEl = document.getElementById('stat-errors');
|
|
343
|
+
errEl.innerText = totalErrors;
|
|
344
|
+
if (totalErrors === 0) {
|
|
345
|
+
errEl.classList.remove('error');
|
|
346
|
+
errEl.classList.add('success');
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const warnEl = document.getElementById('stat-warnings');
|
|
350
|
+
warnEl.innerText = totalWarnings;
|
|
351
|
+
if (totalWarnings === 0) {
|
|
352
|
+
warnEl.classList.remove('warning');
|
|
353
|
+
warnEl.classList.add('success');
|
|
354
|
+
}
|
|
355
|
+
</script>
|
|
356
|
+
</body>
|
|
357
|
+
</html>
|