Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull Request Overview
This PR updates how SourceType::from_path classifies .js files as standard JavaScript rather than JSX, and moves the forced JSX promotion into the linter’s runtime. It also refreshes related tests and snapshots and adds a new fixture/test for JS treated as JSX.
- Refactor
SourceTypemapping to treat only.jsx/.tsxas JSX and all others (including.js) as standard. - In the linter runtime, force
.jsfiles to parse as JSX viawith_jsx(true). - Update tests, snapshots, and add a new
js_and_jsxtest and fixture.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_span/src/source_type.rs | Adjusted extension-to-variant mapping in From<FileExtension> |
| crates/oxc_span/src/source_type.rs (tests) | Updated assertions for js, mjs, cjs to is_javascript |
| crates/oxc_linter/src/service/runtime.rs | Added logic to force .js parsing as JSX; contains a typo in comment |
| apps/oxlint/src/snapshots/_fixtures__linter@*.snap | Updated snapshot counts and added new JS/JSX fixture output |
| apps/oxlint/src/snapshots/[email protected] | New snapshot for the js_and_jsx test |
| apps/oxlint/src/lint.rs | Added js_and_jsx test, but path mismatches the fixture name |
| apps/oxlint/fixtures/linter/js_as_jsx.js | New fixture (name mismatch with test) |
CodSpeed Instrumentation Performance ReportMerging #11038 will not alter performanceComparing Summary
|
cb81e31 to
8c47057
Compare
Merge activity
|
8c47057 to
6018f5c
Compare
Previously `SourceType::from_path(".js")` treats a `.js` file as `.jsx`
to maximize parse rate for the linter.
Force the `.jsx` change in the linter instead of a generic solution for `SourceType::from_path`.
6018f5c to
00dcece
Compare


closes #11020
Previously
SourceType::from_path(".js")treats a.jsfile as.jsxto maximize parse rate for the linter.
Force the
.jsxchange in the linter instead of a generic solution forSourceType::from_path.