Skip to content

feat(oxfmt): support associations config to specify language over filepath - #27437

Merged
graphite-app[bot] merged 1 commit into
mainfrom
10-08-feat_oxfmt_support_config.associations
Oct 11, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
10-08-feat_oxfmt_support_config.associations

Conversation

@leaysgur

@leaysgur leaysgur commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Closes #17852 (finally!), closes #26257.


Introduce associations config field (inspired by dprint).

{
  "associations": [
    { "files": ["**/*.html"], "excludeFiles": ["index.html"], "language": "angular-html" },
    { "files": ["**/*.wxml"], "language": "html" },
    { "files": ["**/*.conf"], "language": "json" }
  ]
}

Precedence is solved by an array instead of an object, later wins like overrides.
For language, use Shiki ids. It's intuitive and already used in our codebase.

In the CLI, this bypasses selecting a formatter based on the filename and behaves as if one had been determined.

leaysgur commented Oct 8, 2026 •

Copy link
Copy Markdown
Member Author

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 changes, fast-track this PR to the front of 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.

@github-actions github-actions Bot added A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter labels Oct 8, 2026
@leaysgur
leaysgur force-pushed the 10-08-refactor_oxfmt_clarify_handlebars_and_glimmer_relationship branch from c6d6539 to e81b39c Compare October 8, 2026 04:41
@leaysgur
leaysgur force-pushed the 10-08-feat_oxfmt_support_config.associations branch 2 times, most recently from cc8f07b to da7d39e Compare October 8, 2026 04:42
@graphite-app
graphite-app Bot force-pushed the 10-08-refactor_oxfmt_clarify_handlebars_and_glimmer_relationship branch 2 times, most recently from 9b2b079 to d63f35b Compare October 8, 2026 05:04
@leaysgur leaysgur changed the title feat(oxfmt): support config.associations feat(oxfmt): support associations config to specify language over filepath Oct 8, 2026
@graphite-app
graphite-app Bot force-pushed the 10-08-feat_oxfmt_support_config.associations branch from da7d39e to 8771b3a Compare October 8, 2026 05:04
@graphite-app
graphite-app Bot changed the base branch from 10-08-refactor_oxfmt_clarify_handlebars_and_glimmer_relationship to graphite-base/27437 October 8, 2026 05:09
@graphite-app
graphite-app Bot force-pushed the 10-08-feat_oxfmt_support_config.associations branch from 8771b3a to cb5aed3 Compare October 8, 2026 05:12
@graphite-app
graphite-app Bot force-pushed the graphite-base/27437 branch from d63f35b to 6a45d4a Compare October 8, 2026 05:12
@graphite-app
graphite-app Bot changed the base branch from graphite-base/27437 to main October 8, 2026 05:13
@graphite-app
graphite-app Bot force-pushed the 10-08-feat_oxfmt_support_config.associations branch from cb5aed3 to f82d6da Compare October 8, 2026 05:13
@leaysgur
leaysgur force-pushed the 10-08-feat_oxfmt_support_config.associations branch 2 times, most recently from 32bdc18 to 177f315 Compare October 8, 2026 05:46
@leaysgur
leaysgur force-pushed the 10-08-feat_oxfmt_support_config.associations branch 2 times, most recently from f851a40 to b45413f Compare October 9, 2026 00:29
@leaysgur
leaysgur force-pushed the 10-08-feat_oxfmt_support_config.associations branch 2 times, most recently from 540139b to 06aab2b Compare October 9, 2026 02:58
@leaysgur
leaysgur force-pushed the 10-08-feat_oxfmt_support_config.associations branch 2 times, most recently from 7663279 to b8d3587 Compare October 9, 2026 06:34
@graphite-app graphite-app Bot added the 0-merge Merge with Graphite Merge Queue label Oct 11, 2026
@graphite-app

graphite-app Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Merge activity

…ilepath (#27437)

Closes #17852 (finally!), closes #26257.

---

Introduce `associations` config field (inspired by dprint).

```json
{
  "associations": [
    { "files": ["**/*.html"], "excludeFiles": ["index.html"], "language": "angular-html" },
    { "files": ["**/*.wxml"], "language": "html" },
    { "files": ["**/*.conf"], "language": "json" }
  ]
}
```

Precedence is solved by an array instead of an object, later wins like `overrides`.
For `language`, use Shiki ids. It's intuitive and already used in our codebase.

In the CLI, this bypasses selecting a formatter based on the filename and behaves as if one had been determined.
@graphite-app
graphite-app Bot force-pushed the 10-08-feat_oxfmt_support_config.associations branch from b8d3587 to a495e82 Compare October 11, 2026 12:19
@graphite-app
graphite-app Bot merged commit a495e82 into main Oct 11, 2026
31 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Oct 11, 2026
@graphite-app
graphite-app Bot deleted the 10-08-feat_oxfmt_support_config.associations branch October 11, 2026 12:22
overlookmotel pushed a commit that referenced this pull request Oct 13, 2026
# Oxlint
### 💥 BREAKING CHANGES

- 7730e14 ast: [**BREAKING**] Refactor comment attachment storage
(#27512) (camc314)
- c904b61 ast: [**BREAKING**] Add comment attachment storage (#27393)
(camc314)

### 🚀 Features

- bde9f69 oxlint/lsp: Show config errors to LSP client (#25486) (Sysix)
- 3c361a7 linter/unicorn/prefer-query-selector: Add `allowWithVariables`
option (#27346) (Mikhail Baev)

### 🐛 Bug Fixes

- 82ecc43 linter/sort-keys: Compare natural order like ESLint (#27579)
(Dunqing)
- 598ac03 linter/unicorn/prefer-bigint-literals: Unwrap redundant
constructor call; don't auto-fix for lost precision (#25690) (Jacob
Bandes-Storch)
- 2512213 linter: Prevent conflicting type import fixes (#27409)
(camc314)
- 2349a31 oxfmt: Follow symlinked configs in discovery (#27389)
(leaysgur)
- 6e573f9 oxlint,oxfmt: Set stderr blocking (#27363) (leaysgur)

### ⚡ Performance

- 91b588c linter/oxc/bad-array-method-on-arguments: Check arguments
references once (#26930) (camc314)
- c5f47ed linter/plugins: Inline `firstCommentAtOrAfter` into call sites
(#27539) (overlookmotel)
- c5f9235 linter/plugins: Use shift over multiply for powers of 2
(#27536) (overlookmotel)
- 8c57c5e linter: Share one source per file across type-aware
diagnostics (#27462) (Max Schwenk)
- 19c227d minifier: Use ident when checking specific id names (#27208)
(Armano)

### 📚 Documentation

- 98cc2b4 linter/plugins: Improve documentation for
`firstCommentAtOrAfter` (#27538) (overlookmotel)
- 3bb54f6 linter: Update stale comment (#27519) (overlookmotel)
- 848a4e7 linter: Update fix metadata for tsgolint rules that already
provide fixes (#27408) (Mikhail Baev)
# Oxfmt
### 💥 BREAKING CHANGES

- 1ef2888 oxfmt: [**BREAKING**] Improve `--migrate prettier` (#27444)
(leaysgur)
- c2e6d5f formatter_toml: [**BREAKING**] Add `oxc_formatter_toml` crate
wrapping `oxc-toml` (#27365) (leaysgur)

### 🚀 Features

- ce4e8dc oxfmt: Support `overrides[].parser` ->
`associations[].language` migration (#27475) (leaysgur)
- a495e82 oxfmt: Support `associations` config to specify language over
filepath (#27437) (leaysgur)
- 77f8156 oxfmt/lsp: Show root config errors to LSP client (#26014)
(Sysix)
- c1adce3 oxfmt/lsp: Support astro language (#27388) (leaysgur)
- 4f024a1 oxfmt: Support astro plugin in `--migrate prettier` (#27387)
(leaysgur)
- 5db28fa oxfmt: Support Astro via `prettier-plugin-astro@1.x` (#27386)
(leaysgur)

### 🐛 Bug Fixes

- 76ec31b formatter_css: Support css-in-js placeholders in property
names and conditions (#27640) (leaysgur)
- 99bb268 formatter_css: Keep css-in-js placeholder as media type
(#27639) (leaysgur)
- 372849e formatter: Fix crash on css-in-js comment containing
interpolation (#27638) (leaysgur)
- da692b8 formatter: Wrap `export default class|function` consistently
(#27628) (leaysgur)
- 21dee96 formatter: Keep parens around `TSInstantiationExpression`
before ! and export (#27626) (leaysgur)
- b6eb914 oxfmt: Normalize symlink targets in CLI snapshots (#27498)
(camc314)
- 5dae56f oxfmt/lsp: Return error on config resolving error (#26003)
(Sysix)
- 676cc60 formatter/jsdoc: Preserve paragraphs by checking
`@description` tag width (#27439) (leaysgur)
- 2349a31 oxfmt: Follow symlinked configs in discovery (#27389)
(leaysgur)
- db360de oxfmt: Load svelte plugin for svelte-in-mdx-in-md (#27369)
(leaysgur)
- 6e573f9 oxlint,oxfmt: Set stderr blocking (#27363) (leaysgur)
- d730fdd formatter_core: Leave blank frontmatter without dispatcher
(#27359) (leaysgur)

### 📚 Documentation

- 4a28c91 formatter_css: Clarify `missed-semicolon-accepted` divergence
(#27433) (leaysgur)
- 408d87f oxfmt: Simplify oxfmtrc docs (#27432) (leaysgur)
- 902e188 oxfmt: Update how `embeddedLanguageFormatting` option works
(#27362) (leaysgur)
- 37b3c48 formatter_markdown: Fix DIVERGENCES.md examples and slug to
match behavior (#27358) (leaysgur)

Co-authored-by: leaysgur <6259812+leaysgur@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oxfmt: support parser option (with overrides)

1 participant