fix(transformer): ignore invalid JSX pragma identifiers#19296
Merged
graphite-app[bot] merged 1 commit intomainfrom Feb 12, 2026
Merged
fix(transformer): ignore invalid JSX pragma identifiers#19296graphite-app[bot] merged 1 commit intomainfrom
graphite-app[bot] merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens classic JSX pragma parsing in oxc_transformer by validating pragma strings before constructing pragma expressions, so invalid values (e.g. `) are ignored and the transformer falls back to defaults (notably React.Fragment).
Changes:
- Validate classic JSX pragma strings during parsing and fall back to defaults when invalid.
- Emit the existing
invalid_pragmadiagnostic for invalid non-empty pragma values in the test-only parse path. - Add a regression test ensuring an invalid pragma input falls back to
React.Fragment.
Merging this PR will not alter performance
Comparing Footnotes
|
Member
Author
Merge activity
|
## Summary - keep pragma validation centralized in classic JSX pragma parsing (`Pragma::parse_impl`) - ignore invalid non-empty pragma values (for example `` ` ``) by falling back to default classic pragmas - simplify the change by removing duplicated comment-level pragma validation and extra diagnostics/tests - keep one focused regression test for invalid pragma fallback Fixes #16653. ## Testing - `cargo test -p oxc_transformer invalid_pragma_falls_back_to_default` - `cargo test -p oxc_transformer test_find_jsx_pragma` - `just lint` ## AI Usage Disclosure - This change was drafted with AI assistance (Codex / GPT-5).
cf37b7b to
41c50a5
Compare
camc314
pushed a commit
that referenced
this pull request
Feb 16, 2026
### 🚀 Features - 429d876 semantic: Assign ast node ids during semantic build (#19263) (Boshen) - ebb80b3 ast: Add `node_id` field to all AST struct nodes (#18138) (Boshen) ### 🐛 Bug Fixes - bfb15a3 semantic: Make multi_index_vec clone panic-safe (#19299) (Boshen) - 41c50a5 transformer: Ignore invalid JSX pragma identifiers (#19296) (Boshen) - deed3d8 transformer: Remove unnecessary trailing expression in object rest spread assignment (#19259) (Boshen) - 5bdaacc transformer: Propagate source spans for sourcemap correctness (#19258) (Boshen) - 3e0e5ba isolated-declarations: Align readonly class array initializer diagnostics with tsc (#19218) (camc314) ### ⚡ Performance - c169c77 syntax: Optimize `is_identifier_name_patched` (#19386) (sapphi-red) - aa1e1a8 allocator: Inline BitSet accessors (#19331) (Boshen) - 5b90d46 semantic: Improve SoA with multi index vec (#19138) (Boshen) - 99ce2a6 isolated_declarations: Mark all diagnostic functions as `#[cold]` (#19279) (camc314) - dd0220f transformer: Remove TS-only nodes earlier in `enter_statements` (#19166) (Dunqing) - e5baf60 isolated-declarations: Replace hash collections with index-based Vec (#19221) (Dunqing) ### 📚 Documentation - 569aa61 rust: Add missing rustdocs and remove missing_docs lint attrs (#19306) (Boshen)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pragma::parse_impl)`) by falling back to default classic pragmasFixes #16653.
Testing
cargo test -p oxc_transformer invalid_pragma_falls_back_to_defaultcargo test -p oxc_transformer test_find_jsx_pragmajust lintAI Usage Disclosure