Skip to content

Report an error for private identifiers in JSX tag and attribute names - #65395

Open
Elecmonkey (elecmonkey) wants to merge 1 commit into
microsoft:mainfrom
elecmonkey:fix-jsx-private-identifier-name
Open

Elecmonkey (elecmonkey) wants to merge 1 commit into
microsoft:mainfrom
elecmonkey:fix-jsx-private-identifier-name

Conversation

@elecmonkey

@elecmonkey Elecmonkey (elecmonkey) commented Nov 8, 2026 •

Copy link
Copy Markdown

Fixes #65396

Analysis

JSX tag and attribute names starting with # (e.g. <#a></#a>, <a #b />) are accepted without a syntax error, and --jsx react emits invalid JS such as React.createElement(#a, null). <a.#b /> already reports Identifier expected.

tokenIsIdentifierOrKeyword also matches KindPrivateIdentifier, so ScanJsxIdentifier and parseIdentifierNameErrorOnUnicodeEscapeSequence treat the token as an identifier.

Fix

Exclude KindPrivateIdentifier in both places and report Identifier expected., matching <a.#b />.

Copilot Checklist

I successfully ran the applicable command at the end of my session, and it completed without error:

  • npx hereby validate

Copilot AI balanced review requested due to automatic review settings November 8, 2026 19:54
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 8, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 8, 2026
@typescript-automation

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

JSX tag and attribute names starting with # are accepted without a syntax error

2 participants