fix(napi-derive): escape * in comments#3109
Conversation
📝 WalkthroughWalkthroughThe changes introduce a helper function to escape the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This pull request fixes a bug where */ sequences in Rust doc comments would prematurely terminate JSDoc comment blocks in the generated TypeScript declaration files. The fix adds an escape function that converts */ to *\/ in all JSDoc output.
Changes:
- Added
escape_comment_closefunction to properly escape*/sequences in JSDoc comments - Updated example and test files to demonstrate the fix with a test case containing
"*/json"in a comment
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/backend/src/typegen.rs | Implements the escape_comment_close function and applies it to all JSDoc comment output (both single-line and multi-line formats) |
| examples/napi/src/class.rs | Adds a test comment containing "*/json" to verify the fix |
| examples/napi/index.d.cts | Shows the generated TypeScript with properly escaped "*\/json" comment |
| examples/napi/tests/snapshots/values.spec.ts.md | Updates snapshot to reflect the properly escaped comment |
| examples/napi/tests/snapshots/values.spec.ts.snap | Binary snapshot file update |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

//style comments #3100Note
Ensures generated JSDoc never closes comment blocks prematurely when
*/appears in source docs.JSDocformatter intypegen.rsto escape*/as*\/for both single-line and multi-line outputsexamples/napicomments and snapshots to include a case like"*/json", verifying correct escaping in generatedindex.d.ctsWritten by Cursor Bugbot for commit cb2fcc9. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.