fix(queries): allow complex types in type linking regex#814
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Adds unit coverage for those patterns (basic types, Reviewed by Cursor Bugbot for commit 0179459. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #814 +/- ##
==========================================
+ Coverage 82.86% 82.93% +0.06%
==========================================
Files 171 171
Lines 14961 15016 +55
Branches 1313 1321 +8
==========================================
+ Hits 12398 12453 +55
Misses 2554 2554
Partials 9 9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
avivkeller
left a comment
There was a problem hiding this comment.
Can you run npm version patch?
AugustinMauroy
left a comment
There was a problem hiding this comment.
LGMT ! is there are test for that ?
Added test coverage for normalizeTypes and linksWithTypes to ensure complex JSDoc types (generics, unions) are matched correctly.
I initially relied only on screenshots to show it works, but u r right. |
Description
Currently,
doc-kitfails to parse and link complex JSDoc types that contain generics, unions and arrow functions.This happens because the regex in
src/utils/queries/index.mjsuses[^<({})>]+, which excludes<,>,(, and). When the parser encounters these characters, it ignores the entire type block, leaving it unlinked and sometimes causing Markdown parsers (Remark) to see them as HTML tags.This PR updates the regex exclusion list to
[^{}]+.Validation
Before:

After:

Related Issues
No related one.
Check List
node --run testand all tests passed.node --run format&node --run lint.