fix(scanner): conditionally set jsx parser option based on file extension#208
fix(scanner): conditionally set jsx parser option based on file extension#208aniruthramidi wants to merge 2 commits into
Conversation
Signed-off-by: Aniruth Ramidi <aniruthramidi@gmail.com>
…sion Signed-off-by: Aniruth Ramidi <aniruthramidi@gmail.com>
📝 WalkthroughWalkthroughThis PR adds a ChangesNo-color CLI support
Conditional JSX parsing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/scanner/index.ts (1)
666-666: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd scanner test coverage for the new extension-based jsx logic.
No test evidence is shown verifying that
.tsfiles with unescaped generics (e.g.<T>) now parse successfully, or that.jsfiles with JSX still parse correctly under this change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/scanner/index.ts` at line 666, Add scanner test coverage for the extension-based jsx handling in the scanner logic. Update or add tests around the code in src/scanner/index.ts that sets jsx based on file.endsWith checks to verify `.ts` files with unescaped generics like `<T>` still parse successfully and that `.js` files containing JSX continue to parse correctly under the new behavior. Use the scanner entrypoints and parse flow exercised by the existing scanner tests so the new assertions clearly cover the changed jsx detection logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/scanner/index.ts`:
- Line 666: Add scanner test coverage for the extension-based jsx handling in
the scanner logic. Update or add tests around the code in src/scanner/index.ts
that sets jsx based on file.endsWith checks to verify `.ts` files with unescaped
generics like `<T>` still parse successfully and that `.js` files containing JSX
continue to parse correctly under the new behavior. Use the scanner entrypoints
and parse flow exercised by the existing scanner tests so the new assertions
clearly cover the changed jsx detection logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 63dcac95-7f3b-4d1a-a1da-199fd272f78c
📒 Files selected for processing (3)
src/cli.tssrc/commands/tests/cli.test.tssrc/scanner/index.ts
This fixes the
failed to parsewarnings for.tsfiles containing JSX, and prevents false syntax errors for un-escaped generics like<T>in.tsfiles by dynamically setting thejsxparser option based on the file extension.Summary by CodeRabbit
--no-colorand theNO_COLORenvironment variable.