Skip to content

Editor format on save does not stay in sync with fmt config from vite.config.ts #861

@GGGLHHH

Description

@GGGLHHH

Reproduction

In a Vite+ project, formatting rules are configured in vite.config.ts:

export default defineConfig({
  fmt: {
    singleQuote: true,
    semi: false,
    trailingComma: 'all',
  },
})

VS Code workspace settings follow the documented recommendation:

{
  "editor.defaultFormatter": "oxc.oxc-vscode",
  "editor.formatOnSave": true,
  "editor.formatOnSaveMode": "file",
  "editor.codeActionsOnSave": {
    "source.fixAll.oxc": "explicit"
  }
}

What happens

  • vp check --fix formats files according to fmt in vite.config.ts
  • VS Code format-on-save uses OXC formatter behavior that does not appear to read the same config source
  • this causes formatting drift between editor save and command-line formatting

For example:

  • save in editor turns strings into double quotes
  • vp check --fix turns them back to single quotes because singleQuote: true is set in vite.config.ts

Expected behavior

The documented editor setup should stay consistent with vp fmt / vp check --fix, or the docs should explicitly state that editor formatting needs a separate OXC-native config file.

Questions

  • Is VS Code format-on-save expected to read fmt from vite.config.ts?
  • If not, what is the recommended single source of truth for formatting rules in a Vite+ project?

Notes

I was able to confirm that vp fmt --write respects singleQuote: true, so the mismatch seems to be between Vite+ config-driven formatting and editor integration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions