Description
When oxfmt is run with target paths or glob patterns, but a .prettierignore (or .gitignore) rule excludes all matched files, the error message is:
Expected at least one target file
This message implies that no files were found matching the given paths/globs, when in reality files do exist and match — they are just being excluded by an ignore rule. This makes the root cause extremely difficult to diagnose, especially when .prettierignore was set up for a previous Prettier-based workflow and the user is unaware that oxfmt reads it by default.
Reproduction
- Create a project with some
.md files
- Add a
.prettierignore with the following rules:
- Run:
- Observe:
Expected at least one target file
The same happens with npx oxfmt . or even npx oxfmt README.md — any invocation where files exist but are fully excluded by the ignore file. Note that .md files are excluded by the /**/*.* rule and are not re-included by the !*.svg negation, so all targets end up excluded.
Expected behavior
The error message should indicate why no files were processed. For example:
No files to format. All matched files were excluded by ignore rules.
Ignore sources: .prettierignore, .gitignore
Hint: Use --ignore-path to override the default ignore files, or --no-error-on-unmatched-pattern to suppress this error.
Or at minimum:
Expected at least one target file (all candidates were excluded by .prettierignore)
This would immediately point the user toward the root cause.
Context
This is a common scenario when migrating from Prettier to Biome + oxfmt. Projects that used Biome for JS/TS formatting often have a .prettierignore like:
This is intended to prevent Prettier from running on most files while still allowing SVGs to be formatted. When oxfmt is later added to format non-JS files (Markdown, YAML, CSS), the leftover .prettierignore silently blocks everything that isn't an SVG, with no hint in the error output.
The --ignore-path flag is the correct workaround, but discovering it requires significant debugging since the error message gives no hint about ignore files being involved.
Environment
- oxfmt version: 0.41.0
- OS: Linux (x64)
- Node.js: v25
Description
When oxfmt is run with target paths or glob patterns, but a
.prettierignore(or.gitignore) rule excludes all matched files, the error message is:This message implies that no files were found matching the given paths/globs, when in reality files do exist and match — they are just being excluded by an ignore rule. This makes the root cause extremely difficult to diagnose, especially when
.prettierignorewas set up for a previous Prettier-based workflow and the user is unaware that oxfmt reads it by default.Reproduction
.mdfiles.prettierignorewith the following rules:npx oxfmt '**/*.md'The same happens with
npx oxfmt .or evennpx oxfmt README.md— any invocation where files exist but are fully excluded by the ignore file. Note that.mdfiles are excluded by the/**/*.*rule and are not re-included by the!*.svgnegation, so all targets end up excluded.Expected behavior
The error message should indicate why no files were processed. For example:
Or at minimum:
This would immediately point the user toward the root cause.
Context
This is a common scenario when migrating from Prettier to Biome + oxfmt. Projects that used Biome for JS/TS formatting often have a
.prettierignorelike:This is intended to prevent Prettier from running on most files while still allowing SVGs to be formatted. When oxfmt is later added to format non-JS files (Markdown, YAML, CSS), the leftover
.prettierignoresilently blocks everything that isn't an SVG, with no hint in the error output.The
--ignore-pathflag is the correct workaround, but discovering it requires significant debugging since the error message gives no hint about ignore files being involved.Environment