Files
readest/apps/readest-app/.claude/memory/feedback_no_lookbehind_regex.md
T
Huang Xin db35a4e203 fix(style): clamp oversized hardcoded pixel widths and fix browser test flakiness (#3785)
Closes #3770.

Add transformStylesheet rule that clips CSS width declarations exceeding the
viewport with max-width and border-box sizing. Also add @testing-library/react
to vitest browser optimizeDeps.include to prevent mid-test Vite reloads on CI.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 07:23:30 +02:00

841 B

name, description, type
name description type
No lookbehind regex Never use lookbehind assertions in JS/TS code — the build check rejects them for browser compatibility feedback

Never use lookbehind regex ((?<=...) or (?<!...)) in JavaScript/TypeScript source code. Use (?:^|[^...]) or other alternatives instead.

Why: The project has a check:lookbehind-regex build check (pnpm check:all) that scans the Next.js output chunks and fails if any lookbehind assertions are found. Older WebViews (especially on some Android devices) don't support lookbehinds.

How to apply: When writing regex that needs to assert what comes before a match, use a non-capturing group with alternation (e.g., (?:^|[^a-z-])) instead of a negative lookbehind ((?<![a-z-])). This applies to all .ts/.tsx/.js files that end up in the build output.