eslint-plugin-jsdoc 46.4.6 → 46.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +31 -0
  2. package/dist/index.js +21 -10
  3. package/dist/index.js.map +1 -1
  4. package/package.json +14 -12
  5. package/dist/WarnSettings.d.ts +0 -17
  6. package/dist/WarnSettings.d.ts.map +0 -1
  7. package/dist/alignTransform.d.ts +0 -32
  8. package/dist/alignTransform.d.ts.map +0 -1
  9. package/dist/defaultTagOrder.d.ts +0 -5
  10. package/dist/defaultTagOrder.d.ts.map +0 -1
  11. package/dist/exportParser.d.ts +0 -41
  12. package/dist/exportParser.d.ts.map +0 -1
  13. package/dist/getDefaultTagStructureForMode.d.ts +0 -11
  14. package/dist/getDefaultTagStructureForMode.d.ts.map +0 -1
  15. package/dist/index.d.ts +0 -10
  16. package/dist/index.d.ts.map +0 -1
  17. package/dist/iterateJsdoc.d.ts +0 -460
  18. package/dist/iterateJsdoc.d.ts.map +0 -1
  19. package/dist/jsdocUtils.d.ts +0 -421
  20. package/dist/jsdocUtils.d.ts.map +0 -1
  21. package/dist/rules/checkAccess.d.ts +0 -3
  22. package/dist/rules/checkAccess.d.ts.map +0 -1
  23. package/dist/rules/checkAlignment.d.ts +0 -3
  24. package/dist/rules/checkAlignment.d.ts.map +0 -1
  25. package/dist/rules/checkExamples.d.ts +0 -4
  26. package/dist/rules/checkExamples.d.ts.map +0 -1
  27. package/dist/rules/checkIndentation.d.ts +0 -3
  28. package/dist/rules/checkIndentation.d.ts.map +0 -1
  29. package/dist/rules/checkLineAlignment.d.ts +0 -10
  30. package/dist/rules/checkLineAlignment.d.ts.map +0 -1
  31. package/dist/rules/checkParamNames.d.ts +0 -3
  32. package/dist/rules/checkParamNames.d.ts.map +0 -1
  33. package/dist/rules/checkPropertyNames.d.ts +0 -3
  34. package/dist/rules/checkPropertyNames.d.ts.map +0 -1
  35. package/dist/rules/checkSyntax.d.ts +0 -3
  36. package/dist/rules/checkSyntax.d.ts.map +0 -1
  37. package/dist/rules/checkTagNames.d.ts +0 -3
  38. package/dist/rules/checkTagNames.d.ts.map +0 -1
  39. package/dist/rules/checkTypes.d.ts +0 -3
  40. package/dist/rules/checkTypes.d.ts.map +0 -1
  41. package/dist/rules/checkValues.d.ts +0 -3
  42. package/dist/rules/checkValues.d.ts.map +0 -1
  43. package/dist/rules/emptyTags.d.ts +0 -3
  44. package/dist/rules/emptyTags.d.ts.map +0 -1
  45. package/dist/rules/implementsOnClasses.d.ts +0 -3
  46. package/dist/rules/implementsOnClasses.d.ts.map +0 -1
  47. package/dist/rules/importsAsDependencies.d.ts +0 -3
  48. package/dist/rules/importsAsDependencies.d.ts.map +0 -1
  49. package/dist/rules/informativeDocs.d.ts +0 -3
  50. package/dist/rules/informativeDocs.d.ts.map +0 -1
  51. package/dist/rules/matchDescription.d.ts +0 -3
  52. package/dist/rules/matchDescription.d.ts.map +0 -1
  53. package/dist/rules/matchName.d.ts +0 -3
  54. package/dist/rules/matchName.d.ts.map +0 -1
  55. package/dist/rules/multilineBlocks.d.ts +0 -3
  56. package/dist/rules/multilineBlocks.d.ts.map +0 -1
  57. package/dist/rules/noBadBlocks.d.ts +0 -3
  58. package/dist/rules/noBadBlocks.d.ts.map +0 -1
  59. package/dist/rules/noBlankBlockDescriptions.d.ts +0 -3
  60. package/dist/rules/noBlankBlockDescriptions.d.ts.map +0 -1
  61. package/dist/rules/noBlankBlocks.d.ts +0 -3
  62. package/dist/rules/noBlankBlocks.d.ts.map +0 -1
  63. package/dist/rules/noDefaults.d.ts +0 -3
  64. package/dist/rules/noDefaults.d.ts.map +0 -1
  65. package/dist/rules/noMissingSyntax.d.ts +0 -10
  66. package/dist/rules/noMissingSyntax.d.ts.map +0 -1
  67. package/dist/rules/noMultiAsterisks.d.ts +0 -3
  68. package/dist/rules/noMultiAsterisks.d.ts.map +0 -1
  69. package/dist/rules/noRestrictedSyntax.d.ts +0 -3
  70. package/dist/rules/noRestrictedSyntax.d.ts.map +0 -1
  71. package/dist/rules/noTypes.d.ts +0 -3
  72. package/dist/rules/noTypes.d.ts.map +0 -1
  73. package/dist/rules/noUndefinedTypes.d.ts +0 -3
  74. package/dist/rules/noUndefinedTypes.d.ts.map +0 -1
  75. package/dist/rules/requireAsteriskPrefix.d.ts +0 -3
  76. package/dist/rules/requireAsteriskPrefix.d.ts.map +0 -1
  77. package/dist/rules/requireDescription.d.ts +0 -3
  78. package/dist/rules/requireDescription.d.ts.map +0 -1
  79. package/dist/rules/requireDescriptionCompleteSentence.d.ts +0 -3
  80. package/dist/rules/requireDescriptionCompleteSentence.d.ts.map +0 -1
  81. package/dist/rules/requireExample.d.ts +0 -3
  82. package/dist/rules/requireExample.d.ts.map +0 -1
  83. package/dist/rules/requireFileOverview.d.ts +0 -3
  84. package/dist/rules/requireFileOverview.d.ts.map +0 -1
  85. package/dist/rules/requireHyphenBeforeParamDescription.d.ts +0 -3
  86. package/dist/rules/requireHyphenBeforeParamDescription.d.ts.map +0 -1
  87. package/dist/rules/requireJsdoc.d.ts +0 -9
  88. package/dist/rules/requireJsdoc.d.ts.map +0 -1
  89. package/dist/rules/requireParam.d.ts +0 -4
  90. package/dist/rules/requireParam.d.ts.map +0 -1
  91. package/dist/rules/requireParamDescription.d.ts +0 -3
  92. package/dist/rules/requireParamDescription.d.ts.map +0 -1
  93. package/dist/rules/requireParamName.d.ts +0 -3
  94. package/dist/rules/requireParamName.d.ts.map +0 -1
  95. package/dist/rules/requireParamType.d.ts +0 -3
  96. package/dist/rules/requireParamType.d.ts.map +0 -1
  97. package/dist/rules/requireProperty.d.ts +0 -3
  98. package/dist/rules/requireProperty.d.ts.map +0 -1
  99. package/dist/rules/requirePropertyDescription.d.ts +0 -3
  100. package/dist/rules/requirePropertyDescription.d.ts.map +0 -1
  101. package/dist/rules/requirePropertyName.d.ts +0 -3
  102. package/dist/rules/requirePropertyName.d.ts.map +0 -1
  103. package/dist/rules/requirePropertyType.d.ts +0 -3
  104. package/dist/rules/requirePropertyType.d.ts.map +0 -1
  105. package/dist/rules/requireReturns.d.ts +0 -3
  106. package/dist/rules/requireReturns.d.ts.map +0 -1
  107. package/dist/rules/requireReturnsCheck.d.ts +0 -3
  108. package/dist/rules/requireReturnsCheck.d.ts.map +0 -1
  109. package/dist/rules/requireReturnsDescription.d.ts +0 -3
  110. package/dist/rules/requireReturnsDescription.d.ts.map +0 -1
  111. package/dist/rules/requireReturnsType.d.ts +0 -3
  112. package/dist/rules/requireReturnsType.d.ts.map +0 -1
  113. package/dist/rules/requireThrows.d.ts +0 -3
  114. package/dist/rules/requireThrows.d.ts.map +0 -1
  115. package/dist/rules/requireYields.d.ts +0 -3
  116. package/dist/rules/requireYields.d.ts.map +0 -1
  117. package/dist/rules/requireYieldsCheck.d.ts +0 -3
  118. package/dist/rules/requireYieldsCheck.d.ts.map +0 -1
  119. package/dist/rules/sortTags.d.ts +0 -3
  120. package/dist/rules/sortTags.d.ts.map +0 -1
  121. package/dist/rules/tagLines.d.ts +0 -3
  122. package/dist/rules/tagLines.d.ts.map +0 -1
  123. package/dist/rules/textEscaping.d.ts +0 -3
  124. package/dist/rules/textEscaping.d.ts.map +0 -1
  125. package/dist/rules/validTypes.d.ts +0 -3
  126. package/dist/rules/validTypes.d.ts.map +0 -1
  127. package/dist/tagNames.d.ts +0 -16
  128. package/dist/tagNames.d.ts.map +0 -1
  129. package/dist/utils/hasReturnValue.d.ts +0 -20
  130. package/dist/utils/hasReturnValue.d.ts.map +0 -1
  131. package/docs/advanced.md +0 -102
  132. package/docs/rules/check-access.md +0 -193
  133. package/docs/rules/check-alignment.md +0 -169
  134. package/docs/rules/check-examples.md +0 -784
  135. package/docs/rules/check-indentation.md +0 -296
  136. package/docs/rules/check-line-alignment.md +0 -1002
  137. package/docs/rules/check-param-names.md +0 -1035
  138. package/docs/rules/check-property-names.md +0 -244
  139. package/docs/rules/check-syntax.md +0 -80
  140. package/docs/rules/check-tag-names.md +0 -1132
  141. package/docs/rules/check-types.md +0 -1198
  142. package/docs/rules/check-values.md +0 -409
  143. package/docs/rules/empty-tags.md +0 -220
  144. package/docs/rules/implements-on-classes.md +0 -219
  145. package/docs/rules/imports-as-dependencies.md +0 -99
  146. package/docs/rules/informative-docs.md +0 -400
  147. package/docs/rules/match-description.md +0 -1008
  148. package/docs/rules/match-name.md +0 -249
  149. package/docs/rules/multiline-blocks.md +0 -398
  150. package/docs/rules/no-bad-blocks.md +0 -174
  151. package/docs/rules/no-blank-block-descriptions.md +0 -91
  152. package/docs/rules/no-blank-blocks.md +0 -98
  153. package/docs/rules/no-defaults.md +0 -207
  154. package/docs/rules/no-missing-syntax.md +0 -275
  155. package/docs/rules/no-multi-asterisks.md +0 -278
  156. package/docs/rules/no-restricted-syntax.md +0 -383
  157. package/docs/rules/no-types.md +0 -168
  158. package/docs/rules/no-undefined-types.md +0 -789
  159. package/docs/rules/require-asterisk-prefix.md +0 -297
  160. package/docs/rules/require-description-complete-sentence.md +0 -820
  161. package/docs/rules/require-description.md +0 -585
  162. package/docs/rules/require-example.md +0 -390
  163. package/docs/rules/require-file-overview.md +0 -324
  164. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  165. package/docs/rules/require-jsdoc.md +0 -1857
  166. package/docs/rules/require-param-description.md +0 -238
  167. package/docs/rules/require-param-name.md +0 -163
  168. package/docs/rules/require-param-type.md +0 -227
  169. package/docs/rules/require-param.md +0 -1820
  170. package/docs/rules/require-property-description.md +0 -88
  171. package/docs/rules/require-property-name.md +0 -79
  172. package/docs/rules/require-property-type.md +0 -79
  173. package/docs/rules/require-property.md +0 -128
  174. package/docs/rules/require-returns-check.md +0 -1053
  175. package/docs/rules/require-returns-description.md +0 -181
  176. package/docs/rules/require-returns-type.md +0 -144
  177. package/docs/rules/require-returns.md +0 -1191
  178. package/docs/rules/require-throws.md +0 -326
  179. package/docs/rules/require-yields-check.md +0 -544
  180. package/docs/rules/require-yields.md +0 -823
  181. package/docs/rules/sort-tags.md +0 -635
  182. package/docs/rules/tag-lines.md +0 -551
  183. package/docs/rules/text-escaping.md +0 -177
  184. package/docs/rules/valid-types.md +0 -881
  185. package/docs/settings.md +0 -362
  186. package/tsconfig-prod.json +0 -20
  187. package/tsconfig.json +0 -21
@@ -1,174 +0,0 @@
1
- <a name="user-content-no-bad-blocks"></a>
2
- <a name="no-bad-blocks"></a>
3
- ### <code>no-bad-blocks</code>
4
-
5
-
6
-
7
- This rule checks for multi-line-style comments which fail to meet the
8
- criteria of a jsdoc block, namely that it should begin with two and only two
9
- asterisks, but which appear to be intended as jsdoc blocks due to the presence
10
- of whitespace followed by whitespace or asterisks, and
11
- an at-sign (`@`) and some non-whitespace (as with a jsdoc block tag).
12
-
13
- <a name="user-content-fixer"></a>
14
- <a name="fixer"></a>
15
- ## Fixer
16
-
17
- (TODO)
18
-
19
- <a name="user-content-options"></a>
20
- <a name="options"></a>
21
- ## Options
22
-
23
- Takes an optional options object with the following.
24
-
25
- <a name="user-content-options-ignore"></a>
26
- <a name="options-ignore"></a>
27
- ### <code>ignore</code>
28
-
29
- An array of directives that will not be reported if present at the beginning of
30
- a multi-comment block and at-sign `/* @`.
31
-
32
- Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
33
- (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
34
-
35
- <a name="user-content-options-preventallmultiasteriskblocks"></a>
36
- <a name="options-preventallmultiasteriskblocks"></a>
37
- ### <code>preventAllMultiAsteriskBlocks</code>
38
-
39
- A boolean (defaulting to `false`) which if `true` will prevent all
40
- JSDoc-like blocks with more than two initial asterisks even those without
41
- apparent tag content.
42
-
43
- <a name="user-content-context-and-settings"></a>
44
- <a name="context-and-settings"></a>
45
- ## Context and settings
46
-
47
- |||
48
- |---|---|
49
- |Context|Everywhere|
50
- |Tags|N/A|
51
- |Recommended|false|
52
- |Options|`ignore`, `preventAllMultiAsteriskBlocks`|
53
-
54
- <a name="user-content-failing-examples"></a>
55
- <a name="failing-examples"></a>
56
- ## Failing examples
57
-
58
- The following patterns are considered problems:
59
-
60
- ````js
61
- /*
62
- * @param foo
63
- */
64
- function quux (foo) {
65
-
66
- }
67
- // Message: Expected JSDoc-like comment to begin with two asterisks.
68
-
69
- /*
70
- * @property foo
71
- */
72
- // Message: Expected JSDoc-like comment to begin with two asterisks.
73
-
74
- function quux() {
75
-
76
- }
77
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
78
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
79
-
80
- /* @ts-ignore */
81
- // "jsdoc/no-bad-blocks": ["error"|"warn", {"ignore":[]}]
82
- // Message: Expected JSDoc-like comment to begin with two asterisks.
83
-
84
- /*
85
- * Some description.
86
- *
87
- * @returns {string} Some string
88
- */
89
- function echo() {
90
- return 'Something';
91
- }
92
- // Message: Expected JSDoc-like comment to begin with two asterisks.
93
-
94
- /***
95
- * @param foo
96
- */
97
- function quux (foo) {
98
-
99
- }
100
- // Message: Expected JSDoc-like comment to begin with two asterisks.
101
-
102
- /***
103
- *
104
- */
105
- function quux (foo) {
106
-
107
- }
108
- // "jsdoc/no-bad-blocks": ["error"|"warn", {"preventAllMultiAsteriskBlocks":true}]
109
- // Message: Expected JSDoc-like comment to begin with two asterisks.
110
- ````
111
-
112
-
113
-
114
- <a name="user-content-passing-examples"></a>
115
- <a name="passing-examples"></a>
116
- ## Passing examples
117
-
118
- The following patterns are not considered problems:
119
-
120
- ````js
121
- /**
122
- * @property foo
123
- */
124
-
125
- /**
126
- * @param foo
127
- */
128
- function quux () {
129
-
130
- }
131
-
132
- function quux () {
133
-
134
- }
135
-
136
- /* This could just be intended as a regular multiline comment,
137
- so don't report this */
138
- function quux () {
139
-
140
- }
141
-
142
- /* Just a regular multiline comment with an `@` but not appearing
143
- like a tag in a jsdoc-block, so don't report */
144
- function quux () {
145
-
146
- }
147
-
148
- /* @ts-check */
149
-
150
- /* @ts-expect-error */
151
-
152
- /* @ts-ignore */
153
-
154
- /* @ts-nocheck */
155
-
156
- /* */
157
-
158
- /** */
159
-
160
- /* @custom */
161
- // "jsdoc/no-bad-blocks": ["error"|"warn", {"ignore":["custom"]}]
162
-
163
- /***
164
- * This is not JSDoc because of the 3 asterisks, but
165
- * is allowed without `preventAllMultiAsteriskBlocks`, as
166
- * some might wish normal multiline comments.
167
- */
168
- function quux (foo) {
169
-
170
- }
171
-
172
- /***/
173
- ````
174
-
@@ -1,91 +0,0 @@
1
- <a name="user-content-no-blank-block-descriptions"></a>
2
- <a name="no-blank-block-descriptions"></a>
3
- ### <code>no-blank-block-descriptions</code>
4
-
5
-
6
-
7
- If tags are present, this rule will prevent empty lines in the
8
- block description.
9
-
10
- If no tags are present, this rule will prevent extra empty lines
11
- in the block description.
12
-
13
- <a name="user-content-fixer"></a>
14
- <a name="fixer"></a>
15
- ## Fixer
16
-
17
- (TODO)
18
-
19
- <a name="user-content-context-and-settings"></a>
20
- <a name="context-and-settings"></a>
21
- ## Context and settings
22
-
23
- |||
24
- |---|---|
25
- |Context|everywhere|
26
- |Tags|(Block description)|
27
- |Recommended|false|
28
- |Settings||
29
- |Options||
30
-
31
- <a name="user-content-failing-examples"></a>
32
- <a name="failing-examples"></a>
33
- ## Failing examples
34
-
35
- The following patterns are considered problems:
36
-
37
- ````js
38
- /**
39
- *
40
- * @param {number} x
41
- */
42
- function functionWithClearName(x) {}
43
- // Message: There should be no blank lines in block descriptions followed by tags.
44
-
45
- /**
46
- *
47
- *
48
- */
49
- function functionWithClearName() {}
50
- // Message: There should be no extra blank lines in block descriptions not followed by tags.
51
- ````
52
-
53
-
54
-
55
- <a name="user-content-passing-examples"></a>
56
- <a name="passing-examples"></a>
57
- ## Passing examples
58
-
59
- The following patterns are not considered problems:
60
-
61
- ````js
62
- /**
63
- * Non-empty description
64
- * @param {number} x
65
- */
66
- function functionWithClearName(x) {}
67
-
68
- /**
69
- * @param {number} x
70
- */
71
- function functionWithClearName(x) {}
72
-
73
- /**
74
- *
75
- */
76
- function functionWithClearName() {}
77
-
78
- /**
79
- */
80
- function functionWithClearName() {}
81
-
82
- /** */
83
- function functionWithClearName() {}
84
-
85
- /** Some desc. */
86
- function functionWithClearName() {}
87
-
88
- /** @someTag */
89
- function functionWithClearName() {}
90
- ````
91
-
@@ -1,98 +0,0 @@
1
- <a name="user-content-no-blank-blocks"></a>
2
- <a name="no-blank-blocks"></a>
3
- # <code>no-blank-blocks</code>
4
-
5
- * [Fixer](#user-content-no-blank-blocks-fixer)
6
- * [Failing examples](#user-content-no-blank-blocks-failing-examples)
7
- * [Passing examples](#user-content-no-blank-blocks-passing-examples)
8
-
9
-
10
- Reports and optionally removes blocks with whitespace only.
11
-
12
- <a name="user-content-no-blank-blocks-fixer"></a>
13
- <a name="no-blank-blocks-fixer"></a>
14
- ## Fixer
15
-
16
- (TODO)
17
-
18
- <a name="user-content-no-blank-blocks-fixer-options"></a>
19
- <a name="no-blank-blocks-fixer-options"></a>
20
- #### Options
21
-
22
- <a name="user-content-no-blank-blocks-fixer-options-enablefixer"></a>
23
- <a name="no-blank-blocks-fixer-options-enablefixer"></a>
24
- ##### <code>enableFixer</code>
25
-
26
- Whether or not to auto-remove the blank block. Defaults to `false`.
27
-
28
- |||
29
- |---|---|
30
- |Context|everywhere|
31
- |Tags|N/A|
32
- |Recommended|false|
33
- |Settings||
34
- |Options|`enableFixer`|
35
-
36
- <a name="user-content-no-blank-blocks-failing-examples"></a>
37
- <a name="no-blank-blocks-failing-examples"></a>
38
- ## Failing examples
39
-
40
- The following patterns are considered problems:
41
-
42
- ````js
43
- /** */
44
- // "jsdoc/no-blank-blocks": ["error"|"warn", {"enableFixer":true}]
45
- // Message: No empty blocks
46
-
47
- /**
48
- */
49
- // "jsdoc/no-blank-blocks": ["error"|"warn", {"enableFixer":true}]
50
- // Message: No empty blocks
51
-
52
- /**
53
- *
54
- */
55
- // "jsdoc/no-blank-blocks": ["error"|"warn", {"enableFixer":true}]
56
- // Message: No empty blocks
57
-
58
- /**
59
- *
60
- *
61
- */
62
- // "jsdoc/no-blank-blocks": ["error"|"warn", {"enableFixer":true}]
63
- // Message: No empty blocks
64
-
65
- /**
66
- *
67
- *
68
- */
69
- // "jsdoc/no-blank-blocks": ["error"|"warn", {"enableFixer":false}]
70
- // Message: No empty blocks
71
-
72
- /**
73
- *
74
- *
75
- */
76
- // Message: No empty blocks
77
- ````
78
-
79
-
80
-
81
- <a name="user-content-no-blank-blocks-passing-examples"></a>
82
- <a name="no-blank-blocks-passing-examples"></a>
83
- ## Passing examples
84
-
85
- The following patterns are not considered problems:
86
-
87
- ````js
88
- /** @tag */
89
-
90
- /**
91
- * Text
92
- */
93
-
94
- /**
95
- * @tag
96
- */
97
- ````
98
-
@@ -1,207 +0,0 @@
1
- <a name="user-content-no-defaults"></a>
2
- <a name="no-defaults"></a>
3
- # <code>no-defaults</code>
4
-
5
- * [Fixer](#user-content-no-defaults-fixer)
6
- * [Options](#user-content-no-defaults-options)
7
- * [`noOptionalParamNames`](#user-content-no-defaults-options-nooptionalparamnames)
8
- * [`contexts`](#user-content-no-defaults-options-contexts)
9
- * [Context and settings](#user-content-no-defaults-context-and-settings)
10
- * [Failing examples](#user-content-no-defaults-failing-examples)
11
- * [Passing examples](#user-content-no-defaults-passing-examples)
12
-
13
-
14
- This rule reports defaults being used on the relevant portion of `@param`
15
- or `@default`. It also optionally reports the presence of the
16
- square-bracketed optional arguments at all.
17
-
18
- The rule is intended to prevent the indication of defaults on tags where
19
- this would be redundant with ES6 default parameters (or for `@default`,
20
- where it would be redundant with the context to which the `@default`
21
- tag is attached).
22
-
23
- Unless your `@default` is on a function, you will need to set `contexts`
24
- to an appropriate context, including, if you wish, "any".
25
-
26
- <a name="user-content-no-defaults-fixer"></a>
27
- <a name="no-defaults-fixer"></a>
28
- ## Fixer
29
-
30
- (TODO)
31
-
32
- <a name="user-content-no-defaults-options"></a>
33
- <a name="no-defaults-options"></a>
34
- ## Options
35
-
36
- <a name="user-content-no-defaults-options-nooptionalparamnames"></a>
37
- <a name="no-defaults-options-nooptionalparamnames"></a>
38
- ### <code>noOptionalParamNames</code>
39
-
40
- Set this to `true` to report the presence of optional parameters. May be
41
- used if the project is insisting on optionality being indicated by
42
- the presence of ES6 default parameters (bearing in mind that such
43
- "defaults" are only applied when the supplied value is missing or
44
- `undefined` but not for `null` or other "falsey" values).
45
-
46
- <a name="user-content-no-defaults-options-contexts"></a>
47
- <a name="no-defaults-options-contexts"></a>
48
- ### <code>contexts</code>
49
-
50
- Set this to an array of strings representing the AST context (or an object with
51
- `context` and `comment` properties) where you wish the rule to be applied.
52
- Overrides the default contexts (see below). Set to `"any"` if you want
53
- the rule to apply to any jsdoc block throughout your files (as is necessary
54
- for finding function blocks not attached to a function declaration or
55
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
56
- `@method`) (including those associated with an `@interface`).
57
-
58
- See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
59
- section of our README for more on the expected format.
60
-
61
- <a name="user-content-no-defaults-context-and-settings"></a>
62
- <a name="no-defaults-context-and-settings"></a>
63
- ## Context and settings
64
-
65
- |||
66
- |---|---|
67
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
68
- |Tags|`param`, `default`|
69
- |Aliases|`arg`, `argument`, `defaultvalue`|
70
- |Recommended|false|
71
- |Options|`contexts`, `noOptionalParamNames`|
72
-
73
- <a name="user-content-no-defaults-failing-examples"></a>
74
- <a name="no-defaults-failing-examples"></a>
75
- ## Failing examples
76
-
77
- The following patterns are considered problems:
78
-
79
- ````js
80
- /**
81
- * @param {number} [foo="7"]
82
- */
83
- function quux (foo) {
84
-
85
- }
86
- // Message: Defaults are not permitted on @param.
87
-
88
- class Test {
89
- /**
90
- * @param {number} [foo="7"]
91
- */
92
- quux (foo) {
93
-
94
- }
95
- }
96
- // Message: Defaults are not permitted on @param.
97
-
98
- /**
99
- * @param {number} [foo="7"]
100
- */
101
- function quux (foo) {
102
-
103
- }
104
- // "jsdoc/no-defaults": ["error"|"warn", {"noOptionalParamNames":true}]
105
- // Message: Optional param names are not permitted on @param.
106
-
107
- /**
108
- * @arg {number} [foo="7"]
109
- */
110
- function quux (foo) {
111
-
112
- }
113
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
114
- // Message: Defaults are not permitted on @arg.
115
-
116
- /**
117
- * @param {number} [foo="7"]
118
- */
119
- function quux (foo) {
120
-
121
- }
122
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
123
- // Message: Defaults are not permitted on @param.
124
-
125
- /**
126
- * @function
127
- * @param {number} [foo="7"]
128
- */
129
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
130
- // Message: Defaults are not permitted on @param.
131
-
132
- /**
133
- * @callback
134
- * @param {number} [foo="7"]
135
- */
136
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
137
- // Message: Defaults are not permitted on @param.
138
-
139
- /**
140
- * @default {}
141
- */
142
- const a = {};
143
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
144
- // Message: Default values are not permitted on @default.
145
-
146
- /**
147
- * @defaultvalue {}
148
- */
149
- const a = {};
150
- // Settings: {"jsdoc":{"tagNamePreference":{"default":"defaultvalue"}}}
151
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
152
- // Message: Default values are not permitted on @defaultvalue.
153
- ````
154
-
155
-
156
-
157
- <a name="user-content-no-defaults-passing-examples"></a>
158
- <a name="no-defaults-passing-examples"></a>
159
- ## Passing examples
160
-
161
- The following patterns are not considered problems:
162
-
163
- ````js
164
- /**
165
- * @param foo
166
- */
167
- function quux (foo) {
168
-
169
- }
170
-
171
- /**
172
- * @param {number} foo
173
- */
174
- function quux (foo) {
175
-
176
- }
177
-
178
- /**
179
- * @param foo
180
- */
181
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
182
-
183
- /**
184
- * @function
185
- * @param {number} foo
186
- */
187
-
188
- /**
189
- * @callback
190
- * @param {number} foo
191
- */
192
-
193
- /**
194
- * @param {number} foo
195
- */
196
- function quux (foo) {
197
-
198
- }
199
- // "jsdoc/no-defaults": ["error"|"warn", {"noOptionalParamNames":true}]
200
-
201
- /**
202
- * @default
203
- */
204
- const a = {};
205
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
206
- ````
207
-