| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
JSX text content is lexed with the JavaScript rules, which have no rule for symbols outside ASCII, so arrows, dashes, curly quotes and emoji in element content (<li>Star -> Slack</li>) produced Error tokens. Add a fallback after the inherited rules, next to the existing apostrophe fallback, so identifiers with non-ASCII letters keep being lexed by the JavaScript identifier rule first. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
JSX element content is lexed with the plain JavaScript rules, which have no rule for characters outside ASCII that are not identifier letters. So arrows, dashes, curly quotes, bullets and emoji in text content, e.g.
each produce an Error token. In a real Next.js codebase these were 70 of the 336 Error tokens across its .tsx files (the rest are the type-argument issue addressed in #3272).
The JSX/TSX lexers already append a fallback rule after the inherited JavaScript rules for the apostrophe in text (<div>I'm here</div>); this adds a sibling fallback for runs of non-ASCII characters, emitted as Text. Because it comes after inherit, identifiers containing non-ASCII letters (const café = 1) are still matched by the JavaScript identifier rule first. Independent of #3272.