diff --git a/.vitepress/config/en.ts b/.vitepress/config/en.ts index faf4cbcafbb..0d99f0e4593 100644 --- a/.vitepress/config/en.ts +++ b/.vitepress/config/en.ts @@ -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", @@ -120,7 +135,6 @@ export const enConfig = defineLocaleConfig("root", { }, ], }, - { text: "Formatter", link: "/docs/guide/usage/formatter" }, { text: "Minifier", link: "/docs/guide/usage/minifier", diff --git a/src/docs/guide/usage/formatter.md b/src/docs/guide/usage/formatter.md index 93a13f1cc35..f51f0b5a78e 100644 --- a/src/docs/guide/usage/formatter.md +++ b/src/docs/guide/usage/formatter.md @@ -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. diff --git a/src/docs/guide/usage/formatter/cli.md b/src/docs/guide/usage/formatter/cli.md new file mode 100644 index 00000000000..b896f754050 --- /dev/null +++ b/src/docs/guide/usage/formatter/cli.md @@ -0,0 +1,9 @@ +--- +outline: [2, 3] +editLink: false +--- + +# Command-line Interface + + + diff --git a/src/docs/guide/usage/formatter/config-file-reference.md b/src/docs/guide/usage/formatter/config-file-reference.md new file mode 100644 index 00000000000..91774b343de --- /dev/null +++ b/src/docs/guide/usage/formatter/config-file-reference.md @@ -0,0 +1,7 @@ +--- +outline: [2, 3] +editLink: false +--- + + + diff --git a/src/docs/guide/usage/formatter/generated-cli.md b/src/docs/guide/usage/formatter/generated-cli.md new file mode 100644 index 00000000000..36a828ca922 --- /dev/null +++ b/src/docs/guide/usage/formatter/generated-cli.md @@ -0,0 +1,47 @@ +--- +search: false +--- + +## Usage + +**`oxfmt`** \[**`-c`**=_`PATH`_\] \[_`PATH`_\]... + +## Output Options + +- **`--check`** — + Check mode - check if files are formatted, also show statistics +- **`--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 + +- **`--lsp`** — + Start language server protocol (LSP) server +- **`--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 diff --git a/src/docs/guide/usage/formatter/generated-config.md b/src/docs/guide/usage/formatter/generated-config.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/docs/guide/usage/linter/config-file-reference.md b/src/docs/guide/usage/linter/config-file-reference.md index 4c68269bf52..748aa215c1b 100644 --- a/src/docs/guide/usage/linter/config-file-reference.md +++ b/src/docs/guide/usage/linter/config-file-reference.md @@ -3,5 +3,5 @@ outline: [2, 3] editLink: false --- - +