fix(docs): make TypeScript code blocks parseable by sort-imports plugin#220
Conversation
Two code blocks in agent-invite-endpoint-plan.md were bare top-level object literals. prettier-plugin-sort-imports tried to parse them as TS modules to sort imports, which babel rejected as "labeled statement followed by comma" — surfacing as two recurring "import sorting aborted due to babel parsing error" warnings in prettier --check across CI for any PR touching this tree. Wrapping the snippets in declarations (const + type) makes them valid TS, drops the warnings, and keeps the docs readable.
WalkthroughThe plan document for the agent invite endpoint is updated with refined code snippets. The join handler's request validation schema is now explicitly structured as a Zod object defining slug constraints and optional instructions, and the response shape is reformatted as a TypeScript union type with separate success and error branches. ChangesAgent Join Endpoint Plan Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
Claude finished @lourou's task —— View job PR Review Complete ✓Tasks
Review SummaryVerdict: ✅ Approved — This is a clean, well-targeted fix with no issues. Code Quality & Best Practices ✓The changes are exemplary:
Potential Bugs or Issues ✓None. The changes are purely syntactic wrappers that:
Performance Considerations ✓N/A — This is a documentation-only change with zero runtime impact. Security Concerns ✓None. Documentation fix only. Test Coverage ✓Appropriate testing approach:
Additional Observations
RecommendationMerge when CI is green. This is a textbook example of a focused, well-documented fix. |
ApprovabilityVerdict: Approved Documentation-only changes that improve TypeScript code block syntax in a planning document. No runtime code is affected. You can customize Macroscope's approvability policy. Learn more. |
Summary
Two code blocks in
docs/plans/agent-invite-endpoint-plan.mdwere bare top-level object literals.prettier-plugin-sort-importsparses every```typescriptblock as a TS module to sort imports, and babel rejects these particular blocks as "labeled statement followed by comma" — surfacing as two recurringimport sorting aborted due to babel parsing errorwarnings inprettier --checkacross CI for any PR touching this tree (noticed on #219 and the IAP branches).Wrapping the snippets in declarations (
const … = z.object({…})andtype Response = …) makes them valid TS, drops the warnings, and keeps the docs readable.Test plan
bun format:check→ no more babel parsing errorsNeed help on this PR? Tag
@codesmithwith what you need.Note
Fix TypeScript code blocks in agent invite endpoint plan to be parseable by sort-imports plugin
Updates TypeScript snippets in agent-invite-endpoint-plan.md to use valid, parseable syntax. The request validation example is rewritten as an explicit Zod schema, and the response shape is expressed as a TypeScript union type instead of comment-based object examples.
Macroscope summarized 99223e6.
Summary by CodeRabbit