nestjs-doctor 0.4.16 → 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 +40 -5
- package/dist/api/index.cjs +713 -51
- package/dist/api/index.d.cts +95 -11
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +95 -11
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +712 -53
- package/dist/api/index.mjs.map +1 -1
- package/dist/cli/index.mjs +2367 -67
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
<p align="center">
|
|
22
|
-
|
|
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,12 +46,26 @@ npx nestjs-doctor@latest . --verbose
|
|
|
46
46
|
npx nestjs-doctor@latest . --report
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Self-contained HTML file with
|
|
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
|

|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
+
## VS Code Extension
|
|
56
|
+
|
|
57
|
+
Install [NestJS Doctor](https://marketplace.visualstudio.com/items?itemName=rolobits.nestjs-doctor-vscode) from the VS Code Marketplace. Requires `nestjs-doctor` as a dev dependency — the extension's LSP server loads it from your workspace.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install -D nestjs-doctor
|
|
61
|
+
```
|
|
62
|
+
|
|
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
|
+
|
|
65
|
+
Use `NestJS Doctor: Scan Project` from the command palette to trigger a full scan manually.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
55
69
|
## CI
|
|
56
70
|
|
|
57
71
|
Pin it as a devDependency:
|
|
@@ -175,7 +189,7 @@ import type { RuleContext } from "nestjs-doctor";
|
|
|
175
189
|
export const noTodoComments = {
|
|
176
190
|
meta: {
|
|
177
191
|
id: "no-todo-comments",
|
|
178
|
-
category: "correctness", // "security" | "performance" | "correctness" | "architecture"
|
|
192
|
+
category: "correctness", // "security" | "performance" | "correctness" | "architecture" | "schema"
|
|
179
193
|
severity: "warning", // "error" | "warning" | "info"
|
|
180
194
|
description: "TODO comments should be resolved before merging",
|
|
181
195
|
help: "Replace the TODO with an implementation or open an issue.",
|
|
@@ -234,6 +248,19 @@ Output includes a combined score and a per-project breakdown.
|
|
|
234
248
|
|
|
235
249
|
---
|
|
236
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
|
+
|
|
237
264
|
## Scoring
|
|
238
265
|
|
|
239
266
|
Weighted by severity and category, normalized by file count:
|
|
@@ -242,7 +269,8 @@ Weighted by severity and category, normalized by file count:
|
|
|
242
269
|
|----------|--------|-|----------|------------|
|
|
243
270
|
| error | 3.0 | | security | 1.5x |
|
|
244
271
|
| warning | 1.5 | | correctness | 1.3x |
|
|
245
|
-
| info | 0.5 | |
|
|
272
|
+
| info | 0.5 | | schema | 1.1x |
|
|
273
|
+
| | | | architecture | 1.0x |
|
|
246
274
|
| | | | performance | 0.8x |
|
|
247
275
|
|
|
248
276
|
| Score | Label |
|
|
@@ -273,7 +301,7 @@ mono.combined; // Merged DiagnoseResult
|
|
|
273
301
|
|
|
274
302
|
---
|
|
275
303
|
|
|
276
|
-
## Rules (
|
|
304
|
+
## Rules (43)
|
|
277
305
|
|
|
278
306
|
### Security (9)
|
|
279
307
|
|
|
@@ -335,4 +363,11 @@ mono.combined; // Merged DiagnoseResult
|
|
|
335
363
|
| `no-unused-module-exports` | info | Module exports unused by importers |
|
|
336
364
|
| `no-orphan-modules` | info | Module never imported by any other module |
|
|
337
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 |
|
|
338
373
|
|