Skip to content

Commit 0a161bb

Browse files
committed
auto generate formatter cli and configs
1 parent 91d0122 commit 0a161bb

File tree

7 files changed

+79
-34
lines changed

7 files changed

+79
-34
lines changed

.vitepress/config/en.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ export const enConfig = defineLocaleConfig("root", {
8888
},
8989
],
9090
},
91+
{
92+
text: "Formatter",
93+
link: "/docs/guide/usage/formatter",
94+
collapsed: true,
95+
items: [
96+
{
97+
text: "CLI reference",
98+
link: "/docs/guide/usage/formatter/cli",
99+
},
100+
// {
101+
// text: "Configuration file reference",
102+
// link: "/docs/guide/usage/formatter/config-file-reference",
103+
// },
104+
],
105+
},
91106
{ text: "Parser", link: "/docs/guide/usage/parser" },
92107
{
93108
text: "Transformer",
@@ -120,7 +135,6 @@ export const enConfig = defineLocaleConfig("root", {
120135
},
121136
],
122137
},
123-
{ text: "Formatter", link: "/docs/guide/usage/formatter" },
124138
{
125139
text: "Minifier",
126140
link: "/docs/guide/usage/minifier",

src/docs/guide/usage/formatter.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -63,38 +63,6 @@ $ bun add -D oxfmt
6363

6464
:::
6565

66-
## Command-line Interface
67-
68-
```
69-
Usage: [--check | --list-different] [-c=PATH] [--ignore-path=PATH]... [PATH]...
70-
71-
Output Options
72-
--check Check mode - check if files are formatted
73-
--list-different List mode - list files that would be changed
74-
75-
Basic Options
76-
-c, --config=PATH Path to the configuration file
77-
78-
Ignore Options
79-
--ignore-path=PATH Path to ignore file(s). Can be specified multiple times. If not
80-
specified, .gitignore and .prettierignore in the current directory are
81-
used.
82-
--with-node-modules Format code in node_modules directory (skipped by default)
83-
84-
Miscellaneous
85-
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
86-
--threads=INT Number of threads to use. Set to 1 for using only 1 CPU core
87-
88-
Available positional items:
89-
PATH Single file, single path or list of paths. If not provided, current
90-
working directory is used. Glob is supported only for exclude patterns
91-
like `'!**/fixtures/*.js'.
92-
93-
Available options:
94-
-h, --help Prints help information
95-
-V, --version Prints version information
96-
```
97-
9866
Oxfmt works like `prettier --write .` by default.
9967

10068
Format options are not supported by CLI, use configuration file instead. This will help you use CLI and editor extension with the same settings.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
outline: [2, 3]
3+
editLink: false
4+
---
5+
6+
# Command-line Interface
7+
8+
<!-- in oxc: `cargo run -p website linter-cli > /path/to/generated-cli.md` -->
9+
<!--@include: ./generated-cli.md-->
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
outline: [2, 3]
3+
editLink: false
4+
---
5+
6+
<!-- in oxc: `cargo run -p website formatter-schema-markdown > /path/to/formatter/generated-config.md` -->
7+
<!--@include: ./generated-config.md-->
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
search: false
3+
---
4+
5+
## Usage
6+
7+
**`oxfmt`** \[**`-c`**=_`PATH`_\] \[_`PATH`_\]...
8+
9+
## Output Options
10+
11+
- **`--check`** &mdash;
12+
Check mode - check if files are formatted, also show statistics
13+
- **`--list-different`** &mdash;
14+
List mode - list files that would be changed
15+
16+
## Basic Options
17+
18+
- **`-c`**, **`--config`**=_`PATH`_ &mdash;
19+
Path to the configuration file
20+
21+
## Ignore Options
22+
23+
- **`--ignore-path`**=_`PATH`_ &mdash;
24+
Path to ignore file(s). Can be specified multiple times. If not specified, .gitignore and .prettierignore in the current directory are used.
25+
- **`--with-node-modules`** &mdash;
26+
Format code in node_modules directory (skipped by default)
27+
28+
## Miscellaneous
29+
30+
- **`--lsp`** &mdash;
31+
Start language server protocol (LSP) server
32+
- **`--no-error-on-unmatched-pattern`** &mdash;
33+
Do not exit with error when pattern is unmatched
34+
- **`--threads`**=_`INT`_ &mdash;
35+
Number of threads to use. Set to 1 for using only 1 CPU core.
36+
37+
## Available positional items:
38+
39+
- _`PATH`_ &mdash;
40+
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'`.
41+
42+
## Available options:
43+
44+
- **`-h`**, **`--help`** &mdash;
45+
Prints help information
46+
- **`-V`**, **`--version`** &mdash;
47+
Prints version information

src/docs/guide/usage/formatter/generated-config.md

Whitespace-only changes.

src/docs/guide/usage/linter/config-file-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ outline: [2, 3]
33
editLink: false
44
---
55

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

0 commit comments

Comments
 (0)