eslint-plugin-jsdoc 46.4.5 → 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 (66) hide show
  1. package/README.md +31 -0
  2. package/dist/alignTransform.js +5 -5
  3. package/dist/alignTransform.js.map +1 -1
  4. package/dist/index.js +21 -10
  5. package/dist/index.js.map +1 -1
  6. package/dist/iterateJsdoc.js +1 -1
  7. package/dist/iterateJsdoc.js.map +1 -1
  8. package/dist/rules/checkExamples.js +12 -6
  9. package/dist/rules/checkExamples.js.map +1 -1
  10. package/package.json +19 -15
  11. package/docs/advanced.md +0 -102
  12. package/docs/rules/check-access.md +0 -193
  13. package/docs/rules/check-alignment.md +0 -169
  14. package/docs/rules/check-examples.md +0 -784
  15. package/docs/rules/check-indentation.md +0 -296
  16. package/docs/rules/check-line-alignment.md +0 -1002
  17. package/docs/rules/check-param-names.md +0 -1035
  18. package/docs/rules/check-property-names.md +0 -244
  19. package/docs/rules/check-syntax.md +0 -80
  20. package/docs/rules/check-tag-names.md +0 -1132
  21. package/docs/rules/check-types.md +0 -1198
  22. package/docs/rules/check-values.md +0 -409
  23. package/docs/rules/empty-tags.md +0 -220
  24. package/docs/rules/implements-on-classes.md +0 -219
  25. package/docs/rules/imports-as-dependencies.md +0 -99
  26. package/docs/rules/informative-docs.md +0 -400
  27. package/docs/rules/match-description.md +0 -1008
  28. package/docs/rules/match-name.md +0 -249
  29. package/docs/rules/multiline-blocks.md +0 -398
  30. package/docs/rules/no-bad-blocks.md +0 -174
  31. package/docs/rules/no-blank-block-descriptions.md +0 -91
  32. package/docs/rules/no-blank-blocks.md +0 -98
  33. package/docs/rules/no-defaults.md +0 -207
  34. package/docs/rules/no-missing-syntax.md +0 -275
  35. package/docs/rules/no-multi-asterisks.md +0 -278
  36. package/docs/rules/no-restricted-syntax.md +0 -383
  37. package/docs/rules/no-types.md +0 -168
  38. package/docs/rules/no-undefined-types.md +0 -789
  39. package/docs/rules/require-asterisk-prefix.md +0 -297
  40. package/docs/rules/require-description-complete-sentence.md +0 -820
  41. package/docs/rules/require-description.md +0 -585
  42. package/docs/rules/require-example.md +0 -390
  43. package/docs/rules/require-file-overview.md +0 -324
  44. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  45. package/docs/rules/require-jsdoc.md +0 -1857
  46. package/docs/rules/require-param-description.md +0 -238
  47. package/docs/rules/require-param-name.md +0 -163
  48. package/docs/rules/require-param-type.md +0 -227
  49. package/docs/rules/require-param.md +0 -1820
  50. package/docs/rules/require-property-description.md +0 -88
  51. package/docs/rules/require-property-name.md +0 -79
  52. package/docs/rules/require-property-type.md +0 -79
  53. package/docs/rules/require-property.md +0 -128
  54. package/docs/rules/require-returns-check.md +0 -1053
  55. package/docs/rules/require-returns-description.md +0 -181
  56. package/docs/rules/require-returns-type.md +0 -144
  57. package/docs/rules/require-returns.md +0 -1191
  58. package/docs/rules/require-throws.md +0 -326
  59. package/docs/rules/require-yields-check.md +0 -544
  60. package/docs/rules/require-yields.md +0 -823
  61. package/docs/rules/sort-tags.md +0 -635
  62. package/docs/rules/tag-lines.md +0 -551
  63. package/docs/rules/text-escaping.md +0 -177
  64. package/docs/rules/valid-types.md +0 -881
  65. package/docs/settings.md +0 -362
  66. package/tsconfig.json +0 -22
@@ -1,219 +0,0 @@
1
- <a name="user-content-implements-on-classes"></a>
2
- <a name="implements-on-classes"></a>
3
- # <code>implements-on-classes</code>
4
-
5
- * [Options](#user-content-implements-on-classes-options)
6
- * [`contexts`](#user-content-implements-on-classes-options-contexts)
7
- * [Context and settings](#user-content-implements-on-classes-context-and-settings)
8
- * [Failing examples](#user-content-implements-on-classes-failing-examples)
9
- * [Passing examples](#user-content-implements-on-classes-passing-examples)
10
-
11
-
12
- Reports an issue with any non-constructor function using `@implements`.
13
-
14
- Constructor functions, whether marked with `@class`, `@constructs`, or being
15
- an ES6 class constructor, will not be flagged.
16
-
17
- To indicate that a function follows another function's signature, one might
18
- instead use `@type` to indicate the `@function` or `@callback` to which the
19
- function is adhering.
20
-
21
- <a name="user-content-implements-on-classes-options"></a>
22
- <a name="implements-on-classes-options"></a>
23
- ## Options
24
-
25
- <a name="user-content-implements-on-classes-options-contexts"></a>
26
- <a name="implements-on-classes-options-contexts"></a>
27
- ### <code>contexts</code>
28
-
29
- Set this to an array of strings representing the AST context (or an object with
30
- `context` and `comment` properties) where you wish the rule to be applied.
31
-
32
- Overrides the default contexts (see below). Set to `"any"` if you want
33
- the rule to apply to any jsdoc block throughout your files (as is necessary
34
- for finding function blocks not attached to a function declaration or
35
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
36
- `@method`) (including those associated with an `@interface`).
37
-
38
- See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
39
- section of our README for more on the expected format.
40
-
41
- <a name="user-content-implements-on-classes-context-and-settings"></a>
42
- <a name="implements-on-classes-context-and-settings"></a>
43
- ## Context and settings
44
-
45
- |||
46
- |---|---|
47
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
48
- |Tags|`implements` (prevented)|
49
- |Recommended|true|
50
- |Options|`contexts`|
51
-
52
- <a name="user-content-implements-on-classes-failing-examples"></a>
53
- <a name="implements-on-classes-failing-examples"></a>
54
- ## Failing examples
55
-
56
- The following patterns are considered problems:
57
-
58
- ````js
59
- /**
60
- * @implements {SomeClass}
61
- */
62
- function quux () {
63
-
64
- }
65
- // Message: @implements used on a non-constructor function
66
-
67
- /**
68
- * @implements {SomeClass}
69
- */
70
- function quux () {
71
-
72
- }
73
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
74
- // Message: @implements used on a non-constructor function
75
-
76
- /**
77
- * @function
78
- * @implements {SomeClass}
79
- */
80
- function quux () {
81
-
82
- }
83
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
84
- // Message: @implements used on a non-constructor function
85
-
86
- /**
87
- * @callback
88
- * @implements {SomeClass}
89
- */
90
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
91
- // Message: @implements used on a non-constructor function
92
-
93
- /**
94
- * @implements {SomeClass}
95
- */
96
- function quux () {
97
-
98
- }
99
- // Settings: {"jsdoc":{"tagNamePreference":{"implements":false}}}
100
- // Message: Unexpected tag `@implements`
101
-
102
- class Foo {
103
- /**
104
- * @implements {SomeClass}
105
- */
106
- constructor() {}
107
-
108
- /**
109
- * @implements {SomeClass}
110
- */
111
- bar() {}
112
- }
113
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["MethodDefinition"]}]
114
- // Message: @implements used on a non-constructor function
115
-
116
- class Foo {
117
- /**
118
- * @implements {SomeClass}
119
- */
120
- constructor() {}
121
-
122
- /**
123
- * @implements {SomeClass}
124
- */
125
- bar() {}
126
- }
127
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
128
- // Message: @implements used on a non-constructor function
129
- ````
130
-
131
-
132
-
133
- <a name="user-content-implements-on-classes-passing-examples"></a>
134
- <a name="implements-on-classes-passing-examples"></a>
135
- ## Passing examples
136
-
137
- The following patterns are not considered problems:
138
-
139
- ````js
140
- /**
141
- * @implements {SomeClass}
142
- * @class
143
- */
144
- function quux () {
145
-
146
- }
147
-
148
- /**
149
- * @implements {SomeClass}
150
- * @class
151
- */
152
- function quux () {
153
-
154
- }
155
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
156
-
157
- /**
158
- * @implements {SomeClass}
159
- */
160
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
161
-
162
- /**
163
- * @implements {SomeClass}
164
- * @constructor
165
- */
166
- function quux () {
167
-
168
- }
169
-
170
- /**
171
- *
172
- */
173
- class quux {
174
- /**
175
- * @implements {SomeClass}
176
- */
177
- constructor () {
178
-
179
- }
180
- }
181
-
182
- /**
183
- *
184
- */
185
- const quux = class {
186
- /**
187
- * @implements {SomeClass}
188
- */
189
- constructor () {
190
-
191
- }
192
- }
193
-
194
- /**
195
- *
196
- */
197
- function quux () {
198
-
199
- }
200
-
201
- /**
202
- *
203
- */
204
- function quux () {
205
-
206
- }
207
- // Settings: {"jsdoc":{"tagNamePreference":{"implements":false}}}
208
-
209
- /**
210
- * @function
211
- * @implements {SomeClass}
212
- */
213
-
214
- /**
215
- * @callback
216
- * @implements {SomeClass}
217
- */
218
- ````
219
-
@@ -1,99 +0,0 @@
1
- <a name="user-content-imports-as-dependencies"></a>
2
- <a name="imports-as-dependencies"></a>
3
- ### <code>imports-as-dependencies</code>
4
-
5
- This rule will report an issue if JSDoc `import()` statements point to a package
6
- which is not listed in `dependencies` or `devDependencies`.
7
-
8
- |||
9
- |---|---|
10
- |Context|everywhere|
11
- |Tags|``|
12
- |Recommended|false|
13
- |Settings||
14
- |Options||
15
-
16
- <a name="user-content-failing-examples"></a>
17
- <a name="failing-examples"></a>
18
- ## Failing examples
19
-
20
- The following patterns are considered problems:
21
-
22
- ````js
23
- /**
24
- * @type {null|import('sth').SomeApi}
25
- */
26
- // Message: import points to package which is not found in dependencies
27
-
28
- /**
29
- * @type {null|import('sth').SomeApi}
30
- */
31
- // Settings: {"jsdoc":{"mode":"permissive"}}
32
- // Message: import points to package which is not found in dependencies
33
-
34
- /**
35
- * @type {null|import('missingpackage/subpackage').SomeApi}
36
- */
37
- // Message: import points to package which is not found in dependencies
38
-
39
- /**
40
- * @type {null|import('@sth/pkg').SomeApi}
41
- */
42
- // Message: import points to package which is not found in dependencies
43
- ````
44
-
45
-
46
-
47
- <a name="user-content-passing-examples"></a>
48
- <a name="passing-examples"></a>
49
- ## Passing examples
50
-
51
- The following patterns are not considered problems:
52
-
53
- ````js
54
- /**
55
- * @type {null|import('eslint').ESLint}
56
- */
57
-
58
- /**
59
- * @type {null|import('eslint/use-at-your-own-risk').ESLint}
60
- */
61
-
62
- /**
63
- * @type {null|import('@es-joy/jsdoccomment').InlineTag}
64
- */
65
-
66
- /**
67
- * @type {null|import(}
68
- */
69
-
70
- /**
71
- * @type {null|import('esquery').ESQueryOptions}
72
- */
73
-
74
- /**
75
- * @type {null|import('@es-joy/jsdoccomment').InlineTag|
76
- * import('@es-joy/jsdoccomment').JsdocBlock}
77
- */
78
-
79
- /**
80
- * @type {null|import('typescript').Program}
81
- */
82
-
83
- /**
84
- * @type {null|import('./relativePath.js').Program}
85
- */
86
-
87
- /**
88
- * @type {null|import('fs').PathLike}
89
- */
90
-
91
- /**
92
- * @type {null|import('fs/promises').FileHandle}
93
- */
94
-
95
- /**
96
- * @type {null|import('node:fs').PathLike}
97
- */
98
- ````
99
-
@@ -1,400 +0,0 @@
1
- <a name="user-content-informative-docs"></a>
2
- <a name="informative-docs"></a>
3
- # <code>informative-docs</code>
4
-
5
- * [Options](#user-content-informative-docs-options)
6
- * [`aliases`](#user-content-informative-docs-options-aliases)
7
- * [`uselessWords`](#user-content-informative-docs-options-uselesswords)
8
- * [Context and settings](#user-content-informative-docs-context-and-settings)
9
- * [Failing examples](#user-content-informative-docs-failing-examples)
10
- * [Passing examples](#user-content-informative-docs-passing-examples)
11
-
12
-
13
- Reports on JSDoc texts that serve only to restart their attached name.
14
-
15
- Devs sometimes write JSDoc descriptions that add no additional information just to fill out the doc:
16
-
17
- ```js
18
- /** The user id. */
19
- let userId;
20
- ```
21
-
22
- Those "uninformative" docs comments take up space without being helpful.
23
- This rule requires all docs comments contain at least one word not already in the code.
24
-
25
- <a name="user-content-informative-docs-options"></a>
26
- <a name="informative-docs-options"></a>
27
- ## Options
28
-
29
- <a name="user-content-informative-docs-options-aliases"></a>
30
- <a name="informative-docs-options-aliases"></a>
31
- ### <code>aliases</code>
32
-
33
- The `aliases` option allows indicating words as synonyms (aliases) of each other.
34
-
35
- For example, with `{ aliases: { emoji: ["smiley", "winkey"] } }`, the following comment would be considered uninformative:
36
-
37
- ```js
38
- /** A smiley/winkey. */
39
- let emoji;
40
- ```
41
-
42
- The default `aliases` option is:
43
-
44
- ```json
45
- {
46
- "a": ["an", "our"]
47
- }
48
- ```
49
-
50
- <a name="user-content-informative-docs-options-uselesswords"></a>
51
- <a name="informative-docs-options-uselesswords"></a>
52
- ### <code>uselessWords</code>
53
-
54
- Words that are ignored when searching for one that adds meaning.
55
-
56
- For example, with `{ uselessWords: ["our"] }`, the following comment would be considered uninformative:
57
-
58
- ```js
59
- /** Our text. */
60
- let text;
61
- ```
62
-
63
- The default `uselessWords` option is:
64
-
65
- ```json
66
- ["a", "an", "i", "in", "of", "s", "the"]
67
- ```
68
-
69
- <a name="user-content-informative-docs-context-and-settings"></a>
70
- <a name="informative-docs-context-and-settings"></a>
71
- ## Context and settings
72
-
73
- |||
74
- |---|---|
75
- |Context|everywhere|
76
- |Tags|any|
77
- |Recommended|false|
78
- |Settings||
79
- |Options|`aliases`, `uselessWords`|
80
-
81
- <a name="user-content-informative-docs-failing-examples"></a>
82
- <a name="informative-docs-failing-examples"></a>
83
- ## Failing examples
84
-
85
- The following patterns are considered problems:
86
-
87
- ````js
88
- /** the */
89
- let myValue = 3;
90
- // Message: This description only repeats the name it describes.
91
-
92
- /** The user id. */
93
- let userId: string;
94
- // Message: This description only repeats the name it describes.
95
-
96
- /** the my value */
97
- let myValue = 3;
98
- // Message: This description only repeats the name it describes.
99
-
100
- /** value **/
101
- let myValue,
102
- count = 3;
103
- // Message: This description only repeats the name it describes.
104
-
105
- let myValue,
106
- /** count **/
107
- count = 3;
108
- // Message: This description only repeats the name it describes.
109
-
110
- /**
111
- * the foo.
112
- */
113
- function foo() {}
114
- // Message: This description only repeats the name it describes.
115
-
116
- /**
117
- * the value foo.
118
- */
119
- const value = function foo() {}
120
- // Message: This description only repeats the name it describes.
121
-
122
- const value = {
123
- /**
124
- * the prop.
125
- */
126
- prop: true,
127
- }
128
- // Message: This description only repeats the name it describes.
129
-
130
- /**
131
- * name
132
- */
133
- class Name {}
134
- // Message: This description only repeats the name it describes.
135
-
136
- /**
137
- * abc def
138
- */
139
- const abc = class Def {}
140
- // Message: This description only repeats the name it describes.
141
-
142
- class Abc {
143
- /** the abc def! */
144
- def;
145
- }
146
- // Message: This description only repeats the name it describes.
147
-
148
- const _ = class Abc {
149
- /** the abc def! */
150
- def;
151
- }
152
- // Message: This description only repeats the name it describes.
153
-
154
- class Abc {
155
- /** the abc def! */
156
- def() {};
157
- }
158
- // Message: This description only repeats the name it describes.
159
-
160
- class Abc {
161
- /** def */
162
- accessor def;
163
- }
164
- // Message: This description only repeats the name it describes.
165
-
166
- class Abc {
167
- /** def */
168
- def() {}
169
- }
170
- // Message: This description only repeats the name it describes.
171
-
172
- class Abc {
173
- /** def */
174
- abstract accessor def;
175
- }
176
- // Message: This description only repeats the name it describes.
177
-
178
- class Abc {
179
- /** def */
180
- abstract def();
181
- }
182
- // Message: This description only repeats the name it describes.
183
-
184
- class Abc {
185
- /** def */
186
- abstract def;
187
- }
188
- // Message: This description only repeats the name it describes.
189
-
190
- /** abc */
191
- namespace Abc {}
192
- // Message: This description only repeats the name it describes.
193
-
194
- class Abc {
195
- /** def */
196
- def();
197
- def() {}
198
- }
199
- // Message: This description only repeats the name it describes.
200
-
201
- /** abc */
202
- declare function abc();
203
- // Message: This description only repeats the name it describes.
204
-
205
- /** abc */
206
- enum Abc {}
207
- // Message: This description only repeats the name it describes.
208
-
209
- enum Abc {
210
- /** def */
211
- def,
212
- }
213
- // Message: This description only repeats the name it describes.
214
-
215
- /** def */
216
- interface Def {}
217
- // Message: This description only repeats the name it describes.
218
-
219
- /** def */
220
- type Def = {};
221
- // Message: This description only repeats the name it describes.
222
-
223
- /**
224
- * count
225
- *
226
- * @description the value
227
- */
228
- let value = 3;
229
- // Message: This tag description only repeats the name it describes.
230
-
231
- /** @param {number} param - the param */
232
- function takesOne(param) {}
233
- // Message: This tag description only repeats the name it describes.
234
-
235
- /** @other param - takes one */
236
- function takesOne(param) {}
237
- // Message: This tag description only repeats the name it describes.
238
-
239
- /**
240
- * takes one
241
- * @other param - takes one
242
- */
243
- function takesOne(param) {}
244
- // Message: This description only repeats the name it describes.
245
-
246
- /**
247
- * - takes one
248
- * @other param - takes one
249
- */
250
- function takesOne(param) {}
251
- // Message: This description only repeats the name it describes.
252
- ````
253
-
254
-
255
-
256
- <a name="user-content-informative-docs-passing-examples"></a>
257
- <a name="informative-docs-passing-examples"></a>
258
- ## Passing examples
259
-
260
- The following patterns are not considered problems:
261
-
262
- ````js
263
- /** */
264
- let myValue = 3;
265
-
266
- /** count */
267
- let myValue = 3;
268
-
269
- /** Informative info user id. */
270
- let userId: string;
271
-
272
- let myValue,
273
- /** count value **/
274
- count = 3;
275
-
276
- /**
277
- * Does X Y Z work.
278
- */
279
- function foo() {}
280
-
281
- const value = {
282
- /**
283
- * the truthiness of the prop.
284
- */
285
- prop: true,
286
- }
287
-
288
- const value = {
289
- /**
290
- * the truthiness of the prop.
291
- */
292
- ['prop']: true,
293
- }
294
-
295
- /**
296
- * abc def ghi
297
- */
298
- const abc = function def() {}
299
-
300
- /**
301
- * name extra
302
- */
303
- class Name {}
304
-
305
- /**
306
- * abc name extra
307
- */
308
- const abc = class Name {}
309
-
310
- class Abc {
311
- /** ghi */
312
- def;
313
- }
314
-
315
- class Abc {
316
- /** ghi */
317
- accessor def;
318
- }
319
-
320
- class Abc {
321
- /** ghi */
322
- def() {}
323
- }
324
-
325
- class Abc {
326
- /** ghi */
327
- abstract accessor def;
328
- }
329
-
330
- class Abc {
331
- /** ghi */
332
- abstract def();
333
- }
334
-
335
- class Abc {
336
- /** ghi */
337
- abstract def;
338
- }
339
-
340
- /** abc */
341
- namespace Def {}
342
-
343
- class Abc {
344
- /** ghi */
345
- def();
346
- def() {}
347
- }
348
-
349
- /** abc */
350
- declare function def();
351
-
352
- /** abc */
353
- enum Def {}
354
-
355
- enum Abc {
356
- /** def */
357
- ghi,
358
- }
359
-
360
- /** abc */
361
- interface Def {}
362
-
363
- /** abc */
364
- type Def = {};
365
-
366
- /** abc */
367
- type Def = {};
368
-
369
- /**
370
- * count
371
- *
372
- * @description increment value
373
- */
374
- let value = 3;
375
-
376
- /**
377
- * count
378
- *
379
- * @unknownTag - increment value
380
- */
381
- let value = 3;
382
-
383
- /**
384
- * @other param - takes one two
385
- */
386
- function takesOne(param) {}
387
-
388
- /**
389
- * takes abc param
390
- */
391
- function takesOne(param) {}
392
-
393
- /**
394
- * @class
395
- *
396
- * @param {number} value - Some useful text
397
- */
398
- function MyAmazingThing(value) {}
399
- ````
400
-