Skip to content

feat(oxlint): Support vite.config.ts .lint field#20214

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-11-feat_oxlint_support_vite.config.ts.lint_field
Mar 11, 2026
Merged

feat(oxlint): Support vite.config.ts .lint field#20214
graphite-app[bot] merged 1 commit intomainfrom
03-11-feat_oxlint_support_vite.config.ts.lint_field

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Mar 11, 2026

Vite+ support for Oxlint.

  • Root config only
    • Not expected nested vite configs
  • Auto discover vite.config.ts only
    • Other extensions (.js, .mts, etc.) can be added later without breaking compatibility though
    • This is the same as oxlint.config.*
  • Lowest priority
    • .oxlintrc.json / .oxlintrc.jsonc / oxlint.config.ts take precedence in the same directory
  • defineConfig() check in JS is skipped for vite.config.ts
    • I don't know the right way to handle this case
  • Also work with -c vite.config.ts

For now, I've tried to achieve the goal with the minimum changes, and if needed, we should be able to expand support later.

@leaysgur leaysgur requested a review from camc314 as a code owner March 11, 2026 03:37
Copy link
Member Author

leaysgur commented Mar 11, 2026


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-linter Area - Linter A-cli Area - CLI C-enhancement Category - New feature or request labels Mar 11, 2026
@leaysgur leaysgur changed the title feat(oxlint): Support vite.config.ts.lint field feat(oxlint): Support vite.config.ts .lint field Mar 11, 2026
@leaysgur leaysgur force-pushed the 03-11-feat_oxlint_support_vite.config.ts.lint_field branch from 1f3f16d to e291282 Compare March 11, 2026 03:48
@leaysgur leaysgur requested a review from overlookmotel as a code owner March 11, 2026 03:48
@github-actions github-actions bot added the A-linter-plugins Area - Linter JS plugins label Mar 11, 2026
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 11, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 11, 2026

Merge activity

Vite+ support for Oxlint.

- Root config only
  - Not expected nested vite configs
- Auto discover `vite.config.ts` only
  - Other extensions (.js, .mts, etc.) can be added later without breaking compatibility though
  - This is the same as `oxlint.config.*`
- Lowest priority
  - .oxlintrc.json / .oxlintrc.jsonc / oxlint.config.ts take precedence in the same directory
- `defineConfig()` check in JS is skipped for `vite.config.ts`
  - I don't know the right way to handle this case
- Also work with `-c vite.config.ts`

For now, I've tried to achieve the goal with the minimum changes, and if needed, we should be able to expand support later.
@graphite-app graphite-app bot force-pushed the 03-10-feat_oxfmt_support_vite.config._.fmt_field branch from dc728ae to 95943aa Compare March 11, 2026 04:35
@graphite-app graphite-app bot force-pushed the 03-11-feat_oxlint_support_vite.config.ts.lint_field branch from 6cdaf7e to 04a5ce0 Compare March 11, 2026 04:35
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 11, 2026
Base automatically changed from 03-10-feat_oxfmt_support_vite.config._.fmt_field to main March 11, 2026 04:46
@graphite-app graphite-app bot merged commit 04a5ce0 into main Mar 11, 2026
20 checks passed
@graphite-app graphite-app bot deleted the 03-11-feat_oxlint_support_vite.config.ts.lint_field branch March 11, 2026 04:47
leaysgur added a commit that referenced this pull request Mar 11, 2026
# Oxlint
### 🚀 Features

- 04a5ce0 oxlint: Support `vite.config.ts` `.lint` field (#20214)
(leaysgur)
- 1735215 linter: Implement `react/no-clone-element` rule. (#20129)
(connorshea)
- 68e6f6f linter: Implement `react/no-react-children` rule. (#20104)
(connorshea)
- fe3b32e linter/plugins: Add `oxlint-plugin-eslint` package (#20009)
(overlookmotel)

### 🐛 Bug Fixes

- 05f6a09 linter/no-inline-comments: Deserialize rule options with serde
(#20207) (camc314)
- c7eb09d linter/default-case: Deserialize rule options with serde
(#20206) (camc314)
- f85e16c linter/plugins: Fix types for visitor compilation (#20203)
(overlookmotel)
- 44e24e0 linter/exhaustive-deps: Ignore type-only typeof deps (#20201)
(camc314)
- 0b04998 linter/no-fallthrough: Deserialize rule options with serde
(#20192) (camc314)
- a1031cb linter/new-cap: Deserialize rule options with serde (#20161)
(camc314)
- ad27fd6 linter: Add help messages to import plugin diagnostics
(#20158) (John Costa)
- 1340307 linter/plugins: Ensure `after` hooks always run (#20167)
(overlookmotel)
- c4812ec linter/plugins: Reset visitor compilation state if error
during compilation (#20166) (overlookmotel)
- 887eecc linter/plugins: Add license notice to `oxlint-plugin-eslint`
package (#20164) (overlookmotel)
- e1713a4 linter/plugins: Include common chunks in
`oxlint-plugin-eslint` package (#20163) (overlookmotel)
- a9acb2b linter: Check `globals` entry for `no-undef`, only check
es2026 globals for `no-extend-native` and
`no-constant-binary-expression` (#20089) (Sysix)
- 5559f0d linter/no-unused-vars: `reportUsedIgnorePattern` should not
report used rest siblings (#20108) (Don Isaac)
- de7c0e2 linter/plugins: Correct error message for `markVariableAsUsed`
(#20152) (overlookmotel)

### ⚡ Performance

- 3a86427 linter/plugins: Pre-populate cache of `EnterExit` objects at
startup (#20194) (overlookmotel)
- d243391 linter/plugins: Replace arrays with `Uint8Array`s (#20190)
(overlookmotel)
- 8742f8b linter/plugins: Pre-populate cache of `VisitProp` objects
(#20189) (overlookmotel)
- 3061acb linter/plugins: Pre-populate cache of `EnterExit` objects
(#20187) (overlookmotel)
- c73912b linter/plugins: Free visit functions earlier (#20186)
(overlookmotel)
- d9f8ff4 linter/plugins: Faster reset of visitor state (#20185)
(overlookmotel)
- 42aff15 oxlint/lsp: Avoid computing diagnostics for non invoked code
actions requests (#20080) (Sysix)

### 📚 Documentation

- a080650 linter/plugins: Fix documentation of visitor compilation
(#20202) (overlookmotel)
- 542a04a linter: Add a link to the cyclomatic complexity Wikipedia
article in `eslint/complexity` (#20174) (connorshea)
# Oxfmt
### 🚀 Features

- 95943aa oxfmt: Support `vite.config.*` `.fmt` field (#20197)
(leaysgur)
- 172fc07 oxfmt: .js/.ts config file support (#20135) (leaysgur)

### 🐛 Bug Fixes

- e483569 oxfmt: Avoid double-escaping in css-in-js (#20211) (leaysgur)

Co-authored-by: leaysgur <6259812+leaysgur@users.noreply.github.com>
Comment on lines +122 to +142

// Vite config files: extract the `.lint` field
let is_vite_config = path
.file_name()
.and_then(|f| f.to_str())
.is_some_and(|name| name == VITE_CONFIG_NAME);
let config_value = if is_vite_config {
if let Some(v) = entry.config.get(VITE_OXLINT_CONFIG_FIELD).cloned() {
v
} else {
errors.push(OxcDiagnostic::error(format!(
"Expected a `{VITE_OXLINT_CONFIG_FIELD}` field in the default export of {}",
entry.path
)));
return (configs, errors);
}
} else {
entry.config
};

let mut oxlintrc = match parse_js_oxlintrc(config_value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do this on the JS side to avoid sending excess data to rust.

.file_name()
.and_then(|f| f.to_str())
.is_some_and(|name| name == VITE_CONFIG_NAME);
let config_value = if is_vite_config {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to comment on a merged PR but I don't think this allows the lint property to be optional - I'm seeing

> oxlint

Failed to parse oxlint configuration file.

  × Expected a `lint` field in the default export of /home/runner/work/project/vite.config.ts

when I want this project to just use the default configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is a bug - please use the v1.52.0 in the interim

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants