Skip to content

oxlint,oxfmt: presence of vite.config.ts without an ox(lint|fmt)rc produces an error message #21032

@kirbysayshi

Description

@kirbysayshi

I received the following error message after installing oxfmt in a repo that:

  • had a vite.config.ts
  • doesn't use vp nor had oxfmt configured within vite.config.ts
$ oxfmt --write:
Failed to load configuration file.
/[REDACTED]/vite.config.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /[REDACTED]/vite.config.ts
Ensure the file has a valid default export of a JSON-serializable configuration object.
$ pnpm --version
10.28.1
$ node --version
v24.13.0
$ pnpm ls oxfmt
...
devDependencies:
oxfmt 0.43.0

Running pnpm exec oxfmt --init fixed the issue.

Doing the following produced a helpful message:

$ mv .oxfmtrc.json .oxfmtrc.json.disabled
$ mv vite.config.ts vite.config.ts.disabled
$ pnpm exec oxfmt tsconfig.json
Finished in 113ms on 1 files using 10 threads.
No config found, using defaults. Please add a config file or try `oxfmt --init` if needed.

While I completely understand that this is likely an edge case, I mainly wanted to submit as a bug for two reasons:

  1. others searching for this issue (aka my future self haha)
  2. the docs mention pnpm add ..., add scripts, the pnpm run fmt as the only steps required, which to me implied that a config file wasn't necessary!

Anyway, thanks for oxfmt, I'm just starting to use it now but it seems great!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Start date

    None yet

    Target date

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions