Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ export const enConfig = defineLocaleConfig("root", {
},
],
},
{
text: "Formatter",
link: "/docs/guide/usage/formatter",
collapsed: true,
items: [
{
text: "CLI reference",
link: "/docs/guide/usage/formatter/cli",
},
// {
// text: "Configuration file reference",
// link: "/docs/guide/usage/formatter/config-file-reference",
// },
],
},
{ text: "Parser", link: "/docs/guide/usage/parser" },
{
text: "Transformer",
Expand Down Expand Up @@ -120,7 +135,6 @@ export const enConfig = defineLocaleConfig("root", {
},
],
},
{ text: "Formatter", link: "/docs/guide/usage/formatter" },
{
text: "Minifier",
link: "/docs/guide/usage/minifier",
Expand Down
32 changes: 0 additions & 32 deletions src/docs/guide/usage/formatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,6 @@ $ bun add -D oxfmt

:::

## Command-line Interface

```
Usage: [--check | --list-different] [-c=PATH] [--ignore-path=PATH]... [PATH]...

Output Options
--check Check mode - check if files are formatted
--list-different List mode - list files that would be changed

Basic Options
-c, --config=PATH Path to the configuration file

Ignore Options
--ignore-path=PATH Path to ignore file(s). Can be specified multiple times. If not
specified, .gitignore and .prettierignore in the current directory are
used.
--with-node-modules Format code in node_modules directory (skipped by default)

Miscellaneous
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
--threads=INT Number of threads to use. Set to 1 for using only 1 CPU core

Available positional items:
PATH Single file, single path or list of paths. If not provided, current
working directory is used. Glob is supported only for exclude patterns
like `'!**/fixtures/*.js'.

Available options:
-h, --help Prints help information
-V, --version Prints version information
```

Oxfmt works like `prettier --write .` by default.

Format options are not supported by CLI, use configuration file instead. This will help you use CLI and editor extension with the same settings.
Expand Down
9 changes: 9 additions & 0 deletions src/docs/guide/usage/formatter/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
outline: [2, 3]
editLink: false
---

# Command-line Interface

<!-- in oxc: `cargo run -p website linter-cli > /path/to/generated-cli.md` -->
<!--@include: ./generated-cli.md-->
7 changes: 7 additions & 0 deletions src/docs/guide/usage/formatter/config-file-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
outline: [2, 3]
editLink: false
---

<!-- in oxc: `cargo run -p website formatter-schema-markdown > /path/to/formatter/generated-config.md` -->
<!--@include: ./generated-config.md-->
47 changes: 47 additions & 0 deletions src/docs/guide/usage/formatter/generated-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
search: false
---

## Usage

**`oxfmt`** \[**`-c`**=_`PATH`_\] \[_`PATH`_\]...

## Output Options

- **`--check`** &mdash;
Check mode - check if files are formatted, also show statistics
- **`--list-different`** &mdash;
List mode - list files that would be changed

## Basic Options

- **`-c`**, **`--config`**=_`PATH`_ &mdash;
Path to the configuration file

## Ignore Options

- **`--ignore-path`**=_`PATH`_ &mdash;
Path to ignore file(s). Can be specified multiple times. If not specified, .gitignore and .prettierignore in the current directory are used.
- **`--with-node-modules`** &mdash;
Format code in node_modules directory (skipped by default)

## Miscellaneous

- **`--lsp`** &mdash;
Start language server protocol (LSP) server
- **`--no-error-on-unmatched-pattern`** &mdash;
Do not exit with error when pattern is unmatched
- **`--threads`**=_`INT`_ &mdash;
Number of threads to use. Set to 1 for using only 1 CPU core.

## Available positional items:

- _`PATH`_ &mdash;
Single file, single path or list of paths. If not provided, current working directory is used. Glob is supported only for exclude patterns like `'!**/fixtures/*.js'`.

## Available options:

- **`-h`**, **`--help`** &mdash;
Prints help information
- **`-V`**, **`--version`** &mdash;
Prints version information
Empty file.
2 changes: 1 addition & 1 deletion src/docs/guide/usage/linter/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ outline: [2, 3]
editLink: false
---

<!-- in oxc: `cargo run -p website linter-schema-markdown > /path/to/generated-config.md` -->
<!-- in oxc: `cargo run -p website linter-schema-markdown > /path/to/linter/config-file-reference.md` -->
<!--@include: ./generated-config.md-->