react-doctor 0.0.14 → 0.0.16

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
@@ -57,7 +57,46 @@ Options:
57
57
  -h, --help display help for command
58
58
  ```
59
59
 
60
- ## Scores for popular open-source projects
60
+ ## Node.js API
61
+
62
+ You can also use React Doctor programmatically:
63
+
64
+ ```js
65
+ import { diagnose } from "react-doctor/api";
66
+
67
+ const result = await diagnose("./path/to/your/react-project");
68
+
69
+ console.log(result.score); // { score: 82, label: "Good" } or null
70
+ console.log(result.diagnostics); // Array of Diagnostic objects
71
+ console.log(result.project); // Detected framework, React version, etc.
72
+ ```
73
+
74
+ The `diagnose` function accepts an optional second argument:
75
+
76
+ ```js
77
+ const result = await diagnose(".", {
78
+ lint: true, // run lint checks (default: true)
79
+ deadCode: true, // run dead code detection (default: true)
80
+ });
81
+ ```
82
+
83
+ Each diagnostic has the following shape:
84
+
85
+ ```ts
86
+ interface Diagnostic {
87
+ filePath: string;
88
+ plugin: string;
89
+ rule: string;
90
+ severity: "error" | "warning";
91
+ message: string;
92
+ help: string;
93
+ line: number;
94
+ column: number;
95
+ category: string;
96
+ }
97
+ ```
98
+
99
+ ## [Scores for popular open-source projects](https://react.doctor/leaderboard)
61
100
 
62
101
  | Project | Score | Share |
63
102
  | ------------------------------------------------------ | ------ | --------------------------------------------------------------------------------------- |
package/dist/cli.js CHANGED
@@ -1414,7 +1414,7 @@ const copyToClipboard = (text) => {
1414
1414
 
1415
1415
  //#endregion
1416
1416
  //#region src/cli.ts
1417
- const VERSION = "0.0.14";
1417
+ const VERSION = "0.0.16";
1418
1418
  process.on("SIGINT", () => process.exit(0));
1419
1419
  process.on("SIGTERM", () => process.exit(0));
1420
1420
  const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--no-lint", "skip linting").option("--no-dead-code", "skip dead code detection").option("--verbose", "show file details per rule").option("--score", "output only the score").option("-y, --yes", "skip prompts, scan all workspace projects").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--fix", "open Ami to auto-fix all issues").option("--prompt", "copy latest scan output to clipboard").action(async (directory, flags) => {