Skip to content

Commit af37da8

Browse files
committed
fix
1 parent 84bb6d5 commit af37da8

File tree

6 files changed

+39
-4
lines changed

6 files changed

+39
-4
lines changed

packages/react-doctor/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# react-doctor
22

3+
## 0.0.22
4+
5+
### Patch Changes
6+
7+
- fix
8+
39
## 0.0.21
410

511
### Patch Changes

packages/react-doctor/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ One command scans your codebase for security, performance, correctness, and arch
1515

1616
https://github.com/user-attachments/assets/07cc88d9-9589-44c3-aa73-5d603cb1c570
1717

18+
## How it works
19+
20+
React Doctor detects your framework (Next.js, Vite, Remix, etc.), React version, and compiler setup, then runs two analysis passes **in parallel**:
21+
22+
1. **Lint**: Checks 60+ rules across state & effects, performance, architecture, bundle size, security, correctness, accessibility, and framework-specific categories (Next.js, React Native). Rules are toggled automatically based on your project setup.
23+
2. **Dead code**: Detects unused files, exports, types, and duplicates.
24+
25+
Diagnostics are filtered through your config, then scored by severity (errors weigh more than warnings) to produce a **0–100 health score** (75+ Great, 50–74 Needs work, <50 Critical).
26+
1827
## Install
1928

2029
Run this at your project root:

packages/react-doctor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-doctor",
3-
"version": "0.0.21",
3+
"version": "0.0.22",
44
"description": "Diagnose and fix performance issues in your React app",
55
"keywords": [
66
"diagnostics",

packages/react-doctor/src/cli.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ interface CliFlags {
3535
prompt: boolean;
3636
yes: boolean;
3737
offline: boolean;
38+
ami: boolean;
3839
project?: string;
3940
diff?: boolean | string;
4041
}
@@ -94,6 +95,7 @@ const program = new Command()
9495
.option("--project <name>", "select workspace project (comma-separated for multiple)")
9596
.option("--diff [base]", "scan only files changed vs base branch")
9697
.option("--offline", "skip telemetry (anonymous, not stored, only used to calculate score)")
98+
.option("--no-ami", "skip Ami-related prompts")
9799
.option("--fix", "open Ami to auto-fix all issues")
98100
.option("--prompt", "copy latest scan output to clipboard")
99101
.action(async (directory: string, flags: CliFlags) => {
@@ -136,6 +138,7 @@ const program = new Command()
136138
process.env.AMI,
137139
].some(Boolean);
138140
const shouldSkipPrompts = flags.yes || isAutomatedEnvironment || !process.stdin.isTTY;
141+
const shouldSkipAmiPrompts = shouldSkipPrompts || !flags.ami;
139142
const projectDirectories = await selectProjects(
140143
resolvedDirectory,
141144
flags.project,
@@ -198,8 +201,8 @@ const program = new Command()
198201
if (shouldCopyPromptOutput) {
199202
copyPromptToClipboard(capturedScanOutput, !isScoreOnly);
200203
} else if (!isScoreOnly) {
201-
await maybePromptSkillInstall(shouldSkipPrompts);
202-
if (!shouldSkipPrompts && !flags.fix) {
204+
await maybePromptSkillInstall(shouldSkipAmiPrompts);
205+
if (!shouldSkipAmiPrompts && !flags.fix) {
203206
const estimatedScoreResult = flags.offline
204207
? null
205208
: await fetchEstimatedScore(allDiagnostics);

packages/react-doctor/src/utils/filter-diagnostics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const filterIgnoredDiagnostics = (
2020
return false;
2121
}
2222

23-
const normalizedPath = diagnostic.filePath.replace(/\\/g, "/");
23+
const normalizedPath = diagnostic.filePath.replace(/\\/g, "/").replace(/^\.\//, "");
2424
if (ignoredFilePatterns.some((pattern) => pattern.test(normalizedPath))) {
2525
return false;
2626
}

packages/react-doctor/tests/filter-diagnostics.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ describe("filterIgnoredDiagnostics", () => {
9494
expect(filtered).toHaveLength(2);
9595
});
9696

97+
it("filters file paths with ./ prefix against patterns without it", () => {
98+
const diagnostics = [
99+
createDiagnostic({ filePath: "./resources/js/components/ui/Button.tsx" }),
100+
createDiagnostic({ filePath: "./resources/js/marketing/Hero.tsx" }),
101+
createDiagnostic({ filePath: "./resources/js/pages/Home.tsx" }),
102+
];
103+
const config: ReactDoctorConfig = {
104+
ignore: {
105+
files: ["resources/js/components/ui/**", "resources/js/marketing/**"],
106+
},
107+
};
108+
109+
const filtered = filterIgnoredDiagnostics(diagnostics, config);
110+
expect(filtered).toHaveLength(1);
111+
expect(filtered[0].filePath).toBe("./resources/js/pages/Home.tsx");
112+
});
113+
97114
it("handles knip rule identifiers", () => {
98115
const diagnostics = [
99116
createDiagnostic({ plugin: "knip", rule: "exports" }),

0 commit comments

Comments
 (0)