react-code-smell-detector 1.4.1 → 1.4.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/README.md +140 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +24 -0
- package/dist/bundleAnalyzer.d.ts +25 -0
- package/dist/bundleAnalyzer.d.ts.map +1 -0
- package/dist/bundleAnalyzer.js +375 -0
- package/dist/cli.js +42 -0
- package/dist/customRules.d.ts +31 -0
- package/dist/customRules.d.ts.map +1 -0
- package/dist/customRules.js +289 -0
- package/dist/detectors/complexity.d.ts +0 -4
- package/dist/detectors/complexity.d.ts.map +1 -1
- package/dist/detectors/complexity.js +1 -1
- package/dist/detectors/deadCode.d.ts +0 -7
- package/dist/detectors/deadCode.d.ts.map +1 -1
- package/dist/detectors/deadCode.js +0 -24
- package/dist/detectors/index.d.ts +2 -2
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +2 -2
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +0 -7
- package/dist/graphGenerator.d.ts +34 -0
- package/dist/graphGenerator.d.ts.map +1 -0
- package/dist/graphGenerator.js +320 -0
- package/dist/reporter.js +2 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import _traverse from '@babel/traverse';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const traverse = typeof _traverse === 'function' ? _traverse : _traverse.default;
|
|
4
|
+
/**
|
|
5
|
+
* Build dependency graph from parsed components
|
|
6
|
+
*/
|
|
7
|
+
export function buildDependencyGraph(files, rootDir) {
|
|
8
|
+
const nodes = new Map();
|
|
9
|
+
const edges = [];
|
|
10
|
+
// Create nodes
|
|
11
|
+
for (const file of files) {
|
|
12
|
+
const id = normalizeId(file.file, rootDir);
|
|
13
|
+
nodes.set(id, {
|
|
14
|
+
id,
|
|
15
|
+
file: file.file,
|
|
16
|
+
type: 'file',
|
|
17
|
+
imports: file.imports.map(imp => normalizeId(imp, rootDir)),
|
|
18
|
+
importedBy: [],
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
// Build edges
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
const fromId = normalizeId(file.file, rootDir);
|
|
24
|
+
for (const imp of file.imports) {
|
|
25
|
+
const toId = normalizeId(imp, rootDir);
|
|
26
|
+
if (nodes.has(toId)) {
|
|
27
|
+
const toNode = nodes.get(toId);
|
|
28
|
+
toNode.importedBy.push(fromId);
|
|
29
|
+
edges.push({ from: fromId, to: toId, circular: false });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Detect circular dependencies
|
|
34
|
+
const circularDependencies = detectCircularDeps(nodes);
|
|
35
|
+
for (const cycle of circularDependencies) {
|
|
36
|
+
for (let i = 0; i < cycle.length; i++) {
|
|
37
|
+
const from = cycle[i];
|
|
38
|
+
const to = cycle[(i + 1) % cycle.length];
|
|
39
|
+
const edge = edges.find(e => e.from === from && e.to === to);
|
|
40
|
+
if (edge)
|
|
41
|
+
edge.circular = true;
|
|
42
|
+
const node = nodes.get(from);
|
|
43
|
+
if (node)
|
|
44
|
+
node.isCircular = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { nodes, edges, circularDependencies };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generate SVG representation of dependency graph
|
|
51
|
+
*/
|
|
52
|
+
export function generateDependencyGraph(graph, width = 1200, height = 800) {
|
|
53
|
+
const nodeArray = Array.from(graph.nodes.values());
|
|
54
|
+
// Simple force-directed layout
|
|
55
|
+
const positions = calculateNodePositions(nodeArray, graph.edges, width, height);
|
|
56
|
+
let svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">\n`;
|
|
57
|
+
svg += `<defs>\n`;
|
|
58
|
+
svg += `<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">\n`;
|
|
59
|
+
svg += `<polygon points="0 0, 10 3.5, 0 7" fill="#666" />\n`;
|
|
60
|
+
svg += `</marker>\n`;
|
|
61
|
+
svg += `<marker id="arrowhead-circular" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">\n`;
|
|
62
|
+
svg += `<polygon points="0 0, 10 3.5, 0 7" fill="#d32f2f" />\n`;
|
|
63
|
+
svg += `</marker>\n`;
|
|
64
|
+
svg += `</defs>\n`;
|
|
65
|
+
// Draw edges
|
|
66
|
+
for (const edge of graph.edges) {
|
|
67
|
+
const fromPos = positions.get(edge.from);
|
|
68
|
+
const toPos = positions.get(edge.to);
|
|
69
|
+
if (fromPos && toPos) {
|
|
70
|
+
const color = edge.circular ? '#d32f2f' : '#999';
|
|
71
|
+
const marker = edge.circular ? 'url(#arrowhead-circular)' : 'url(#arrowhead)';
|
|
72
|
+
svg += `<line x1="${fromPos.x}" y1="${fromPos.y}" x2="${toPos.x}" y2="${toPos.y}" stroke="${color}" stroke-width="${edge.circular ? 2 : 1}" marker-end="${marker}" opacity="${edge.circular ? 1 : 0.6}" />\n`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Draw nodes
|
|
76
|
+
for (const node of nodeArray) {
|
|
77
|
+
const pos = positions.get(node.id);
|
|
78
|
+
if (pos) {
|
|
79
|
+
const fillColor = node.isCircular ? '#d32f2f' : '#1976d2';
|
|
80
|
+
const r = 25;
|
|
81
|
+
svg += `<circle cx="${pos.x}" cy="${pos.y}" r="${r}" fill="${fillColor}" opacity="0.8" />\n`;
|
|
82
|
+
// Node label
|
|
83
|
+
const label = path.basename(node.file, path.extname(node.file));
|
|
84
|
+
svg += `<text x="${pos.x}" y="${pos.y}" text-anchor="middle" dy="0.3em" fill="white" font-size="11" font-weight="bold">\n`;
|
|
85
|
+
svg += label.length > 12 ? label.substring(0, 10) + '..' : label;
|
|
86
|
+
svg += `</text>\n`;
|
|
87
|
+
// Circular indicator
|
|
88
|
+
if (node.isCircular) {
|
|
89
|
+
svg += `<circle cx="${pos.x}" cy="${pos.y}" r="${r + 3}" fill="none" stroke="#d32f2f" stroke-width="2" stroke-dasharray="5,5" />\n`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Legend
|
|
94
|
+
svg += `<g transform="translate(20, 20)">\n`;
|
|
95
|
+
svg += `<rect x="0" y="0" width="200" height="100" fill="white" stroke="#ccc" rx="4" />\n`;
|
|
96
|
+
svg += `<text x="10" y="20" font-weight="bold" font-size="12">Legend</text>\n`;
|
|
97
|
+
svg += `<circle cx="20" cy="40" r="6" fill="#1976d2" />\n`;
|
|
98
|
+
svg += `<text x="35" y="45" font-size="11">Regular File</text>\n`;
|
|
99
|
+
svg += `<circle cx="20" cy="65" r="6" fill="#d32f2f" />\n`;
|
|
100
|
+
svg += `<text x="35" y="70" font-size="11">Circular Dependency</text>\n`;
|
|
101
|
+
svg += `</g>\n`;
|
|
102
|
+
svg += `</svg>`;
|
|
103
|
+
return svg;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Generate HTML report with dependency graph
|
|
107
|
+
*/
|
|
108
|
+
export function generateDependencyGraphHTML(graph, projectName, circularCount = 0) {
|
|
109
|
+
const svgContent = generateDependencyGraph(graph);
|
|
110
|
+
return `<!DOCTYPE html>
|
|
111
|
+
<html lang="en">
|
|
112
|
+
<head>
|
|
113
|
+
<meta charset="UTF-8">
|
|
114
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
115
|
+
<title>Dependency Graph - ${projectName}</title>
|
|
116
|
+
<style>
|
|
117
|
+
body {
|
|
118
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
|
119
|
+
background: #f5f5f5;
|
|
120
|
+
margin: 0;
|
|
121
|
+
padding: 20px;
|
|
122
|
+
}
|
|
123
|
+
.container {
|
|
124
|
+
max-width: 1400px;
|
|
125
|
+
margin: 0 auto;
|
|
126
|
+
background: white;
|
|
127
|
+
border-radius: 8px;
|
|
128
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
129
|
+
padding: 30px;
|
|
130
|
+
}
|
|
131
|
+
h1 {
|
|
132
|
+
color: #1976d2;
|
|
133
|
+
margin: 0 0 10px 0;
|
|
134
|
+
}
|
|
135
|
+
.stats {
|
|
136
|
+
display: grid;
|
|
137
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
138
|
+
gap: 20px;
|
|
139
|
+
margin: 20px 0 30px 0;
|
|
140
|
+
}
|
|
141
|
+
.stat-card {
|
|
142
|
+
background: #f8f9fa;
|
|
143
|
+
border-left: 4px solid #1976d2;
|
|
144
|
+
padding: 15px;
|
|
145
|
+
border-radius: 4px;
|
|
146
|
+
}
|
|
147
|
+
.stat-card.warning {
|
|
148
|
+
border-left-color: #d32f2f;
|
|
149
|
+
}
|
|
150
|
+
.stat-label {
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
color: #666;
|
|
153
|
+
text-transform: uppercase;
|
|
154
|
+
}
|
|
155
|
+
.stat-value {
|
|
156
|
+
font-size: 28px;
|
|
157
|
+
font-weight: bold;
|
|
158
|
+
color: #1976d2;
|
|
159
|
+
}
|
|
160
|
+
.stat-card.warning .stat-value {
|
|
161
|
+
color: #d32f2f;
|
|
162
|
+
}
|
|
163
|
+
.graph-container {
|
|
164
|
+
border: 1px solid #e0e0e0;
|
|
165
|
+
border-radius: 4px;
|
|
166
|
+
overflow: auto;
|
|
167
|
+
background: #fafafa;
|
|
168
|
+
margin: 20px 0;
|
|
169
|
+
}
|
|
170
|
+
svg {
|
|
171
|
+
display: block;
|
|
172
|
+
margin: 0 auto;
|
|
173
|
+
}
|
|
174
|
+
.circular-list {
|
|
175
|
+
background: #ffebee;
|
|
176
|
+
border-left: 4px solid #d32f2f;
|
|
177
|
+
padding: 15px;
|
|
178
|
+
border-radius: 4px;
|
|
179
|
+
margin-top: 20px;
|
|
180
|
+
}
|
|
181
|
+
.circular-list h3 {
|
|
182
|
+
margin: 0 0 10px 0;
|
|
183
|
+
color: #d32f2f;
|
|
184
|
+
}
|
|
185
|
+
.cycle {
|
|
186
|
+
background: white;
|
|
187
|
+
padding: 8px 12px;
|
|
188
|
+
margin: 5px 0;
|
|
189
|
+
border-radius: 3px;
|
|
190
|
+
font-family: 'Courier New', monospace;
|
|
191
|
+
font-size: 12px;
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
194
|
+
</head>
|
|
195
|
+
<body>
|
|
196
|
+
<div class="container">
|
|
197
|
+
<h1>📊 Dependency Graph - ${projectName}</h1>
|
|
198
|
+
<p style="color: #666; margin-top: 5px;">Visual representation of file and component dependencies</p>
|
|
199
|
+
|
|
200
|
+
<div class="stats">
|
|
201
|
+
<div class="stat-card">
|
|
202
|
+
<div class="stat-label">Total Files</div>
|
|
203
|
+
<div class="stat-value">${graph.nodes.size}</div>
|
|
204
|
+
</div>
|
|
205
|
+
<div class="stat-card">
|
|
206
|
+
<div class="stat-label">Total Dependencies</div>
|
|
207
|
+
<div class="stat-value">${graph.edges.length}</div>
|
|
208
|
+
</div>
|
|
209
|
+
<div class="stat-card ${circularCount > 0 ? 'warning' : ''}">
|
|
210
|
+
<div class="stat-label">Circular Dependencies</div>
|
|
211
|
+
<div class="stat-value">${circularCount}</div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<div class="graph-container">
|
|
216
|
+
${svgContent}
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
${circularCount > 0
|
|
220
|
+
? `
|
|
221
|
+
<div class="circular-list">
|
|
222
|
+
<h3>⚠️ Circular Dependencies Detected</h3>
|
|
223
|
+
${graph.circularDependencies.map(cycle => `<div class="cycle">${cycle.join(' → ')} → ${cycle[0]}</div>`).join('')}
|
|
224
|
+
</div>
|
|
225
|
+
`
|
|
226
|
+
: ''}
|
|
227
|
+
</div>
|
|
228
|
+
</body>
|
|
229
|
+
</html>`;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Calculate node positions using simple spring layout
|
|
233
|
+
*/
|
|
234
|
+
function calculateNodePositions(nodes, edges, width, height) {
|
|
235
|
+
const positions = new Map();
|
|
236
|
+
// Initial random positions
|
|
237
|
+
for (const node of nodes) {
|
|
238
|
+
positions.set(node.id, {
|
|
239
|
+
x: Math.random() * width * 0.8 + width * 0.1,
|
|
240
|
+
y: Math.random() * height * 0.8 + height * 0.1,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
// Simple spring simulation (few iterations)
|
|
244
|
+
const iterations = 50;
|
|
245
|
+
for (let iter = 0; iter < iterations; iter++) {
|
|
246
|
+
for (const node of nodes) {
|
|
247
|
+
let fx = 0;
|
|
248
|
+
let fy = 0;
|
|
249
|
+
const pos = positions.get(node.id);
|
|
250
|
+
// Repulsion from other nodes
|
|
251
|
+
for (const other of nodes) {
|
|
252
|
+
if (node.id === other.id)
|
|
253
|
+
continue;
|
|
254
|
+
const otherPos = positions.get(other.id);
|
|
255
|
+
const dx = pos.x - otherPos.x;
|
|
256
|
+
const dy = pos.y - otherPos.y;
|
|
257
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
258
|
+
const force = 50 / dist;
|
|
259
|
+
fx += (dx / dist) * force;
|
|
260
|
+
fy += (dy / dist) * force;
|
|
261
|
+
}
|
|
262
|
+
// Attraction to connected nodes
|
|
263
|
+
for (const edge of edges) {
|
|
264
|
+
if (edge.from === node.id) {
|
|
265
|
+
const targetPos = positions.get(edge.to);
|
|
266
|
+
if (targetPos) {
|
|
267
|
+
const dx = targetPos.x - pos.x;
|
|
268
|
+
const dy = targetPos.y - pos.y;
|
|
269
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
270
|
+
fx += (dx / dist) * 0.1;
|
|
271
|
+
fy += (dy / dist) * 0.1;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
// Update position
|
|
276
|
+
pos.x += fx * 0.1;
|
|
277
|
+
pos.y += fy * 0.1;
|
|
278
|
+
pos.x = Math.max(30, Math.min(width - 30, pos.x));
|
|
279
|
+
pos.y = Math.max(30, Math.min(height - 30, pos.y));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return positions;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Detect circular dependencies using DFS
|
|
286
|
+
*/
|
|
287
|
+
function detectCircularDeps(nodes) {
|
|
288
|
+
const cycles = [];
|
|
289
|
+
const visited = new Set();
|
|
290
|
+
const recursionStack = new Set();
|
|
291
|
+
const path = [];
|
|
292
|
+
function dfs(nodeId) {
|
|
293
|
+
visited.add(nodeId);
|
|
294
|
+
recursionStack.add(nodeId);
|
|
295
|
+
path.push(nodeId);
|
|
296
|
+
const node = nodes.get(nodeId);
|
|
297
|
+
if (node) {
|
|
298
|
+
for (const impId of node.imports) {
|
|
299
|
+
if (!visited.has(impId)) {
|
|
300
|
+
dfs(impId);
|
|
301
|
+
}
|
|
302
|
+
else if (recursionStack.has(impId)) {
|
|
303
|
+
const cycleStart = path.indexOf(impId);
|
|
304
|
+
cycles.push(path.slice(cycleStart));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
recursionStack.delete(nodeId);
|
|
309
|
+
path.pop();
|
|
310
|
+
}
|
|
311
|
+
for (const nodeId of nodes.keys()) {
|
|
312
|
+
if (!visited.has(nodeId)) {
|
|
313
|
+
dfs(nodeId);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return cycles;
|
|
317
|
+
}
|
|
318
|
+
function normalizeId(filePath, rootDir) {
|
|
319
|
+
return path.relative(rootDir, filePath);
|
|
320
|
+
}
|
package/dist/reporter.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type SmellSeverity = 'error' | 'warning' | 'info';
|
|
2
|
-
export type SmellType = 'useEffect-overuse' | 'prop-drilling' | 'large-component' | 'unmemoized-calculation' | 'missing-dependency' | 'state-in-loop' | 'inline-function-prop' | 'deep-nesting' | 'missing-key' | 'hooks-rules-violation' | 'dependency-array-issue' | 'nested-ternary' | 'dead-code' | 'magic-value' | 'debug-statement' | 'todo-comment' | 'security-xss' | 'security-eval' | 'security-secrets' | 'a11y-missing-alt' | 'a11y-missing-label' | 'a11y-interactive-role' | 'a11y-keyboard' | 'a11y-semantic' | 'nextjs-client-server-boundary' | 'nextjs-missing-metadata' | 'nextjs-image-unoptimized' | 'nextjs-router-misuse' | 'rn-inline-style' | 'rn-missing-accessibility' | 'rn-performance-issue' | 'nodejs-callback-hell' | 'nodejs-unhandled-promise' | 'nodejs-sync-io' | 'nodejs-missing-error-handling' | 'js-var-usage' | 'js-loose-equality' | 'js-implicit-coercion' | 'js-global-pollution' | 'ts-any-usage' | 'ts-missing-return-type' | 'ts-non-null-assertion' | 'ts-type-assertion' | 'high-cyclomatic-complexity' | 'high-cognitive-complexity' | 'memory-leak-event-listener' | 'memory-leak-subscription' | 'memory-leak-timer' | 'memory-leak-async' | 'circular-dependency' | 'barrel-file-import' | 'namespace-import' | 'excessive-imports' | 'unused-export' | 'dead-import';
|
|
2
|
+
export type SmellType = 'useEffect-overuse' | 'prop-drilling' | 'large-component' | 'unmemoized-calculation' | 'missing-dependency' | 'state-in-loop' | 'inline-function-prop' | 'deep-nesting' | 'missing-key' | 'hooks-rules-violation' | 'dependency-array-issue' | 'nested-ternary' | 'dead-code' | 'magic-value' | 'debug-statement' | 'todo-comment' | 'security-xss' | 'security-eval' | 'security-secrets' | 'a11y-missing-alt' | 'a11y-missing-label' | 'a11y-interactive-role' | 'a11y-keyboard' | 'a11y-semantic' | 'nextjs-client-server-boundary' | 'nextjs-missing-metadata' | 'nextjs-image-unoptimized' | 'nextjs-router-misuse' | 'rn-inline-style' | 'rn-missing-accessibility' | 'rn-performance-issue' | 'nodejs-callback-hell' | 'nodejs-unhandled-promise' | 'nodejs-sync-io' | 'nodejs-missing-error-handling' | 'js-var-usage' | 'js-loose-equality' | 'js-implicit-coercion' | 'js-global-pollution' | 'ts-any-usage' | 'ts-missing-return-type' | 'ts-non-null-assertion' | 'ts-type-assertion' | 'high-cyclomatic-complexity' | 'high-cognitive-complexity' | 'memory-leak-event-listener' | 'memory-leak-subscription' | 'memory-leak-timer' | 'memory-leak-async' | 'circular-dependency' | 'barrel-file-import' | 'namespace-import' | 'excessive-imports' | 'unused-export' | 'dead-import' | 'custom-rule';
|
|
3
3
|
export interface CodeSmell {
|
|
4
4
|
type: SmellType;
|
|
5
5
|
severity: SmellSeverity;
|
|
@@ -87,6 +87,11 @@ export interface DetectorConfig {
|
|
|
87
87
|
webhookUrl?: string;
|
|
88
88
|
webhookType?: 'slack' | 'discord' | 'generic';
|
|
89
89
|
webhookThreshold?: number;
|
|
90
|
+
generateDependencyGraph?: boolean;
|
|
91
|
+
graphOutputFormat?: 'svg' | 'html';
|
|
92
|
+
analyzeBundleSize?: boolean;
|
|
93
|
+
maxComponentSize?: number;
|
|
94
|
+
customRules?: any[];
|
|
90
95
|
}
|
|
91
96
|
export declare const DEFAULT_CONFIG: DetectorConfig;
|
|
92
97
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,eAAe,GACf,iBAAiB,GACjB,wBAAwB,GACxB,oBAAoB,GACpB,eAAe,GACf,sBAAsB,GACtB,cAAc,GACd,aAAa,GACb,uBAAuB,GACvB,wBAAwB,GACxB,gBAAgB,GAChB,WAAW,GACX,aAAa,GAEb,iBAAiB,GACjB,cAAc,GAEd,cAAc,GACd,eAAe,GACf,kBAAkB,GAElB,kBAAkB,GAClB,oBAAoB,GACpB,uB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eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAE5B,eAAe,EAAE,OAAO,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IAExB,gBAAgB,EAAE,OAAO,CAAC;IAE1B,YAAY,EAAE,OAAO,CAAC;IAEtB,eAAe,EAAE,OAAO,CAAC;IAEzB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,iBAAiB,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAEnC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,cAkD5B,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -40,4 +40,12 @@ export const DEFAULT_CONFIG = {
|
|
|
40
40
|
webhookUrl: undefined,
|
|
41
41
|
webhookType: 'slack',
|
|
42
42
|
webhookThreshold: 10,
|
|
43
|
+
// Graph visualization
|
|
44
|
+
generateDependencyGraph: false,
|
|
45
|
+
graphOutputFormat: 'html',
|
|
46
|
+
// Bundle analysis
|
|
47
|
+
analyzeBundleSize: false,
|
|
48
|
+
maxComponentSize: 10000,
|
|
49
|
+
// Custom rules
|
|
50
|
+
customRules: undefined,
|
|
43
51
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-code-smell-detector",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Detect code smells in React projects - useEffect overuse, prop drilling, large components, security issues, accessibility, memory leaks, and more",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|