Skip to content

Commit a13fa18

Browse files
committed
docs: add TOC to rule files; add fixer placeholder sections
1 parent ed25149 commit a13fa18

File tree

105 files changed

+2236
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2236
-579
lines changed

.README/rules/check-access.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
### `check-access`
1+
# `check-access`
2+
3+
{"gitdown": "contents", "rootId": "check-access"}
24

35
Checks that `@access` tags use one of the following values:
46

@@ -11,6 +13,8 @@ Also reports:
1113
- Use of multiple instances of `@access` (or the `@public`, etc. style tags)
1214
on the same doc block.
1315

16+
## Context and settings
17+
1418
|||
1519
|---|---|
1620
|Context|everywhere|
@@ -19,4 +23,10 @@ Also reports:
1923
|Settings||
2024
|Options||
2125

22-
<!-- assertions checkAccess -->
26+
## Failing examples
27+
28+
<!-- assertions-failing checkAccess -->
29+
30+
## Passing examples
31+
32+
<!-- assertions-passing checkAccess -->

.README/rules/check-alignment.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
### `check-alignment`
1+
# `check-alignment`
2+
3+
{"gitdown": "contents", "rootId": "check-alignment"}
24

35
Reports invalid alignment of JSDoc block asterisks.
46

7+
## Fixer
8+
9+
Fixes alignment.
10+
11+
## Context and settings
12+
513
|||
614
|---|---|
715
|Context|everywhere|
816
|Tags|N/A|
917
|Recommended|true|
1018

11-
<!-- assertions checkAlignment -->
19+
## Failing examples
20+
21+
<!-- assertions-failing checkAlignment -->
22+
23+
## Passing examples
24+
25+
<!-- assertions-passing checkAlignment -->

.README/rules/check-examples.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
### `check-examples`
1+
# `check-examples`
2+
3+
{"gitdown": "contents", "rootId": "check-examples"}
24

35
> **NOTE**: This rule currently does not work in ESLint 8 (we are waiting for
46
> [issue 14745](https://github.com/eslint/eslint/issues/14745)).
@@ -7,11 +9,11 @@ Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules. Also
79
has options to lint the default values of optional `@param`/`@arg`/`@argument`
810
and `@property`/`@prop` tags or the values of `@default`/`@defaultvalue` tags.
911

10-
#### Options
12+
## Options
1113

1214
The options below all default to no-op/`false` except as noted.
1315

14-
##### `captionRequired`
16+
### `captionRequired`
1517

1618
JSDoc specs use of an optional `<caption>` element at the beginning of
1719
`@example`.
@@ -21,7 +23,7 @@ the beginning of any `@example`.
2123

2224
Used only for `@example`.
2325

24-
##### `exampleCodeRegex` and `rejectExampleCodeRegex`
26+
### `exampleCodeRegex` and `rejectExampleCodeRegex`
2527

2628
JSDoc does not specify a formal means for delimiting code blocks within
2729
`@example` (it uses generic syntax highlighting techniques for its own
@@ -49,7 +51,7 @@ If neither is in use, all examples will be matched. Note also that even if
4951
`captionRequired` is not set, any initial `<caption>` will be stripped out
5052
before doing the regex matching.
5153

52-
##### `paddedIndent`
54+
### `paddedIndent`
5355

5456
This integer property allows one to add a fixed amount of whitespace at the
5557
beginning of the second or later lines of the example to be stripped so as
@@ -69,7 +71,7 @@ out before evaluation.
6971

7072
Only applied to `@example` linting.
7173

72-
##### `reportUnusedDisableDirectives`
74+
### `reportUnusedDisableDirectives`
7375

7476
If not set to `false`, `reportUnusedDisableDirectives` will report disabled
7577
directives which are not used (and thus not needed). Defaults to `true`.
@@ -80,7 +82,7 @@ Inline ESLint config within `@example` JavaScript is allowed (or within
8082
needed by the resolved rules will be reported as with the ESLint
8183
`--report-unused-disable-directives` command.
8284

83-
#### Options for Determining ESLint Rule Applicability (`allowInlineConfig`, `noDefaultExampleRules`, `matchingFileName`, `configFile`, `checkEslintrc`, and `baseConfig`)
85+
## Options for Determining ESLint Rule Applicability (`allowInlineConfig`, `noDefaultExampleRules`, `matchingFileName`, `configFile`, `checkEslintrc`, and `baseConfig`)
8486

8587
The following options determine which individual ESLint rules will be
8688
applied to the JavaScript found within the `@example` tags (as determined
@@ -131,7 +133,7 @@ by decreasing precedence:
131133
* `baseConfig` - Set to an object of rules with the same schema
132134
as `.eslintrc.*` for defaults.
133135

134-
##### Rules Disabled by Default Unless `noDefaultExampleRules` is Set to `true`
136+
### Rules Disabled by Default Unless `noDefaultExampleRules` is Set to `true`
135137

136138
* `eol-last` - Insisting that a newline "always" be at the end is less likely
137139
to be desired in sample code as with the code file convention.
@@ -166,17 +168,25 @@ expression-oriented rules will be used by default as well:
166168
* `no-unused-expressions` - Disabled.
167169
* `chai-friendly/no-unused-expressions` - Disabled.
168170

169-
##### Options for checking other than `@example` (`checkDefaults`, `checkParams`, or `checkProperties`)
171+
### Options for checking other than `@example` (`checkDefaults`, `checkParams`, or `checkProperties`)
170172

171173
* `checkDefaults` - Whether to check the values of `@default`/`@defaultvalue` tags
172174
* `checkParams` - Whether to check `@param`/`@arg`/`@argument` default values
173175
* `checkProperties` - Whether to check `@property`/`@prop` default values
174176

177+
## Context and settings
178+
175179
|||
176180
|---|---|
177181
|Context|everywhere|
178182
|Tags|`example`|
179183
|Recommended|false|
180184
|Options| *See above* |
181185

182-
<!-- assertions checkExamples -->
186+
## Failing examples
187+
188+
<!-- assertions-failing checkExamples -->
189+
190+
## Passing examples
191+
192+
<!-- assertions-passing checkExamples -->

.README/rules/check-indentation.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
### `check-indentation`
1+
# `check-indentation`
2+
3+
{"gitdown": "contents", "rootId": "check-indentation"}
24

35
Reports invalid padding inside JSDoc blocks.
46

@@ -16,11 +18,11 @@ the following description is not reported:
1618
*/
1719
```
1820

19-
#### Options
21+
## Options
2022

2123
This rule has an object option.
2224

23-
##### `excludeTags`
25+
### `excludeTags`
2426

2527
Array of tags (e.g., `['example', 'description']`) whose content will be
2628
"hidden" from the `check-indentation` rule. Defaults to `['example']`.
@@ -42,11 +44,19 @@ report a padding issue:
4244
*/
4345
```
4446

47+
## Context and settings
48+
4549
|||
4650
|---|---|
4751
|Context|everywhere|
4852
|Tags|N/A|
4953
|Recommended|false|
5054
|Options| `excludeTags` |
5155

52-
<!-- assertions checkIndentation -->
56+
## Failing examples
57+
58+
<!-- assertions-failing checkIndentation -->
59+
60+
## Passing examples
61+
62+
<!-- assertions-passing checkIndentation -->

.README/rules/check-line-alignment.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
### `check-line-alignment`
1+
# `check-line-alignment`
2+
3+
{"gitdown": "contents", "rootId": "check-line-alignment"}
24

35
Reports invalid alignment of JSDoc block lines. This is a
46
[standard recommended to WordPress code](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/#aligning-comments),
57
for example.
68

7-
#### Options
9+
## Fixer
10+
11+
(TODO)
12+
13+
## Options
814

915
This rule allows one optional string argument. If it is `"always"` then a
1016
problem is raised when the lines are not aligned. If it is `"never"` then
@@ -16,12 +22,12 @@ ensure that at least one space is present after the asterisk delimiter.
1622

1723
After the string, an options object is allowed with the following properties.
1824

19-
##### `tags`
25+
### `tags`
2026

2127
Use this to change the tags which are sought for alignment changes. Defaults to an array of
2228
`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return']`.
2329

24-
##### `customSpacings`
30+
### `customSpacings`
2531

2632
An object with any of the following keys set to an integer. Affects spacing:
2733

@@ -33,16 +39,18 @@ An object with any of the following keys set to an integer. Affects spacing:
3339

3440
If a spacing is not defined, it defaults to one.
3541

36-
##### `preserveMainDescriptionPostDelimiter`
42+
### `preserveMainDescriptionPostDelimiter`
3743

3844
A boolean to determine whether to preserve the post-delimiter spacing of the
3945
main description. If `false` or unset, will be set to a single space.
4046

41-
##### `wrapIndent`
47+
### `wrapIndent`
4248

4349
The indent that will be applied for tag text after the first line.
4450
Default to the empty string (no indent).
4551

52+
## Context and settings
53+
4654
|||
4755
|---|---|
4856
|Context|everywhere|
@@ -51,4 +59,10 @@ Default to the empty string (no indent).
5159
|Aliases|`arg`, `argument`, `prop`, `return`|
5260
|Recommended|false|
5361

54-
<!-- assertions checkLineAlignment -->
62+
## Failing examples
63+
64+
<!-- assertions-failing checkLineAlignment -->
65+
66+
## Passing examples
67+
68+
<!-- assertions-passing checkLineAlignment -->

.README/rules/check-param-names.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
### `check-param-names`
1+
# `check-param-names`
2+
3+
{"gitdown": "contents", "rootId": "check-param-names"}
24

35
Ensures that parameter names in JSDoc are matched by corresponding items in
46
the function declaration.
57

6-
#### Destructuring
8+
## Fixer
9+
10+
(Todo)
11+
12+
## Destructuring
713

814
Note that by default the rule will not report parameters present on the docs
915
but non-existing on the function signature when an object rest property is part
@@ -28,17 +34,17 @@ other properties, so in looking at the docs alone without looking at the
2834
function signature, the disadvantage of enabling this option is that it
2935
may appear that there is an actual property named `extra`.
3036

31-
#### Options
37+
## Options
3238

33-
##### `checkRestProperty`
39+
### `checkRestProperty`
3440

3541
See the "Destructuring" section. Defaults to `false`.
3642

37-
##### `checkTypesPattern`
43+
### `checkTypesPattern`
3844

3945
See `require-param` under the option of the same name.
4046

41-
##### `enableFixer`
47+
### `enableFixer`
4248

4349
Set to `true` to auto-remove `@param` duplicates (based on identical
4450
names).
@@ -47,25 +53,25 @@ Note that this option will remove duplicates of the same name even if
4753
the definitions do not match in other ways (e.g., the second param will
4854
be removed even if it has a different type or description).
4955

50-
##### `allowExtraTrailingParamDocs`
56+
### `allowExtraTrailingParamDocs`
5157

5258
If set to `true`, this option will allow extra `@param` definitions (e.g.,
5359
representing future expected or virtual params) to be present without needing
5460
their presence within the function signature. Other inconsistencies between
5561
`@param`'s and present function parameters will still be reported.
5662

57-
##### `checkDestructured`
63+
### `checkDestructured`
5864

5965
Whether to check destructured properties. Defaults to `true`.
6066

61-
##### `useDefaultObjectProperties`
67+
### `useDefaultObjectProperties`
6268

6369
Set to `true` if you wish to avoid reporting of child property documentation
6470
where instead of destructuring, a whole plain object is supplied as default
6571
value but you wish its keys to be considered as signalling that the properties
6672
are present and can therefore be documented. Defaults to `false`.
6773

68-
##### `disableExtraPropertyReporting`
74+
### `disableExtraPropertyReporting`
6975

7076
Whether to check for extra destructured properties. Defaults to `false`. Change
7177
to `true` if you want to be able to document properties which are not actually
@@ -75,11 +81,20 @@ item at the same level is destructured as destructuring will prevent other
7581
access and this option is only intended to permit documenting extra properties
7682
that are available and actually used in the function.
7783

84+
## Context and settings
85+
7886
|||
7987
|---|---|
8088
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
8189
|Options|`allowExtraTrailingParamDocs`, `checkDestructured`, `checkRestProperty`, `checkTypesPattern`, `useDefaultObjectProperties`, `disableExtraPropertyReporting`|
8290
|Tags|`param`|
8391
|Aliases|`arg`, `argument`|
8492
|Recommended|true|
85-
<!-- assertions checkParamNames -->
93+
94+
## Failing examples
95+
96+
<!-- assertions-failing checkParamNames -->
97+
98+
## Passing examples
99+
100+
<!-- assertions-passing checkParamNames -->

.README/rules/check-property-names.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
### `check-property-names`
1+
# `check-property-names`
2+
3+
{"gitdown": "contents", "rootId": "check-property-names"}
24

35
Ensures that property names in JSDoc are not duplicated on the same block
46
and that nested properties have defined roots.
57

6-
#### Options
8+
## Fixer
9+
10+
(Todo)
711

8-
##### `enableFixer`
12+
## Options
13+
14+
### `enableFixer`
915

1016
Set to `true` to auto-remove `@property` duplicates (based on
1117
identical names).
@@ -14,6 +20,8 @@ Note that this option will remove duplicates of the same name even if
1420
the definitions do not match in other ways (e.g., the second property will
1521
be removed even if it has a different type or description).
1622

23+
## Context and settings
24+
1725
|||
1826
|---|---|
1927
|Context|Everywhere|
@@ -22,4 +30,10 @@ be removed even if it has a different type or description).
2230
|Aliases|`prop`|
2331
|Recommended|true|
2432

25-
<!-- assertions checkPropertyNames -->
33+
## Failing examples
34+
35+
<!-- assertions-failing checkPropertyNames -->
36+
37+
## Passing examples
38+
39+
<!-- assertions-passing checkPropertyNames -->

0 commit comments

Comments
 (0)