prodlint 0.3.1 → 0.5.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/README.md CHANGED
@@ -6,20 +6,24 @@
6
6
 
7
7
  Catch the bugs AI leaves behind.
8
8
 
9
- prodlint scans AI-generated JavaScript and TypeScript projects for production readiness issues — hallucinated imports, missing auth, exposed secrets, N+1 queries, and more. No LLM required, just pattern matching against known failure modes.
9
+ prodlint scans AI-generated JavaScript and TypeScript projects for production readiness issues — hallucinated imports, missing auth, exposed secrets, N+1 queries, and more. No LLM required, just fast static analysis against known failure modes.
10
10
 
11
11
  ```bash
12
12
  npx prodlint
13
13
  ```
14
14
 
15
15
  ```
16
- prodlint v0.3.0
17
- Scanned 148 files in 92ms
16
+ prodlint v0.5.0
17
+ Scanned 148 files · 3 critical · 5 warnings
18
18
 
19
19
  src/app/api/checkout/route.ts
20
20
  12:1 CRIT No rate limiting — anyone could spam this endpoint and run up your API costs rate-limiting
21
21
  28:5 WARN Empty catch block silently swallows error shallow-catch
22
22
 
23
+ src/actions/submit.ts
24
+ 5:3 CRIT Server action uses formData without validation next-server-action-validation
25
+ ↳ Validate with Zod: const data = schema.safeParse(Object.fromEntries(formData))
26
+
23
27
  src/lib/db.ts
24
28
  1:1 CRIT Package "drizzle-orm" is imported but not in package.json hallucinated-imports
25
29
 
@@ -29,9 +33,9 @@ npx prodlint
29
33
  performance 95 ███████████████████░ (1 issue)
30
34
  ai-quality 90 ██████████████████░░ (3 issues)
31
35
 
32
- Overall: 85/100
36
+ Overall: 82/100 (weighted)
33
37
 
34
- 8 critical · 5 warnings · 3 info
38
+ 3 critical · 5 warnings · 3 info
35
39
  ```
36
40
 
37
41
  ## Why?
@@ -43,10 +47,12 @@ prodlint catches what TypeScript and ESLint miss: **production readiness gaps**.
43
47
  ## Install
44
48
 
45
49
  ```bash
46
- npx prodlint # Run directly (no install)
47
- npx prodlint ./my-app # Scan specific path
48
- npx prodlint --json # JSON output for CI
49
- npx prodlint --ignore "*.test.ts" # Ignore patterns
50
+ npx prodlint # Run directly (no install)
51
+ npx prodlint ./my-app # Scan specific path
52
+ npx prodlint --json # JSON output for CI
53
+ npx prodlint --ignore "*.test.ts" # Ignore patterns
54
+ npx prodlint --min-severity warning # Only warnings and criticals
55
+ npx prodlint --quiet # Suppress badge output
50
56
  ```
51
57
 
52
58
  Or install it:
@@ -56,9 +62,9 @@ npm i -D prodlint # Project dependency
56
62
  npm i -g prodlint # Global install
57
63
  ```
58
64
 
59
- ## 27 Rules across 4 Categories
65
+ ## 32 Rules across 4 Categories
60
66
 
61
- ### Security (10 rules)
67
+ ### Security (14 rules)
62
68
 
63
69
  | Rule | What it catches |
64
70
  |------|----------------|
@@ -68,12 +74,16 @@ npm i -g prodlint # Global install
68
74
  | `input-validation` | Request body used without validation |
69
75
  | `cors-config` | `Access-Control-Allow-Origin: *` |
70
76
  | `unsafe-html` | `dangerouslySetInnerHTML` with user data |
71
- | `sql-injection` | String-interpolated SQL queries |
77
+ | `sql-injection` | String-interpolated SQL queries (ORM-aware) |
72
78
  | `open-redirect` | User input passed to `redirect()` |
73
79
  | `rate-limiting` | API routes with no rate limiter |
74
80
  | `phantom-dependency` | Packages in node_modules but missing from package.json |
81
+ | `insecure-cookie` | Session cookies missing httpOnly/secure/sameSite |
82
+ | `leaked-env-in-logs` | `process.env.*` inside console.log calls |
83
+ | `insecure-random` | `Math.random()` used for tokens, secrets, or session IDs |
84
+ | `next-server-action-validation` | Server actions using formData without Zod/schema validation |
75
85
 
76
- ### Reliability (6 rules)
86
+ ### Reliability (7 rules)
77
87
 
78
88
  | Rule | What it catches |
79
89
  |------|----------------|
@@ -83,6 +93,7 @@ npm i -g prodlint # Global install
83
93
  | `shallow-catch` | Empty catch blocks that swallow errors |
84
94
  | `missing-loading-state` | Client components that fetch without a loading state |
85
95
  | `missing-error-boundary` | Route layouts without a matching error.tsx |
96
+ | `missing-transaction` | Multiple Prisma writes without `$transaction` |
86
97
 
87
98
  ### Performance (4 rules)
88
99
 
@@ -109,23 +120,28 @@ npm i -g prodlint # Global install
109
120
 
110
121
  prodlint avoids common false positives:
111
122
 
123
+ - **AST parsing** — Babel-based analysis for loops, imports, and SQL templates with regex fallback
124
+ - **Framework awareness** — Prisma, Drizzle, Supabase, Knex, and Sequelize whitelists prevent false SQL injection flags
125
+ - **Middleware detection** — Clerk, NextAuth, Supabase middleware detected — auth findings downgraded
112
126
  - **Block comment awareness** — patterns inside `/* */` are ignored
113
- - **Middleware detection** — if your project uses Clerk/NextAuth/Supabase middleware, auth findings are downgraded
114
127
  - **Path alias support** — `@/`, `~/`, and tsconfig paths aren't flagged as hallucinated imports
115
128
  - **Route exemptions** — auth, webhook, health, and cron routes are exempt from auth/rate-limit checks
116
129
  - **Test/script file awareness** — lower severity for non-production files
130
+ - **Fix suggestions** — findings include actionable `fix` hints with remediation code
117
131
 
118
132
  ## Scoring
119
133
 
120
134
  Each category starts at 100. Deductions per finding:
121
135
 
122
- | Severity | Deduction |
123
- |----------|-----------|
124
- | critical | -10 |
125
- | warning | -3 |
126
- | info | -1 |
136
+ | Severity | Deduction | Per-rule cap |
137
+ |----------|-----------|--------------|
138
+ | critical | -8 | max 1 |
139
+ | warning | -2 | max 2 |
140
+ | info | -0.5 | max 3 |
141
+
142
+ **Diminishing returns**: after 30 points deducted in a category, further deductions are halved; after 50, quartered.
127
143
 
128
- Overall score = average of the 4 category scores (floor 0). Exit code `1` if any critical findings exist.
144
+ **Weighted overall**: security 40%, reliability 30%, performance 15%, ai-quality 15%. Floor at 0. Exit code `1` if any critical findings exist.
129
145
 
130
146
  ## GitHub Action
131
147