Skip to content

fix(oxlint,oxfmt): Skip vite.config.ts exports defineConfig(fn)#20260

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-12-fix_oxlint_oxfmt_skip_vite.config.ts_exports_defineconfig_fn_
Mar 12, 2026
Merged

fix(oxlint,oxfmt): Skip vite.config.ts exports defineConfig(fn)#20260
graphite-app[bot] merged 1 commit intomainfrom
03-12-fix_oxlint_oxfmt_skip_vite.config.ts_exports_defineconfig_fn_

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Mar 12, 2026

vite.config.ts may return function from defineConfig(({ mode }) => ({ ... })), but we can't evaluate.

Just skip it like no .lint|fmt config.

Copy link
Member Author

leaysgur commented Mar 12, 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 the C-bug Category - Bug label Mar 12, 2026
@leaysgur leaysgur requested a review from Copilot March 12, 2026 03:40
@leaysgur leaysgur changed the title fix(oxlint,oxfmt): Skip vite.config.ts exports defineConfig(fn) fix(oxlint,oxfmt): Skip vite.config.ts exports defineConfig(fn) Mar 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates oxlint/oxfmt JS config loading to tolerate vite.config.ts default exports that are functions (e.g. defineConfig(fn)) by skipping them during config discovery, and adds fixtures/tests to lock in the behavior.

Changes:

  • oxlint: treat non-object vite.config.ts default exports as “skip config” (config: null) instead of throwing.
  • oxfmt: treat non-object vite.config.ts default exports as “skip config” (null) instead of throwing.
  • Add new fixtures + snapshot coverage for the function-export vite config case in both projects.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/oxlint/src-js/js_config.ts Skip vite.config.ts when default export isn’t an object; reuse helper for object checks.
apps/oxlint/test/fixtures/vite_config_fn_export/vite.config.ts Fixture vite config exporting defineConfig(fn).
apps/oxlint/test/fixtures/vite_config_fn_export/output.snap.md Expected fixture output snapshot.
apps/oxlint/test/fixtures/vite_config_fn_export/options.json Fixture options (single-threaded).
apps/oxlint/test/fixtures/vite_config_fn_export/files/test.js Fixture input file triggering a warning.
apps/oxfmt/src-js/cli/js_config.ts Skip vite.config.ts when default export isn’t an object; validate .fmt only on objects.
apps/oxfmt/test/cli/vite_config/vite_config.test.ts Add test case for skipping function-export vite config during auto-discovery.
apps/oxfmt/test/cli/vite_config/fixtures/skip_fn_export/vite.config.ts Fixture vite config exporting defineConfig(fn).
apps/oxfmt/test/cli/vite_config/fixtures/skip_fn_export/test.ts Fixture input file for formatter check.
apps/oxfmt/test/cli/vite_config/snapshots/vite_config.test.ts.snap Snapshot for the new oxfmt test case.

You can also share your feedback on Copilot code review. Take the survey.

@leaysgur leaysgur force-pushed the 03-12-fix_oxlint_oxfmt_skip_vite.config.ts_exports_defineconfig_fn_ branch from 7caf1cc to a50928d Compare March 12, 2026 03:58
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
Copy link
Member Author

leaysgur commented Mar 12, 2026

Merge activity

  • Mar 12, 4:14 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 12, 4:23 AM UTC: leaysgur added this pull request to the Graphite merge queue.
  • Mar 12, 4:29 AM UTC: The Graphite merge queue removed this pull request due to downstack failures on PR #20256.
  • Mar 12, 4:29 AM UTC: The Graphite merge queue removed this pull request due to downstack failures on PR #20256.
  • Mar 12, 4:39 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 12, 4:39 AM UTC: leaysgur added this pull request to the Graphite merge queue.
  • Mar 12, 4:39 AM UTC: The Graphite merge queue removed this pull request due to removal of a downstack PR #20257.
  • Mar 12, 4:39 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 12, 4:39 AM UTC: graphite-app added this pull request to the Graphite merge queue.
  • Mar 12, 4:41 AM UTC: The Graphite merge queue couldn't merge this PR because it had merge conflicts.
  • Mar 12, 4:48 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 12, 4:56 AM UTC: leaysgur added this pull request to the Graphite merge queue.
  • Mar 12, 5:07 AM UTC: Merged by the Graphite merge queue.

@graphite-app graphite-app bot changed the base branch from 03-12-refactor_oxfmt_extract_vite_fmt_config_in_js_loader to graphite-base/20260 March 12, 2026 04:16
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
@graphite-app graphite-app bot changed the base branch from graphite-base/20260 to main March 12, 2026 04:41
@leaysgur leaysgur force-pushed the 03-12-fix_oxlint_oxfmt_skip_vite.config.ts_exports_defineconfig_fn_ branch from a50928d to 9474e54 Compare March 12, 2026 04:45
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
…20260)

`vite.config.ts` may return function from `defineConfig(({ mode }) => ({ ... }))`, but we can't evaluate.

Just skip it like no `.lint|fmt` config.
@graphite-app graphite-app bot force-pushed the 03-12-fix_oxlint_oxfmt_skip_vite.config.ts_exports_defineconfig_fn_ branch from 9474e54 to 4ea67de Compare March 12, 2026 04:57
@graphite-app graphite-app bot merged commit 4ea67de into main Mar 12, 2026
19 checks passed
@graphite-app graphite-app bot deleted the 03-12-fix_oxlint_oxfmt_skip_vite.config.ts_exports_defineconfig_fn_ branch March 12, 2026 05:07
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
leaysgur added a commit that referenced this pull request Mar 12, 2026
# Oxlint
### 🐛 Bug Fixes

- 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)`
(#20260) (leaysgur)
- cc89dbf oxlint: Skip `vite.config.ts` w/o `.lint` field in
auto-discovery (#20255) (leaysgur)
- 89b7ca9 linter/no-duplicate-imports: Only check aggregated exports
(#20178) (kennytm)
- 691f556 linter/explicit-module-boundary-types: Ignore constructor
callbacks (#20221) (camc314)

### ⚡ Performance

- d160dca linter/plugins: Reduce array lookups in visitor compilation
(#20249) (overlookmotel)

### 📚 Documentation

- 0c7da4f linter: Fix extra closing brace in example config. (#20253)
(connorshea)
- 13606c3 linter/plugins: Update conformance README (#20234)
(overlookmotel)
# Oxfmt
### 🐛 Bug Fixes

- 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)`
(#20260) (leaysgur)
- 11a2b45 oxfmt: Skip `vite.config.ts` w/o `.fmt` field in
auto-discovery (#20254) (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-formatter Area - Formatter A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants