fix(isTypedList): validate property syntax#414
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves validation for typed list detection by adding stricter property syntax validation and safer null handling. It ensures that inline code blocks in typed lists contain valid JavaScript property names and adds defensive programming to handle potential null values.
- Added validation to ensure inline code content matches valid JavaScript property syntax
- Improved null safety by checking for undefined values before accessing properties
- Extracted property validation logic to a reusable constant
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils/queries/index.mjs | Enhanced typed list validation logic with property syntax checking and null safety |
| src/utils/queries/constants.mjs | Added regex constant for JavaScript property validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #414 +/- ##
==========================================
- Coverage 74.22% 72.25% -1.97%
==========================================
Files 118 96 -22
Lines 10994 9484 -1510
Branches 696 586 -110
==========================================
- Hits 8160 6853 -1307
+ Misses 2831 2629 -202
+ Partials 3 2 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Bump @nodejs/web-infra, this is a bug fix |
Previously, any
inlineCodeblock inside a list that matched the syntax of a typed-list would be considered valid. After this, theinlineCode's content must also be a valid JavaScript property (/^[a-z0-9$_]+$/i1). Additionally, previously, the node immediately following the property in a typed list was assumed to be a text node, however, in non-Typed lists, this could realisticly be any node, so a nullish check was added.Footnotes
Note: In this RegExp, properties can begin with numbers. This is intentional, since, in the event of an array, a number property may be valid in a typed list. ↩