clean-slop 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/dist/index.cjs CHANGED
@@ -22,14 +22,7 @@ var isBinaryPath__default = /*#__PURE__*/_interopDefault(isBinaryPath);
22
22
  var PACKAGE_VERSION = "1.0.0";
23
23
 
24
24
  // src/config/loader.ts
25
- var DEFAULT_INCLUDE = [
26
- "**/*.js",
27
- "**/*.jsx",
28
- "**/*.ts",
29
- "**/*.tsx",
30
- "**/*.mjs",
31
- "**/*.cjs"
32
- ];
25
+ var DEFAULT_INCLUDE = ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.mjs", "**/*.cjs"];
33
26
  var DEFAULT_EXCLUDE = [
34
27
  "**/node_modules/**",
35
28
  "**/dist/**",
@@ -45,9 +38,9 @@ var DEFAULT_EXCLUDE = [
45
38
  var DEFAULT_IGNORE_PATTERNS = [];
46
39
  var DEFAULT_CATEGORIES = {
47
40
  "ai-slop": true,
48
- "security": true,
49
- "reliability": true,
50
- "maintainability": true,
41
+ security: true,
42
+ reliability: true,
43
+ maintainability: true,
51
44
  "production-readiness": true
52
45
  };
53
46
  var DEFAULT_MAX_ISSUES = {};
@@ -230,11 +223,7 @@ function parseSource(filePath, source) {
230
223
  }
231
224
  }
232
225
  const message = err instanceof Error ? err.message : "Unknown parse error";
233
- throw new ParseError(
234
- `Failed to parse ${filePath}: ${message}`,
235
- filePath,
236
- err
237
- );
226
+ throw new ParseError(`Failed to parse ${filePath}: ${message}`, filePath, err);
238
227
  }
239
228
  }
240
229
  function extractSnippet(source, line, contextLines = 2) {
@@ -833,11 +822,7 @@ var rule7 = {
833
822
  var dead_code_default = rule7;
834
823
 
835
824
  // src/rules/security/unsafe-eval.ts
836
- var DANGEROUS_EVAL_APIS = /* @__PURE__ */ new Set([
837
- "eval",
838
- "Function",
839
- "execScript"
840
- ]);
825
+ var DANGEROUS_EVAL_APIS = /* @__PURE__ */ new Set(["eval", "Function", "execScript"]);
841
826
  var rule8 = {
842
827
  meta: {
843
828
  id: "security/unsafe-eval",
@@ -1900,11 +1885,7 @@ var DEBUG_METHODS = /* @__PURE__ */ new Set([
1900
1885
  "console.trace",
1901
1886
  "console.table"
1902
1887
  ]);
1903
- var ALLOWED_CONSOLE = /* @__PURE__ */ new Set([
1904
- "console.error",
1905
- "console.warn",
1906
- "console.info"
1907
- ]);
1888
+ var ALLOWED_CONSOLE = /* @__PURE__ */ new Set(["console.error", "console.warn", "console.info"]);
1908
1889
  var rule21 = {
1909
1890
  meta: {
1910
1891
  id: "production-readiness/no-console-log",
@@ -2064,7 +2045,11 @@ var rule22 = {
2064
2045
  }
2065
2046
  }
2066
2047
  function getLocation2(node, filePath) {
2067
- return { file: filePath, line: node.loc?.start.line ?? 1, column: node.loc?.start.column ?? 0 };
2048
+ return {
2049
+ file: filePath,
2050
+ line: node.loc?.start.line ?? 1,
2051
+ column: node.loc?.start.column ?? 0
2052
+ };
2068
2053
  }
2069
2054
  }
2070
2055
  };
@@ -2156,10 +2141,7 @@ function computeScore(issues, config) {
2156
2141
  low: 1,
2157
2142
  info: 0
2158
2143
  };
2159
- const totalDeduction = catIssues.reduce(
2160
- (sum, i) => sum + (deductions[i.severity] ?? 0),
2161
- 0
2162
- );
2144
+ const totalDeduction = catIssues.reduce((sum, i) => sum + (deductions[i.severity] ?? 0), 0);
2163
2145
  const raw = Math.max(0, 100 - totalDeduction);
2164
2146
  return {
2165
2147
  category: cat,
@@ -2200,7 +2182,12 @@ async function scan(options) {
2200
2182
  continue;
2201
2183
  }
2202
2184
  if (source.length > 2e6) {
2203
- fileResults.push({ file: filePath, issues: [], skipped: true, skipReason: "file too large" });
2185
+ fileResults.push({
2186
+ file: filePath,
2187
+ issues: [],
2188
+ skipped: true,
2189
+ skipReason: "file too large"
2190
+ });
2204
2191
  continue;
2205
2192
  }
2206
2193
  parsed = parseSource(filePath, source);
@@ -2265,9 +2252,7 @@ function renderIssue(issue, root, verbose) {
2265
2252
  const lines = [];
2266
2253
  const relPath2 = formatRelativePath(root, issue.location.file);
2267
2254
  const loc = `${relPath2}:${issue.location.line}:${issue.location.column}`;
2268
- lines.push(
2269
- ` ${formatSeverity(issue.severity)} ${BOLD}${issue.message}${RESET}`
2270
- );
2255
+ lines.push(` ${formatSeverity(issue.severity)} ${BOLD}${issue.message}${RESET}`);
2271
2256
  lines.push(` ${DIM}${loc}${RESET} ${GRAY}[${issue.ruleId}]${RESET}`);
2272
2257
  if (verbose) {
2273
2258
  lines.push("");
@@ -2354,7 +2339,9 @@ function generateTextReport(result) {
2354
2339
  if (lowCount > 0) lines.push(` ${DIM}${lowCount} low${RESET}`);
2355
2340
  lines.push("");
2356
2341
  if (score.productionReady) {
2357
- lines.push(` ${GREEN}PRODUCTION READY${RESET} Score above threshold (${config.failThreshold})`);
2342
+ lines.push(
2343
+ ` ${GREEN}PRODUCTION READY${RESET} Score above threshold (${config.failThreshold})`
2344
+ );
2358
2345
  } else {
2359
2346
  lines.push(
2360
2347
  ` ${RED}NOT PRODUCTION READY${RESET} Score ${score.overall} below threshold (${config.failThreshold})`
@@ -2451,9 +2438,7 @@ function generateMarkdownReport(result) {
2451
2438
  lines.push("|----------|-------|--------|");
2452
2439
  for (const cat of score.categories) {
2453
2440
  const emoji = cat.score >= 90 ? "\u2705" : cat.score >= 70 ? "\u26A0\uFE0F" : "\u274C";
2454
- lines.push(
2455
- `| ${cat.category} | ${emoji} ${cat.score}/100 | ${cat.issueCount} |`
2456
- );
2441
+ lines.push(`| ${cat.category} | ${emoji} ${cat.score}/100 | ${cat.issueCount} |`);
2457
2442
  }
2458
2443
  lines.push("");
2459
2444
  lines.push(`**Overall Score:** ${score.overall}/100   **Grade:** ${score.grade}`);