You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're maintaining our own regex based docblock pragma parsing logic, which is probably slower and less reliable than it could be as it search entire files instead of just comments at the top.
Suggested solution
We could use jest-docblock's parse function instead of our custom logic. It's a relatively small package with one dependency. They already have good support with many test cases, so we'd have less maintenance burden for maintaining compatibility with Jest (for example #1962 would be easier to fix).
Alternative
Refactor our parser so it's more performant and less reliant on regexes. I don't think we need a full CFG/BNF parser as long as we can focus on comments at the top of the file and parse pragmas. This would also reduce bundle size, in exchange for increasing maintenance effort and decreasing compatibility.
Additional context
jest-docblock doesn't support plain comments (//), so we'd technically be losing support for that unless we added a patch or workaround. However, we'd have to starting dealing with edge cases around groups of comments if we weren't using docblocks exclusively.
Clear and concise description of the problem
We're maintaining our own regex based docblock pragma parsing logic, which is probably slower and less reliable than it could be as it search entire files instead of just comments at the top.
Suggested solution
We could use
jest-docblock
'sparse
function instead of our custom logic. It's a relatively small package with one dependency. They already have good support with many test cases, so we'd have less maintenance burden for maintaining compatibility with Jest (for example #1962 would be easier to fix).Alternative
Refactor our parser so it's more performant and less reliant on regexes. I don't think we need a full CFG/BNF parser as long as we can focus on comments at the top of the file and parse pragmas. This would also reduce bundle size, in exchange for increasing maintenance effort and decreasing compatibility.
Additional context
jest-docblock
doesn't support plain comments (//
), so we'd technically be losing support for that unless we added a patch or workaround. However, we'd have to starting dealing with edge cases around groups of comments if we weren't using docblocks exclusively.Validations
The text was updated successfully, but these errors were encountered: