Commit 0b18005
committed
docs(linter): Add config docs generation for rules with Regex arguments (#15978)
~~Draft until we merge oxc-project/schemars#9 and upgrade the oxc-schemars crate in this repo afterwards. Once we have the schemars crate bumped up to 0.8.27 we can safely rebase this branch and this'll be ready to merge.~~
But I can confirm that this now works with my patch to schemars :D
Part of #14743.
Generated docs:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### ignore
type: `string[]`
A list of patterns to ignore when checking `catch` variable names. The pattern
can be a string or regular expression.
### name
type: `string`
default: `"error"`
The name to use for error variables in `catch` blocks. You can customize it
to something other than `'error'` (e.g., `'exception'`).
```
Unfortunately it doesn't recognize the default value in this case, although I'm not 100% sure why. But at the very least, this works and allows us to finish the docs for most of the remaining lint rules.
```md
## Configuration
This rule accepts a configuration object with the following properties:
### rejectPattern
type: `[
string,
null
]`
Regex pattern used to validate the `reject` parameter name. If provided, this pattern
is used instead of the default `^_?reject$` check.
### resolvePattern
type: `[
string,
null
]`
Regex pattern used to validate the `resolve` parameter name. If provided, this pattern
is used instead of the default `^_?resolve$` check.
```1 parent 80fe39d commit 0b18005
File tree
5 files changed
+19
-43
lines changed- crates/oxc_linter
- src/rules
- promise
- unicorn
- tests
5 files changed
+19
-43
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | 91 | | |
122 | 92 | | |
123 | 93 | | |
124 | | - | |
| 94 | + | |
| 95 | + | |
125 | 96 | | |
126 | 97 | | |
127 | 98 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
58 | | - | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
0 commit comments