Skip to content

Commit e5236a2

Browse files
committed
feat: add a global option for checking constructors, getters or setters and remove avoidExampleOnConstructors option.
BREAKING CHANGE: Replaces the option `avoidExampleOnConstructors` for the `require-example` rule by `checkConstructors` Also makes build-call platform independent and ensures env-variables work an all platforms.
1 parent 5c8ef9f commit e5236a2

14 files changed

+909
-86
lines changed

.README/rules/require-description.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ An options object may have any of the following properties:
2424
- `descriptionStyle` - Whether to accept implicit descriptions (`"body"`) or
2525
`@description` tags (`"tag"`) as satisfying the rule. Set to `"any"` to
2626
accept either style. Defaults to `"body"`.
27+
- `checkConstructors` - A value indicating whether `constructor`s should be checked. Defaults to `true`.
28+
- `checkGetters` - A value indicating whether getters should be checked. Defaults to `true`.
29+
- `checkSetters` - A value indicating whether getters should be checked. Defaults to `true`.
2730

28-
|||
29-
|---|---|
30-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
31-
|Tags|`description` or jsdoc block|
32-
|Aliases|`desc`|
33-
|Options|`contexts`, `exemptedBy`, `descriptionStyle`|
34-
|Settings|`overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs`|
31+
| | |
32+
| -------- | ------------------------------------------------------------------------------------------------------------- |
33+
| Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
34+
| Tags | `description` or jsdoc block |
35+
| Aliases | `desc` |
36+
| Options | `contexts`, `exemptedBy`, `descriptionStyle`, `checkConstructors`, `checkGetters`, `checkSetters` |
37+
| Settings | `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
3538

3639
<!-- assertions requireDescription -->

.README/rules/require-example.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,25 @@ block avoids the need for an `@example`. Defaults to an array with
1717
so be sure to add back `inheritdoc` if you wish its presence to cause
1818
exemption of the rule.
1919

20-
##### `avoidExampleOnConstructors`
21-
22-
Set to `true` to avoid the need for an example on a constructor (whether
23-
indicated as such by a jsdoc tag or by being within an ES6 `class`).
24-
Defaults to `false`.
25-
2620
##### `contexts`
2721

2822
Set this to an array of strings representing the AST context
2923
where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
3024
Overrides the default contexts (see below). Set to `"any"` if you want
3125
the rule to apply to any jsdoc block throughout your files.
3226

27+
##### `checkConstructors`
28+
29+
A value indicating whether `constructor`s should be checked. Defaults to `true`.
30+
31+
##### `checkGetters`
32+
33+
A value indicating whether getters should be checked. Defaults to `false`.
34+
35+
##### `checkSetters`
36+
37+
A value indicating whether getters should be checked. Defaults to `false`.
38+
3339
#### Fixer
3440

3541
The fixer for `require-example` will add an empty `@example`, but it will still

.README/rules/require-param.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,24 @@ contexts (see below). May be useful for adding such as
2222
`TSMethodSignature` in TypeScript or restricting the contexts
2323
which are checked.
2424

25-
|||
26-
|---|---|
27-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
28-
|Tags|`param`|
29-
|Aliases|`arg`, `argument`|
30-
|Options|`contexts`, `exemptedBy`|
31-
|Settings|`overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs`|
25+
##### `checkConstructors`
26+
27+
A value indicating whether `constructor`s should be checked. Defaults to `true`.
28+
29+
##### `checkGetters`
30+
31+
A value indicating whether getters should be checked. Defaults to `false`.
32+
33+
##### `checkSetters`
34+
35+
A value indicating whether getters should be checked. Defaults to `false`.
36+
37+
| | |
38+
| -------- | ------------------------------------------------------------------------------------------------------------- |
39+
| Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
40+
| Tags | `param` |
41+
| Aliases | `arg`, `argument` |
42+
| Options | `contexts`, `exemptedBy`, `checkConstructors`, `checkGetters`, `checkSetters` |
43+
| Settings | `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
3244

3345
<!-- assertions requireParam -->

.README/rules/require-returns.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Will also report if multiple `@returns` tags are present.
66

77
#### Options
88

9+
- `checkConstructors` - A value indicating whether `constructor`s should
10+
be checked for `@returns` tags. Defaults to `false`.
911
- `checkGetters` - Boolean to determine whether getter methods should
1012
be checked for `@returns` tags. Defaults to `true`.
1113
- `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the document
@@ -40,12 +42,12 @@ Will also report if multiple `@returns` tags are present.
4042
'jsdoc/require-returns': ['error', {forceReturnsWithAsync: true}]
4143
```
4244

43-
|||
44-
|---|---|
45-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
46-
|Tags|`returns`|
47-
|Aliases|`return`|
48-
|Options|`checkGetters`, `contexts`, `exemptedBy`, `forceRequireReturn`, `forceReturnsWithAsync`|
49-
|Settings|`overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs`|
45+
| | |
46+
| -------- | ------------------------------------------------------------------------------------------------------------- |
47+
| Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
48+
| Tags | `returns` |
49+
| Aliases | `return` |
50+
| Options | `checkConstructors`, `checkGetters`, `contexts`, `exemptedBy`, `forceRequireReturn`, `forceReturnsWithAsync` |
51+
| Settings | `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
5052

5153
<!-- assertions requireReturns -->

0 commit comments

Comments
 (0)