eslint-plugin-jsdoc 37.7.0 → 37.8.2
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.
- package/README.md +404 -13
- package/dist/defaultTagOrder.js +26 -0
- package/dist/defaultTagOrder.js.map +1 -0
- package/dist/getDefaultTagStructureForMode.js +12 -5
- package/dist/getDefaultTagStructureForMode.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/iterateJsdoc.js +33 -5
- package/dist/iterateJsdoc.js.map +1 -1
- package/dist/rules/checkTypes.js +11 -3
- package/dist/rules/checkTypes.js.map +1 -1
- package/dist/rules/emptyTags.js +2 -1
- package/dist/rules/emptyTags.js.map +1 -1
- package/dist/rules/sortTags.js +165 -0
- package/dist/rules/sortTags.js.map +1 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ JSDoc linting rules for ESLint.
|
|
|
70
70
|
* [`require-throws`](#eslint-plugin-jsdoc-rules-require-throws)
|
|
71
71
|
* [`require-yields`](#eslint-plugin-jsdoc-rules-require-yields)
|
|
72
72
|
* [`require-yields-check`](#eslint-plugin-jsdoc-rules-require-yields-check)
|
|
73
|
+
* [`sort-tags`](#eslint-plugin-jsdoc-rules-sort-tags)
|
|
73
74
|
* [`tag-lines`](#eslint-plugin-jsdoc-rules-tag-lines)
|
|
74
75
|
* [`valid-types`](#eslint-plugin-jsdoc-rules-valid-types)
|
|
75
76
|
|
|
@@ -4728,7 +4729,7 @@ number
|
|
|
4728
4729
|
bigint
|
|
4729
4730
|
string
|
|
4730
4731
|
symbol
|
|
4731
|
-
object
|
|
4732
|
+
object (For TypeScript's sake, however, using `Object` when specifying child types on it like `Object<string, number>`)
|
|
4732
4733
|
Array
|
|
4733
4734
|
Function
|
|
4734
4735
|
Date
|
|
@@ -4789,7 +4790,7 @@ the `valid-types` rule to report parsing errors.
|
|
|
4789
4790
|
|
|
4790
4791
|
Why are `boolean`, `number` and `string` exempt from starting with a capital
|
|
4791
4792
|
letter? Let's take `string` as an example. In Javascript, everything is an
|
|
4792
|
-
object. The
|
|
4793
|
+
object. The `String` object has prototypes for string functions such as
|
|
4793
4794
|
`.toUpperCase()`.
|
|
4794
4795
|
|
|
4795
4796
|
Fortunately we don't have to write `new String()` everywhere in our code.
|
|
@@ -4812,17 +4813,28 @@ new String('lard') // String {0: "l", 1: "a", 2: "r", 3: "d", length: 4}
|
|
|
4812
4813
|
new String('lard') === 'lard' // false
|
|
4813
4814
|
```
|
|
4814
4815
|
|
|
4815
|
-
To make things more confusing, there are also object literals and
|
|
4816
|
-
|
|
4817
|
-
instantiated
|
|
4816
|
+
To make things more confusing, there are also object literals (like `{}`) and
|
|
4817
|
+
`Object` objects. But object literals are still static `Object`s and `Object`
|
|
4818
|
+
objects are instantiated objects. So an object primitive is still an `Object`
|
|
4819
|
+
object.
|
|
4818
4820
|
|
|
4819
4821
|
However, `Object.create(null)` objects are not `instanceof Object`, however, so
|
|
4820
|
-
in the case of
|
|
4821
|
-
these objects.
|
|
4822
|
+
in the case of such a plain object we lower-case to indicate possible support
|
|
4823
|
+
for these objects. Also, nowadays, TypeScript also discourages use of `Object`
|
|
4824
|
+
as a lone type. However, one additional complexity is that TypeScript allows and
|
|
4825
|
+
actually [currently requires](https://github.com/microsoft/TypeScript/issues/20555)
|
|
4826
|
+
`Object` (with the initial upper-case) if used in the syntax
|
|
4827
|
+
`Object.<keyType, valueType>` or `Object<keyType, valueType`, perhaps to
|
|
4828
|
+
adhere to what [JSDoc documents](https://jsdoc.app/tags-type.html).
|
|
4829
|
+
|
|
4830
|
+
So, for optimal compatibility with TypeScript (especially since TypeScript
|
|
4831
|
+
tools can be used on plain JavaScript with JSDoc), we are now allowing this
|
|
4832
|
+
TypeScript approach by default.
|
|
4822
4833
|
|
|
4823
4834
|
Basically, for primitives, we want to define the type as a primitive, because
|
|
4824
4835
|
that's what we use in 99.9% of cases. For everything else, we use the type
|
|
4825
|
-
rather than the primitive. Otherwise it would all just be `{object}
|
|
4836
|
+
rather than the primitive. Otherwise it would all just be `{object}` (with the
|
|
4837
|
+
additional exception of the special case of `Object.<>` just mentioned).
|
|
4826
4838
|
|
|
4827
4839
|
In short: It's not about consistency, rather about the 99.9% use case. (And
|
|
4828
4840
|
some functions might not even support the objects if they are checking for
|
|
@@ -5456,6 +5468,30 @@ function quux (foo) {
|
|
|
5456
5468
|
}
|
|
5457
5469
|
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object.<>":"Object"}}}
|
|
5458
5470
|
// Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object".
|
|
5471
|
+
|
|
5472
|
+
/**
|
|
5473
|
+
* @param {object.<string, number>} foo
|
|
5474
|
+
*/
|
|
5475
|
+
function quux (foo) {
|
|
5476
|
+
}
|
|
5477
|
+
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
|
|
5478
|
+
// Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
|
|
5479
|
+
|
|
5480
|
+
/**
|
|
5481
|
+
* @param {Object.<string, number>} foo
|
|
5482
|
+
*/
|
|
5483
|
+
function quux (foo) {
|
|
5484
|
+
}
|
|
5485
|
+
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
|
|
5486
|
+
// Message: Invalid JSDoc @param "foo" type "Object"; prefer: "Object<>".
|
|
5487
|
+
|
|
5488
|
+
/**
|
|
5489
|
+
* @param {object<string, number>} foo
|
|
5490
|
+
*/
|
|
5491
|
+
function quux (foo) {
|
|
5492
|
+
}
|
|
5493
|
+
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
|
|
5494
|
+
// Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
|
|
5459
5495
|
````
|
|
5460
5496
|
|
|
5461
5497
|
The following patterns are not considered problems:
|
|
@@ -5751,6 +5787,18 @@ function quux (foo) {
|
|
|
5751
5787
|
|
|
5752
5788
|
}
|
|
5753
5789
|
// Settings: {"jsdoc":{"mode":"typescript"}}
|
|
5790
|
+
|
|
5791
|
+
/**
|
|
5792
|
+
* @typedef {object} foo
|
|
5793
|
+
*/
|
|
5794
|
+
function a () {}
|
|
5795
|
+
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","object<>":"Object<>"}}}
|
|
5796
|
+
|
|
5797
|
+
/**
|
|
5798
|
+
* @typedef {Object<string, number>} foo
|
|
5799
|
+
*/
|
|
5800
|
+
function a () {}
|
|
5801
|
+
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","object<>":"Object<>"}}}
|
|
5754
5802
|
````
|
|
5755
5803
|
|
|
5756
5804
|
|
|
@@ -6129,6 +6177,12 @@ function quux () {
|
|
|
6129
6177
|
}
|
|
6130
6178
|
// Message: @abstract should be empty.
|
|
6131
6179
|
|
|
6180
|
+
/**
|
|
6181
|
+
* @interface extra text
|
|
6182
|
+
*/
|
|
6183
|
+
// Settings: {"jsdoc":{"mode":"closure"}}
|
|
6184
|
+
// Message: @interface should be empty.
|
|
6185
|
+
|
|
6132
6186
|
class Test {
|
|
6133
6187
|
/**
|
|
6134
6188
|
* @abstract extra text
|
|
@@ -20009,12 +20063,349 @@ function * quux (foo) {
|
|
|
20009
20063
|
````
|
|
20010
20064
|
|
|
20011
20065
|
|
|
20066
|
+
<a name="eslint-plugin-jsdoc-rules-sort-tags"></a>
|
|
20067
|
+
### <code>sort-tags</code>
|
|
20068
|
+
|
|
20069
|
+
Sorts tags by a specified sequence according to tag name.
|
|
20070
|
+
|
|
20071
|
+
(Default order originally inspired by [`@homer0/prettier-plugin-jsdoc`](https://github.com/homer0/packages/tree/main/packages/public/prettier-plugin-jsdoc).)
|
|
20072
|
+
|
|
20073
|
+
<a name="eslint-plugin-jsdoc-rules-sort-tags-options-40"></a>
|
|
20074
|
+
#### Options
|
|
20075
|
+
|
|
20076
|
+
<a name="eslint-plugin-jsdoc-rules-sort-tags-options-40-tagsequence"></a>
|
|
20077
|
+
##### <code>tagSequence</code>
|
|
20078
|
+
|
|
20079
|
+
An array of tag names indicating the preferred sequence for sorting tags.
|
|
20080
|
+
|
|
20081
|
+
Tag names earlier in the list will be arranged first. The relative position of
|
|
20082
|
+
tags of the same name will not be changed.
|
|
20083
|
+
|
|
20084
|
+
Tags not in the list will be sorted alphabetically at the end (or in place of
|
|
20085
|
+
the pseudo-tag `-other` placed within `tagSequence`) if `alphabetizeExtras` is
|
|
20086
|
+
enabled and in their order of appearance otherwise (so if you want all your
|
|
20087
|
+
tags alphabetized, supply an empty array with `alphabetizeExtras` enabled).
|
|
20088
|
+
|
|
20089
|
+
Defaults to the array below.
|
|
20090
|
+
|
|
20091
|
+
Please note that this order is still experimental, so if you want to retain
|
|
20092
|
+
a fixed order that doesn't change into the future, supply your own
|
|
20093
|
+
`tagSequence`.
|
|
20094
|
+
|
|
20095
|
+
```js
|
|
20096
|
+
[
|
|
20097
|
+
// Brief descriptions
|
|
20098
|
+
'summary',
|
|
20099
|
+
'typeSummary',
|
|
20100
|
+
|
|
20101
|
+
// Module/file-level
|
|
20102
|
+
'module',
|
|
20103
|
+
'exports',
|
|
20104
|
+
'file',
|
|
20105
|
+
'fileoverview',
|
|
20106
|
+
'overview',
|
|
20107
|
+
|
|
20108
|
+
// Identifying (name, type)
|
|
20109
|
+
'typedef',
|
|
20110
|
+
'interface',
|
|
20111
|
+
'record',
|
|
20112
|
+
'template',
|
|
20113
|
+
'name',
|
|
20114
|
+
'kind',
|
|
20115
|
+
'type',
|
|
20116
|
+
'alias',
|
|
20117
|
+
'external',
|
|
20118
|
+
'host',
|
|
20119
|
+
'callback',
|
|
20120
|
+
'func',
|
|
20121
|
+
'function',
|
|
20122
|
+
'method',
|
|
20123
|
+
'class',
|
|
20124
|
+
'constructor',
|
|
20125
|
+
|
|
20126
|
+
// Relationships
|
|
20127
|
+
'modifies',
|
|
20128
|
+
'mixes',
|
|
20129
|
+
'mixin',
|
|
20130
|
+
'mixinClass',
|
|
20131
|
+
'mixinFunction',
|
|
20132
|
+
'namespace',
|
|
20133
|
+
'borrows',
|
|
20134
|
+
'constructs',
|
|
20135
|
+
'lends',
|
|
20136
|
+
'implements',
|
|
20137
|
+
'requires',
|
|
20138
|
+
|
|
20139
|
+
// Long descriptions
|
|
20140
|
+
'desc',
|
|
20141
|
+
'description',
|
|
20142
|
+
'classdesc',
|
|
20143
|
+
'tutorial',
|
|
20144
|
+
'copyright',
|
|
20145
|
+
'license',
|
|
20146
|
+
|
|
20147
|
+
// Simple annotations
|
|
20148
|
+
'const',
|
|
20149
|
+
'constant',
|
|
20150
|
+
'final',
|
|
20151
|
+
'global',
|
|
20152
|
+
'readonly',
|
|
20153
|
+
'abstract',
|
|
20154
|
+
'virtual',
|
|
20155
|
+
'var',
|
|
20156
|
+
'member',
|
|
20157
|
+
'memberof',
|
|
20158
|
+
'memberof!',
|
|
20159
|
+
'inner',
|
|
20160
|
+
'instance',
|
|
20161
|
+
'inheritdoc',
|
|
20162
|
+
'inheritDoc',
|
|
20163
|
+
'override',
|
|
20164
|
+
'hideconstructor',
|
|
20165
|
+
|
|
20166
|
+
// Core function/object info
|
|
20167
|
+
'param',
|
|
20168
|
+
'arg',
|
|
20169
|
+
'argument',
|
|
20170
|
+
'prop',
|
|
20171
|
+
'property',
|
|
20172
|
+
'return',
|
|
20173
|
+
'returns',
|
|
20174
|
+
|
|
20175
|
+
// Important behavior details
|
|
20176
|
+
'async',
|
|
20177
|
+
'generator',
|
|
20178
|
+
'default',
|
|
20179
|
+
'defaultvalue',
|
|
20180
|
+
'enum',
|
|
20181
|
+
'augments',
|
|
20182
|
+
'extends',
|
|
20183
|
+
'throws',
|
|
20184
|
+
'exception',
|
|
20185
|
+
'yield',
|
|
20186
|
+
'yields',
|
|
20187
|
+
'event',
|
|
20188
|
+
'fires',
|
|
20189
|
+
'emits',
|
|
20190
|
+
'listens',
|
|
20191
|
+
'this',
|
|
20192
|
+
|
|
20193
|
+
// Access
|
|
20194
|
+
'static',
|
|
20195
|
+
'private',
|
|
20196
|
+
'protected',
|
|
20197
|
+
'public',
|
|
20198
|
+
'access',
|
|
20199
|
+
'package',
|
|
20200
|
+
|
|
20201
|
+
'-other',
|
|
20202
|
+
|
|
20203
|
+
// Supplementary descriptions
|
|
20204
|
+
'see',
|
|
20205
|
+
'example',
|
|
20206
|
+
|
|
20207
|
+
// METADATA
|
|
20208
|
+
|
|
20209
|
+
// Other Closure (undocumented) metadata
|
|
20210
|
+
'closurePrimitive',
|
|
20211
|
+
'customElement',
|
|
20212
|
+
'expose',
|
|
20213
|
+
'hidden',
|
|
20214
|
+
'idGenerator',
|
|
20215
|
+
'meaning',
|
|
20216
|
+
'ngInject',
|
|
20217
|
+
'owner',
|
|
20218
|
+
'wizaction',
|
|
20219
|
+
|
|
20220
|
+
// Other Closure (documented) metadata
|
|
20221
|
+
'define',
|
|
20222
|
+
'dict',
|
|
20223
|
+
'export',
|
|
20224
|
+
'externs',
|
|
20225
|
+
'implicitCast',
|
|
20226
|
+
'noalias',
|
|
20227
|
+
'nocollapse',
|
|
20228
|
+
'nocompile',
|
|
20229
|
+
'noinline',
|
|
20230
|
+
'nosideeffects',
|
|
20231
|
+
'polymer',
|
|
20232
|
+
'polymerBehavior',
|
|
20233
|
+
'preserve',
|
|
20234
|
+
'struct',
|
|
20235
|
+
'suppress',
|
|
20236
|
+
'unrestricted',
|
|
20237
|
+
|
|
20238
|
+
// @homer0/prettier-plugin-jsdoc metadata
|
|
20239
|
+
'category',
|
|
20240
|
+
|
|
20241
|
+
// Non-Closure metadata
|
|
20242
|
+
'ignore',
|
|
20243
|
+
'author',
|
|
20244
|
+
'version',
|
|
20245
|
+
'variation',
|
|
20246
|
+
'since',
|
|
20247
|
+
'deprecated',
|
|
20248
|
+
'todo',
|
|
20249
|
+
];
|
|
20250
|
+
```
|
|
20251
|
+
|
|
20252
|
+
<a name="eslint-plugin-jsdoc-rules-sort-tags-options-40-alphabetizeextras"></a>
|
|
20253
|
+
##### <code>alphabetizeExtras</code>
|
|
20254
|
+
|
|
20255
|
+
Defaults to `false`. Alphabetizes any items not within `tagSequence` after any
|
|
20256
|
+
items within `tagSequence` (or in place of the special `-other` pseudo-tag)
|
|
20257
|
+
are sorted.
|
|
20258
|
+
|
|
20259
|
+
|||
|
|
20260
|
+
|---|---|
|
|
20261
|
+
|Context|everywhere|
|
|
20262
|
+
|Tags|any|
|
|
20263
|
+
|Recommended|false|
|
|
20264
|
+
|Settings||
|
|
20265
|
+
|Options|`tagSequence`, `alphabetizeExtras`|
|
|
20266
|
+
|
|
20267
|
+
The following patterns are considered problems:
|
|
20268
|
+
|
|
20269
|
+
````js
|
|
20270
|
+
/**
|
|
20271
|
+
* @returns {string}
|
|
20272
|
+
* @param b
|
|
20273
|
+
* @param a
|
|
20274
|
+
*/
|
|
20275
|
+
function quux () {}
|
|
20276
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20277
|
+
|
|
20278
|
+
/**
|
|
20279
|
+
* Some description
|
|
20280
|
+
* @returns {string}
|
|
20281
|
+
* @param b
|
|
20282
|
+
* @param a
|
|
20283
|
+
*/
|
|
20284
|
+
function quux () {}
|
|
20285
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20286
|
+
|
|
20287
|
+
/**
|
|
20288
|
+
* @returns {string}
|
|
20289
|
+
* @param b A long
|
|
20290
|
+
* description
|
|
20291
|
+
* @param a
|
|
20292
|
+
*/
|
|
20293
|
+
function quux () {}
|
|
20294
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20295
|
+
|
|
20296
|
+
/**
|
|
20297
|
+
* Some description
|
|
20298
|
+
* @returns {string}
|
|
20299
|
+
* @param b A long
|
|
20300
|
+
* description
|
|
20301
|
+
* @param a
|
|
20302
|
+
*/
|
|
20303
|
+
function quux () {}
|
|
20304
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20305
|
+
|
|
20306
|
+
/**
|
|
20307
|
+
* @param b A long
|
|
20308
|
+
* description
|
|
20309
|
+
* @returns {string}
|
|
20310
|
+
* @param a
|
|
20311
|
+
*/
|
|
20312
|
+
function quux () {}
|
|
20313
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20314
|
+
|
|
20315
|
+
/**
|
|
20316
|
+
* @def
|
|
20317
|
+
* @xyz
|
|
20318
|
+
* @abc
|
|
20319
|
+
*/
|
|
20320
|
+
function quux () {}
|
|
20321
|
+
// "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":true}]
|
|
20322
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20323
|
+
|
|
20324
|
+
/**
|
|
20325
|
+
* @xyz
|
|
20326
|
+
* @def
|
|
20327
|
+
* @abc
|
|
20328
|
+
*/
|
|
20329
|
+
function quux () {}
|
|
20330
|
+
// "jsdoc/sort-tags": ["error"|"warn", {"tagSequence":["def","xyz","abc"]}]
|
|
20331
|
+
// Message: Tags are not in the prescribed order: def, xyz, abc
|
|
20332
|
+
|
|
20333
|
+
/**
|
|
20334
|
+
* @returns {string}
|
|
20335
|
+
* @ignore
|
|
20336
|
+
* @param b A long
|
|
20337
|
+
* description
|
|
20338
|
+
* @param a
|
|
20339
|
+
* @module
|
|
20340
|
+
*/
|
|
20341
|
+
function quux () {}
|
|
20342
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20343
|
+
|
|
20344
|
+
/**
|
|
20345
|
+
* @xyz
|
|
20346
|
+
* @abc
|
|
20347
|
+
* @abc
|
|
20348
|
+
* @def
|
|
20349
|
+
* @xyz
|
|
20350
|
+
*/
|
|
20351
|
+
function quux () {}
|
|
20352
|
+
// "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":true}]
|
|
20353
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20354
|
+
|
|
20355
|
+
/**
|
|
20356
|
+
* @param b A long
|
|
20357
|
+
* description
|
|
20358
|
+
* @module
|
|
20359
|
+
*/
|
|
20360
|
+
function quux () {}
|
|
20361
|
+
// Message: Tags are not in the prescribed order: summary, typeSummary, module, exports, file, fileoverview, overview, typedef, interface, record, template, name, kind, type, alias, external, host, callback, func, function, method, class, constructor, modifies, mixes, mixin, mixinClass, mixinFunction, namespace, borrows, constructs, lends, implements, requires, desc, description, classdesc, tutorial, copyright, license, const, constant, final, global, readonly, abstract, virtual, var, member, memberof, memberof!, inner, instance, inheritdoc, inheritDoc, override, hideconstructor, param, arg, argument, prop, property, return, returns, async, generator, default, defaultvalue, enum, augments, extends, throws, exception, yield, yields, event, fires, emits, listens, this, static, private, protected, public, access, package, -other, see, example, closurePrimitive, customElement, expose, hidden, idGenerator, meaning, ngInject, owner, wizaction, define, dict, export, externs, implicitCast, noalias, nocollapse, nocompile, noinline, nosideeffects, polymer, polymerBehavior, preserve, struct, suppress, unrestricted, category, ignore, author, version, variation, since, deprecated, todo
|
|
20362
|
+
````
|
|
20363
|
+
|
|
20364
|
+
The following patterns are not considered problems:
|
|
20365
|
+
|
|
20366
|
+
````js
|
|
20367
|
+
/**
|
|
20368
|
+
* @param b
|
|
20369
|
+
* @param a
|
|
20370
|
+
* @returns {string}
|
|
20371
|
+
*/
|
|
20372
|
+
function quux () {}
|
|
20373
|
+
|
|
20374
|
+
/**
|
|
20375
|
+
* @abc
|
|
20376
|
+
* @def
|
|
20377
|
+
* @xyz
|
|
20378
|
+
*/
|
|
20379
|
+
function quux () {}
|
|
20380
|
+
// "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":true}]
|
|
20381
|
+
|
|
20382
|
+
/**
|
|
20383
|
+
* @def
|
|
20384
|
+
* @xyz
|
|
20385
|
+
* @abc
|
|
20386
|
+
*/
|
|
20387
|
+
function quux () {}
|
|
20388
|
+
// "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":false}]
|
|
20389
|
+
|
|
20390
|
+
/**
|
|
20391
|
+
* @def
|
|
20392
|
+
* @xyz
|
|
20393
|
+
* @abc
|
|
20394
|
+
*/
|
|
20395
|
+
function quux () {}
|
|
20396
|
+
// "jsdoc/sort-tags": ["error"|"warn", {"tagSequence":["def","xyz","abc"]}]
|
|
20397
|
+
|
|
20398
|
+
/** @def */
|
|
20399
|
+
function quux () {}
|
|
20400
|
+
````
|
|
20401
|
+
|
|
20402
|
+
|
|
20012
20403
|
<a name="eslint-plugin-jsdoc-rules-tag-lines"></a>
|
|
20013
20404
|
### <code>tag-lines</code>
|
|
20014
20405
|
|
|
20015
20406
|
Enforces lines (or no lines) between tags.
|
|
20016
20407
|
|
|
20017
|
-
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-
|
|
20408
|
+
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-41"></a>
|
|
20018
20409
|
#### Options
|
|
20019
20410
|
|
|
20020
20411
|
The first option is a single string set to "always", "never", or "any"
|
|
@@ -20025,18 +20416,18 @@ for particular tags).
|
|
|
20025
20416
|
|
|
20026
20417
|
The second option is an object with the following optional properties.
|
|
20027
20418
|
|
|
20028
|
-
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-
|
|
20419
|
+
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-count-defaults-to-1"></a>
|
|
20029
20420
|
##### <code>count</code> (defaults to 1)
|
|
20030
20421
|
|
|
20031
20422
|
Use with "always" to indicate the number of lines to require be present.
|
|
20032
20423
|
|
|
20033
|
-
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-
|
|
20424
|
+
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-noendlines-defaults-to-false"></a>
|
|
20034
20425
|
##### <code>noEndLines</code> (defaults to <code>false</code>)
|
|
20035
20426
|
|
|
20036
20427
|
Use with "always" to indicate the normal lines to be added after tags should
|
|
20037
20428
|
not be added after the final tag.
|
|
20038
20429
|
|
|
20039
|
-
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-
|
|
20430
|
+
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-tags-default-to-empty-object"></a>
|
|
20040
20431
|
##### <code>tags</code> (default to empty object)
|
|
20041
20432
|
|
|
20042
20433
|
Overrides the default behavior depending on specific tags.
|
|
@@ -20432,7 +20823,7 @@ for valid types (based on the tag's `type` value), and either portion checked
|
|
|
20432
20823
|
for presence (based on `false` `name` or `type` values or their `required`
|
|
20433
20824
|
value). See the setting for more details.
|
|
20434
20825
|
|
|
20435
|
-
<a name="eslint-plugin-jsdoc-rules-valid-types-options-
|
|
20826
|
+
<a name="eslint-plugin-jsdoc-rules-valid-types-options-42"></a>
|
|
20436
20827
|
#### Options
|
|
20437
20828
|
|
|
20438
20829
|
- `allowEmptyNamepaths` (default: true) - Set to `false` to bulk disallow
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const defaultTagOrder = [// Brief descriptions
|
|
8
|
+
'summary', 'typeSummary', // Module/file-level
|
|
9
|
+
'module', 'exports', 'file', 'fileoverview', 'overview', // Identifying (name, type)
|
|
10
|
+
'typedef', 'interface', 'record', 'template', 'name', 'kind', 'type', 'alias', 'external', 'host', 'callback', 'func', 'function', 'method', 'class', 'constructor', // Relationships
|
|
11
|
+
'modifies', 'mixes', 'mixin', 'mixinClass', 'mixinFunction', 'namespace', 'borrows', 'constructs', 'lends', 'implements', 'requires', // Long descriptions
|
|
12
|
+
'desc', 'description', 'classdesc', 'tutorial', 'copyright', 'license', // Simple annotations
|
|
13
|
+
'const', 'constant', 'final', 'global', 'readonly', 'abstract', 'virtual', 'var', 'member', 'memberof', 'memberof!', 'inner', 'instance', 'inheritdoc', 'inheritDoc', 'override', 'hideconstructor', // Core function/object info
|
|
14
|
+
'param', 'arg', 'argument', 'prop', 'property', 'return', 'returns', // Important behavior details
|
|
15
|
+
'async', 'generator', 'default', 'defaultvalue', 'enum', 'augments', 'extends', 'throws', 'exception', 'yield', 'yields', 'event', 'fires', 'emits', 'listens', 'this', // Access
|
|
16
|
+
'static', 'private', 'protected', 'public', 'access', 'package', '-other', // Supplementary descriptions
|
|
17
|
+
'see', 'example', // METADATA
|
|
18
|
+
// Other Closure (undocumented) metadata
|
|
19
|
+
'closurePrimitive', 'customElement', 'expose', 'hidden', 'idGenerator', 'meaning', 'ngInject', 'owner', 'wizaction', // Other Closure (documented) metadata
|
|
20
|
+
'define', 'dict', 'export', 'externs', 'implicitCast', 'noalias', 'nocollapse', 'nocompile', 'noinline', 'nosideeffects', 'polymer', 'polymerBehavior', 'preserve', 'struct', 'suppress', 'unrestricted', // @homer0/prettier-plugin-jsdoc metadata
|
|
21
|
+
'category', // Non-Closure metadata
|
|
22
|
+
'ignore', 'author', 'version', 'variation', 'since', 'deprecated', 'todo'];
|
|
23
|
+
var _default = defaultTagOrder;
|
|
24
|
+
exports.default = _default;
|
|
25
|
+
module.exports = exports.default;
|
|
26
|
+
//# sourceMappingURL=defaultTagOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/defaultTagOrder.js"],"names":["defaultTagOrder"],"mappings":";;;;;;AAAA,MAAMA,eAAe,GAAG,CACtB;AACA,SAFsB,EAGtB,aAHsB,EAKtB;AACA,QANsB,EAOtB,SAPsB,EAQtB,MARsB,EAStB,cATsB,EAUtB,UAVsB,EAYtB;AACA,SAbsB,EActB,WAdsB,EAetB,QAfsB,EAgBtB,UAhBsB,EAiBtB,MAjBsB,EAkBtB,MAlBsB,EAmBtB,MAnBsB,EAoBtB,OApBsB,EAqBtB,UArBsB,EAsBtB,MAtBsB,EAuBtB,UAvBsB,EAwBtB,MAxBsB,EAyBtB,UAzBsB,EA0BtB,QA1BsB,EA2BtB,OA3BsB,EA4BtB,aA5BsB,EA8BtB;AACA,UA/BsB,EAgCtB,OAhCsB,EAiCtB,OAjCsB,EAkCtB,YAlCsB,EAmCtB,eAnCsB,EAoCtB,WApCsB,EAqCtB,SArCsB,EAsCtB,YAtCsB,EAuCtB,OAvCsB,EAwCtB,YAxCsB,EAyCtB,UAzCsB,EA2CtB;AACA,MA5CsB,EA6CtB,aA7CsB,EA8CtB,WA9CsB,EA+CtB,UA/CsB,EAgDtB,WAhDsB,EAiDtB,SAjDsB,EAmDtB;AACA,OApDsB,EAqDtB,UArDsB,EAsDtB,OAtDsB,EAuDtB,QAvDsB,EAwDtB,UAxDsB,EAyDtB,UAzDsB,EA0DtB,SA1DsB,EA2DtB,KA3DsB,EA4DtB,QA5DsB,EA6DtB,UA7DsB,EA8DtB,WA9DsB,EA+DtB,OA/DsB,EAgEtB,UAhEsB,EAiEtB,YAjEsB,EAkEtB,YAlEsB,EAmEtB,UAnEsB,EAoEtB,iBApEsB,EAsEtB;AACA,OAvEsB,EAwEtB,KAxEsB,EAyEtB,UAzEsB,EA0EtB,MA1EsB,EA2EtB,UA3EsB,EA4EtB,QA5EsB,EA6EtB,SA7EsB,EA+EtB;AACA,OAhFsB,EAiFtB,WAjFsB,EAkFtB,SAlFsB,EAmFtB,cAnFsB,EAoFtB,MApFsB,EAqFtB,UArFsB,EAsFtB,SAtFsB,EAuFtB,QAvFsB,EAwFtB,WAxFsB,EAyFtB,OAzFsB,EA0FtB,QA1FsB,EA2FtB,OA3FsB,EA4FtB,OA5FsB,EA6FtB,OA7FsB,EA8FtB,SA9FsB,EA+FtB,MA/FsB,EAiGtB;AACA,QAlGsB,EAmGtB,SAnGsB,EAoGtB,WApGsB,EAqGtB,QArGsB,EAsGtB,QAtGsB,EAuGtB,SAvGsB,EAyGtB,QAzGsB,EA2GtB;AACA,KA5GsB,EA6GtB,SA7GsB,EA+GtB;AAEA;AACA,kBAlHsB,EAmHtB,eAnHsB,EAoHtB,QApHsB,EAqHtB,QArHsB,EAsHtB,aAtHsB,EAuHtB,SAvHsB,EAwHtB,UAxHsB,EAyHtB,OAzHsB,EA0HtB,WA1HsB,EA4HtB;AACA,QA7HsB,EA8HtB,MA9HsB,EA+HtB,QA/HsB,EAgItB,SAhIsB,EAiItB,cAjIsB,EAkItB,SAlIsB,EAmItB,YAnIsB,EAoItB,WApIsB,EAqItB,UArIsB,EAsItB,eAtIsB,EAuItB,SAvIsB,EAwItB,iBAxIsB,EAyItB,UAzIsB,EA0ItB,QA1IsB,EA2ItB,UA3IsB,EA4ItB,cA5IsB,EA8ItB;AACA,UA/IsB,EAiJtB;AACA,QAlJsB,EAmJtB,QAnJsB,EAoJtB,SApJsB,EAqJtB,WArJsB,EAsJtB,OAtJsB,EAuJtB,YAvJsB,EAwJtB,MAxJsB,CAAxB;eA2JeA,e","sourcesContent":["const defaultTagOrder = [\n // Brief descriptions\n 'summary',\n 'typeSummary',\n\n // Module/file-level\n 'module',\n 'exports',\n 'file',\n 'fileoverview',\n 'overview',\n\n // Identifying (name, type)\n 'typedef',\n 'interface',\n 'record',\n 'template',\n 'name',\n 'kind',\n 'type',\n 'alias',\n 'external',\n 'host',\n 'callback',\n 'func',\n 'function',\n 'method',\n 'class',\n 'constructor',\n\n // Relationships\n 'modifies',\n 'mixes',\n 'mixin',\n 'mixinClass',\n 'mixinFunction',\n 'namespace',\n 'borrows',\n 'constructs',\n 'lends',\n 'implements',\n 'requires',\n\n // Long descriptions\n 'desc',\n 'description',\n 'classdesc',\n 'tutorial',\n 'copyright',\n 'license',\n\n // Simple annotations\n 'const',\n 'constant',\n 'final',\n 'global',\n 'readonly',\n 'abstract',\n 'virtual',\n 'var',\n 'member',\n 'memberof',\n 'memberof!',\n 'inner',\n 'instance',\n 'inheritdoc',\n 'inheritDoc',\n 'override',\n 'hideconstructor',\n\n // Core function/object info\n 'param',\n 'arg',\n 'argument',\n 'prop',\n 'property',\n 'return',\n 'returns',\n\n // Important behavior details\n 'async',\n 'generator',\n 'default',\n 'defaultvalue',\n 'enum',\n 'augments',\n 'extends',\n 'throws',\n 'exception',\n 'yield',\n 'yields',\n 'event',\n 'fires',\n 'emits',\n 'listens',\n 'this',\n\n // Access\n 'static',\n 'private',\n 'protected',\n 'public',\n 'access',\n 'package',\n\n '-other',\n\n // Supplementary descriptions\n 'see',\n 'example',\n\n // METADATA\n\n // Other Closure (undocumented) metadata\n 'closurePrimitive',\n 'customElement',\n 'expose',\n 'hidden',\n 'idGenerator',\n 'meaning',\n 'ngInject',\n 'owner',\n 'wizaction',\n\n // Other Closure (documented) metadata\n 'define',\n 'dict',\n 'export',\n 'externs',\n 'implicitCast',\n 'noalias',\n 'nocollapse',\n 'nocompile',\n 'noinline',\n 'nosideeffects',\n 'polymer',\n 'polymerBehavior',\n 'preserve',\n 'struct',\n 'suppress',\n 'unrestricted',\n\n // @homer0/prettier-plugin-jsdoc metadata\n 'category',\n\n // Non-Closure metadata\n 'ignore',\n 'author',\n 'version',\n 'variation',\n 'since',\n 'deprecated',\n 'todo',\n];\n\nexport default defaultTagOrder;\n"],"file":"defaultTagOrder.js"}
|
|
@@ -10,6 +10,7 @@ const getDefaultTagStructureForMode = mode => {
|
|
|
10
10
|
const isClosure = mode === 'closure';
|
|
11
11
|
const isTypescript = mode === 'typescript';
|
|
12
12
|
const isPermissive = mode === 'permissive';
|
|
13
|
+
const isJsdocOrPermissive = isJsdoc || isPermissive;
|
|
13
14
|
const isJsdocOrTypescript = isJsdoc || isTypescript;
|
|
14
15
|
const isTypescriptOrClosure = isTypescript || isClosure;
|
|
15
16
|
const isClosureOrPermissive = isClosure || isPermissive;
|
|
@@ -53,7 +54,8 @@ const getDefaultTagStructureForMode = mode => {
|
|
|
53
54
|
// seems to require both, and as "namepath"'s
|
|
54
55
|
['nameContents', 'namepath-referencing'], // "namepath"
|
|
55
56
|
['typeOrNameRequired', true]])], ['callback', new Map([// Seems to require a "namepath" in the signature (with no
|
|
56
|
-
// counter-examples)
|
|
57
|
+
// counter-examples); TypeScript does not enforce but seems
|
|
58
|
+
// problematic as not attached so presumably not useable without it
|
|
57
59
|
['nameContents', 'namepath-defining'], // "namepath"
|
|
58
60
|
['nameRequired', true]])], ['class', new Map([// Allows for "name"'s in signature, but indicated as optional
|
|
59
61
|
['nameContents', 'namepath-defining'], ['typeAllowed', true]])], ['const', new Map([// Allows for "name"'s in signature, but indicated as optional
|
|
@@ -151,10 +153,15 @@ const getDefaultTagStructureForMode = mode => {
|
|
|
151
153
|
// "typeName"
|
|
152
154
|
['typeRequired', true]])], ['typedef', new Map([// Seems to require a "namepath" in the signature (with no
|
|
153
155
|
// counter-examples)
|
|
154
|
-
['nameContents', 'namepath-defining'], //
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
['
|
|
156
|
+
['nameContents', 'namepath-defining'], // TypeScript may allow it to be dropped if followed by @property or @member;
|
|
157
|
+
// also shown as missing in Closure
|
|
158
|
+
// "namepath"
|
|
159
|
+
['nameRequired', isJsdocOrPermissive], // Is not `typeRequired` for TypeScript because it gives an error:
|
|
160
|
+
// JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.
|
|
161
|
+
// Has example showing curly brackets but not in doc signature
|
|
162
|
+
['typeAllowed', true], // TypeScript may allow it to be dropped if followed by @property or @member
|
|
163
|
+
// "namepath"
|
|
164
|
+
['typeOrNameRequired', !isTypescript]])], ['var', new Map([// Allows for "name"'s in signature, but indicated as optional
|
|
158
165
|
['nameContents', 'namepath-defining'], // Has example showing curly brackets but not in doc signature
|
|
159
166
|
['typeAllowed', true]])], ['yields', new Map([// Shows curly brackets in the signature and in the examples
|
|
160
167
|
['typeAllowed', true]])], ['yield', new Map([// Shows curly brackets in the signature and in the examples
|