Skip to content

Comments

feat(oxfmt): Support config for prettier formatFile()#16526

Closed
leaysgur wants to merge 1 commit into12-05-feat_oxfmt_support_formatting_html_yaml_graphql_handlerbars_markdown_css_filesfrom
12-05-feat_oxfmt_support_config_for_prettier_formatting
Closed

feat(oxfmt): Support config for prettier formatFile()#16526
leaysgur wants to merge 1 commit into12-05-feat_oxfmt_support_formatting_html_yaml_graphql_handlerbars_markdown_css_filesfrom
12-05-feat_oxfmt_support_config_for_prettier_formatting

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Dec 5, 2025

  • When calling Prettier, pass config file path and read it in JS
    • It is possible because our current config file is almost as-is with Prettier's
  • And, since there is only single config, just load it once and cache it
  • We don't need to enumerate every field to deserialize with serde
    • We have no way of knowing what fields the plugin will define in the first place

@github-actions github-actions bot added A-cli Area - CLI A-formatter Area - Formatter C-enhancement Category - New feature or request labels Dec 5, 2025
Copy link
Member Author

leaysgur commented Dec 5, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@leaysgur leaysgur changed the title feat(oxfmt): Support config for prettier formatting feat(oxfmt): Support config (and also plugins) for prettier formatting Dec 5, 2025
@leaysgur
Copy link
Member Author

leaysgur commented Dec 5, 2025

Ah, import(".oxfmtrc.jsonc" { with: { type: "json" }}) does not support JSONC!

Choices:

@leaysgur leaysgur force-pushed the 12-05-feat_oxfmt_support_config_for_prettier_formatting branch from 0a4898b to c16b04a Compare December 5, 2025 06:32
@leaysgur leaysgur changed the title feat(oxfmt): Support config (and also plugins) for prettier formatting feat(oxfmt): Support config (and also plugins) for prettier formatFile() Dec 5, 2025
@leaysgur leaysgur changed the title feat(oxfmt): Support config (and also plugins) for prettier formatFile() feat(oxfmt): Support config for prettier formatFile() Dec 5, 2025
@leaysgur
Copy link
Member Author

leaysgur commented Dec 5, 2025

On second thought, this is incomplete.

If we resolve plugins[].languages for plugins, we can cache config at that time, so there's no need to pass them individually.

@leaysgur leaysgur closed this Dec 5, 2025
@leaysgur leaysgur deleted the 12-05-feat_oxfmt_support_config_for_prettier_formatting branch December 5, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-formatter Area - Formatter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant