Skip to content

refactor(oxfmt): allow missing lint config#20243

Closed
camc314 wants to merge 1 commit intoc/03-11-oxlint_extract_vite_lint_config_in_js_loaderfrom
c/03-11-refactor_oxfmt_allow_missing_lint_config
Closed

refactor(oxfmt): allow missing lint config#20243
camc314 wants to merge 1 commit intoc/03-11-oxlint_extract_vite_lint_config_in_js_loaderfrom
c/03-11-refactor_oxfmt_allow_missing_lint_config

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Mar 11, 2026

without this, users using vite with the default config encounter an error when using oxfmt (same as the PR above this)

Copy link
Contributor Author

camc314 commented Mar 11, 2026

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 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-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Mar 11, 2026
@camc314 camc314 assigned camc314 and leaysgur and unassigned camc314 Mar 11, 2026
@camc314 camc314 marked this pull request as ready for review March 11, 2026 21:43
Copilot AI review requested due to automatic review settings March 11, 2026 21:43
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

Refactors oxfmt’s Vite config handling so that a vite.config.ts without an fmt field no longer errors, and instead falls back to the default oxfmt configuration (improving usability for Vite default setups).

Changes:

  • Updates CLI test and snapshot to expect success when vite.config.ts has no fmt field.
  • Moves Vite .fmt extraction from Rust config resolution into the JS config loader, defaulting to {} when missing.
  • Removes the Rust-side error path that required fmt to be present in vite.config.ts.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
apps/oxfmt/test/cli/vite_config/vite_config.test.ts Renames the test to assert fallback behavior when fmt is missing.
apps/oxfmt/test/cli/vite_config/snapshots/vite_config.test.ts.snap Updates snapshot to reflect exit code/output for successful fallback behavior.
apps/oxfmt/src/core/config.rs Removes Rust-side Vite .fmt field extraction/error path.
apps/oxfmt/src-js/cli/js_config.ts Adds Vite-specific .fmt extraction with {} fallback and validation.

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

Comment on lines 263 to 267
.map_err(|_| {
format!(
"{}\nEnsure the file has a valid default export of a JSON-serializable configuration object.",
path.display()
)
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

With the Vite .fmt validation now happening in the JS loader, any JS-side error details are currently lost: create_js_config_loader maps all JS errors to a generic string and this call site also discards the error (map_err(|_| ...)). This will make misconfigurations like a non-object fmt field hard to diagnose. Consider preserving and surfacing the underlying error message (e.g., map to err.to_string() in the loader and include it in this map_err).

Copilot uses AI. Check for mistakes.
@camc314 camc314 force-pushed the c/03-11-refactor_oxfmt_allow_missing_lint_config branch from 79f3537 to 38ed0bb Compare March 11, 2026 22:23
@camc314 camc314 force-pushed the c/03-11-refactor_oxfmt_allow_missing_lint_config branch from 38ed0bb to 07d2329 Compare March 11, 2026 22:25
@camc314 camc314 requested a review from overlookmotel as a code owner March 11, 2026 22:25
@github-actions github-actions bot added A-linter Area - Linter A-linter-plugins Area - Linter JS plugins labels Mar 11, 2026
@graphite-app graphite-app bot closed this in fdaca97 Mar 12, 2026
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-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants