nestjs-doctor 0.4.17 → 0.4.18

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
@@ -19,7 +19,7 @@
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- 40 built-in rules across <b>security</b>, <b>performance</b>, <b>correctness</b>, and <b>architecture</b>. Outputs a <b>0-100 score</b> with actionable diagnostics. Zero config. Monorepo support. Catches the anti-patterns that AI-generated code introduce (slop code).
22
+ 43 built-in rules across <b>security</b>, <b>performance</b>, <b>correctness</b>, <b>architecture</b>, and <b>schema</b>. Outputs a <b>0-100 score</b> with actionable diagnostics. Zero config. Monorepo support. Catches the anti-patterns that AI-generated code introduce (slop code).
23
23
  </p>
24
24
 
25
25
  ---
@@ -46,7 +46,7 @@ npx nestjs-doctor@latest . --verbose
46
46
  npx nestjs-doctor@latest . --report
47
47
  ```
48
48
 
49
- Self-contained HTML file with four sections: score summary, source-level diagnostics with code viewer, interactive module graph, and a custom rule playground. Opens in your browser.
49
+ Self-contained HTML file with five sections: score summary, source-level diagnostics with code viewer, interactive module graph, schema ER diagram, and a custom rule playground. Opens in your browser.
50
50
 
51
51
  ![Module Graph](https://nestjs.doctor/module-graph.png)
52
52
 
@@ -60,7 +60,7 @@ Install [NestJS Doctor](https://marketplace.visualstudio.com/items?itemName=rolo
60
60
  npm install -D nestjs-doctor
61
61
  ```
62
62
 
63
- Same 40 rules as the CLI, surfaced as inline diagnostics in the editor and in the Problems panel. Files are scanned on open and on save with a configurable debounce.
63
+ Same 43 rules as the CLI, surfaced as inline diagnostics in the editor and in the Problems panel. Files are scanned on open and on save with a configurable debounce.
64
64
 
65
65
  Use `NestJS Doctor: Scan Project` from the command palette to trigger a full scan manually.
66
66
 
@@ -189,7 +189,7 @@ import type { RuleContext } from "nestjs-doctor";
189
189
  export const noTodoComments = {
190
190
  meta: {
191
191
  id: "no-todo-comments",
192
- category: "correctness", // "security" | "performance" | "correctness" | "architecture"
192
+ category: "correctness", // "security" | "performance" | "correctness" | "architecture" | "schema"
193
193
  severity: "warning", // "error" | "warning" | "info"
194
194
  description: "TODO comments should be resolved before merging",
195
195
  help: "Replace the TODO with an implementation or open an issue.",
@@ -248,6 +248,19 @@ Output includes a combined score and a per-project breakdown.
248
248
 
249
249
  ---
250
250
 
251
+ ## Schema Analysis
252
+
253
+ Auto-detected from Prisma schema files (`schema.prisma`) or TypeORM entity decorators (`@Entity()`). When a schema is found, nestjs-doctor extracts entity-relationship data and:
254
+
255
+ - Renders an **interactive ER diagram** in the Schema tab of the HTML report (sidebar entity tree + canvas diagram + problems panel)
256
+ - Runs **3 schema-specific rules** covering primary keys, timestamps, and cascade configuration
257
+
258
+ Supported ORMs: **Prisma**, **TypeORM**.
259
+
260
+ See the [schema rules documentation](https://nestjs.doctor/docs/rules/schema) for the full rule list.
261
+
262
+ ---
263
+
251
264
  ## Scoring
252
265
 
253
266
  Weighted by severity and category, normalized by file count:
@@ -256,7 +269,8 @@ Weighted by severity and category, normalized by file count:
256
269
  |----------|--------|-|----------|------------|
257
270
  | error | 3.0 | | security | 1.5x |
258
271
  | warning | 1.5 | | correctness | 1.3x |
259
- | info | 0.5 | | architecture | 1.0x |
272
+ | info | 0.5 | | schema | 1.1x |
273
+ | | | | architecture | 1.0x |
260
274
  | | | | performance | 0.8x |
261
275
 
262
276
  | Score | Label |
@@ -287,7 +301,7 @@ mono.combined; // Merged DiagnoseResult
287
301
 
288
302
  ---
289
303
 
290
- ## Rules (40)
304
+ ## Rules (43)
291
305
 
292
306
  ### Security (9)
293
307
 
@@ -349,4 +363,11 @@ mono.combined; // Merged DiagnoseResult
349
363
  | `no-unused-module-exports` | info | Module exports unused by importers |
350
364
  | `no-orphan-modules` | info | Module never imported by any other module |
351
365
 
366
+ ### Schema (3)
367
+
368
+ | Rule | Severity | What it catches |
369
+ |------|----------|-----------------|
370
+ | `schema/require-primary-key` | error | Entity without a primary key column |
371
+ | `schema/require-timestamps` | warning | Entity missing createdAt/updatedAt columns |
372
+ | `schema/require-cascade-rule` | info | Relation missing explicit onDelete behavior |
352
373