-
-
Notifications
You must be signed in to change notification settings - Fork 718
feat(formatter): keep parser options consistent for all formatter usages #13884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(formatter): keep parser options consistent for all formatter usages #13884
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures consistent parser options configuration across all formatter usage examples and tests by standardizing the ParseOptions struct initialization. The changes make the parser configuration explicit and consistent rather than relying on default values that might vary.
- Replaces
ParseOptions::default()with explicit option values - Adds explicit flags for
parse_regular_expression,allow_v8_intrinsics, andallow_return_outside_function - Includes helpful comments explaining the formatter's expectations
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/prettier_conformance/src/lib.rs | Updates parser options to use explicit configuration instead of defaults |
| tasks/benchmark/benches/formatter.rs | Standardizes parser options with explicit values for consistency |
| crates/oxc_formatter/examples/formatter.rs | Aligns example code with consistent parser option configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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. |
CodSpeed Instrumentation Performance ReportMerging #13884 will not alter performanceComparing Summary
Footnotes |
81d0600 to
8b7f7c3
Compare
leaysgur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will add Formatter::parser_options() one day?
Merge activity
|
24069bc to
2cead8b
Compare
Yes, It should be. Maybe we should expose a parse method or accept a file path to format? |

Copy from oxfmt
oxc/apps/oxfmt/src/service.rs
Lines 45 to 54 in adda5f5