eslint-plugin-jsdoc 37.6.2 → 37.8.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.
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 string Object has prototypes for string functions such as
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 object
4816
- Objects. But object literals are still static Objects and object Objects are
4817
- instantiated Objects. So an object primitive is still an object Object.
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 this Object we lower-case to indicate possible support for
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
@@ -5438,6 +5450,48 @@ function b () {}
5438
5450
  */
5439
5451
  // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
5440
5452
  // Message: Invalid JSDoc @aCustomTag "foo" type "Number"; prefer: ["otherType","anotherType"].
5453
+
5454
+ /**
5455
+ * @param {Object[]} foo
5456
+ */
5457
+ function quux (foo) {
5458
+
5459
+ }
5460
+ // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object"}}}
5461
+ // Message: Invalid JSDoc @param "foo" type "Object"; prefer: "object".
5462
+
5463
+ /**
5464
+ * @param {object.<string>} foo
5465
+ */
5466
+ function quux (foo) {
5467
+
5468
+ }
5469
+ // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object.<>":"Object"}}}
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<>".
5441
5495
  ````
5442
5496
 
5443
5497
  The following patterns are not considered problems:
@@ -5725,6 +5779,26 @@ function b () {}
5725
5779
  function quux (foo) {
5726
5780
 
5727
5781
  }
5782
+
5783
+ /**
5784
+ * @param {Object.<string>} foo
5785
+ */
5786
+ function quux (foo) {
5787
+
5788
+ }
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<>"}}}
5728
5802
  ````
5729
5803
 
5730
5804
 
@@ -9100,6 +9174,13 @@ const MY_ENUM = Object.freeze({
9100
9174
  } as const);
9101
9175
  // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag ~ JsdocTag[tag=/private|protected/])","context":"any","message":"Access modifier tags must come first"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"enum\"])","context":":declaration","message":"@enum not allowed on declarations"}]}]
9102
9176
  // Message: @enum not allowed on declarations
9177
+
9178
+ /** @type {React.FunctionComponent<{ children: React.ReactNode }>}*/
9179
+ const MyComponent = ({ children }) => {
9180
+ return children;
9181
+ }
9182
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[tag=\"type\"]:has([value=/FunctionComponent/]))","context":"any","message":"The `FunctionComponent` type is not allowed. Please use `FC` instead."}]}]
9183
+ // Message: The `FunctionComponent` type is not allowed. Please use `FC` instead.
9103
9184
  ````
9104
9185
 
9105
9186
  The following patterns are not considered problems:
@@ -19976,12 +20057,349 @@ function * quux (foo) {
19976
20057
  ````
19977
20058
 
19978
20059
 
20060
+ <a name="eslint-plugin-jsdoc-rules-sort-tags"></a>
20061
+ ### <code>sort-tags</code>
20062
+
20063
+ Sorts tags by a specified sequence according to tag name.
20064
+
20065
+ (Default order originally inspired by [`@homer0/prettier-plugin-jsdoc`](https://github.com/homer0/packages/tree/main/packages/public/prettier-plugin-jsdoc).)
20066
+
20067
+ <a name="eslint-plugin-jsdoc-rules-sort-tags-options-40"></a>
20068
+ #### Options
20069
+
20070
+ <a name="eslint-plugin-jsdoc-rules-sort-tags-options-40-tagsequence"></a>
20071
+ ##### <code>tagSequence</code>
20072
+
20073
+ An array of tag names indicating the preferred sequence for sorting tags.
20074
+
20075
+ Tag names earlier in the list will be arranged first. The relative position of
20076
+ tags of the same name will not be changed.
20077
+
20078
+ Tags not in the list will be sorted alphabetically at the end (or in place of
20079
+ the pseudo-tag `-other` placed within `tagSequence`) if `alphabetizeExtras` is
20080
+ enabled and in their order of appearance otherwise (so if you want all your
20081
+ tags alphabetized, supply an empty array with `alphabetizeExtras` enabled).
20082
+
20083
+ Defaults to the array below.
20084
+
20085
+ Please note that this order is still experimental, so if you want to retain
20086
+ a fixed order that doesn't change into the future, supply your own
20087
+ `tagSequence`.
20088
+
20089
+ ```js
20090
+ [
20091
+ // Brief descriptions
20092
+ 'summary',
20093
+ 'typeSummary',
20094
+
20095
+ // Module/file-level
20096
+ 'module',
20097
+ 'exports',
20098
+ 'file',
20099
+ 'fileoverview',
20100
+ 'overview',
20101
+
20102
+ // Identifying (name, type)
20103
+ 'typedef',
20104
+ 'interface',
20105
+ 'record',
20106
+ 'template',
20107
+ 'name',
20108
+ 'kind',
20109
+ 'type',
20110
+ 'alias',
20111
+ 'external',
20112
+ 'host',
20113
+ 'callback',
20114
+ 'func',
20115
+ 'function',
20116
+ 'method',
20117
+ 'class',
20118
+ 'constructor',
20119
+
20120
+ // Relationships
20121
+ 'modifies',
20122
+ 'mixes',
20123
+ 'mixin',
20124
+ 'mixinClass',
20125
+ 'mixinFunction',
20126
+ 'namespace',
20127
+ 'borrows',
20128
+ 'constructs',
20129
+ 'lends',
20130
+ 'implements',
20131
+ 'requires',
20132
+
20133
+ // Long descriptions
20134
+ 'desc',
20135
+ 'description',
20136
+ 'classdesc',
20137
+ 'tutorial',
20138
+ 'copyright',
20139
+ 'license',
20140
+
20141
+ // Simple annotations
20142
+ 'const',
20143
+ 'constant',
20144
+ 'final',
20145
+ 'global',
20146
+ 'readonly',
20147
+ 'abstract',
20148
+ 'virtual',
20149
+ 'var',
20150
+ 'member',
20151
+ 'memberof',
20152
+ 'memberof!',
20153
+ 'inner',
20154
+ 'instance',
20155
+ 'inheritdoc',
20156
+ 'inheritDoc',
20157
+ 'override',
20158
+ 'hideconstructor',
20159
+
20160
+ // Core function/object info
20161
+ 'param',
20162
+ 'arg',
20163
+ 'argument',
20164
+ 'prop',
20165
+ 'property',
20166
+ 'return',
20167
+ 'returns',
20168
+
20169
+ // Important behavior details
20170
+ 'async',
20171
+ 'generator',
20172
+ 'default',
20173
+ 'defaultvalue',
20174
+ 'enum',
20175
+ 'augments',
20176
+ 'extends',
20177
+ 'throws',
20178
+ 'exception',
20179
+ 'yield',
20180
+ 'yields',
20181
+ 'event',
20182
+ 'fires',
20183
+ 'emits',
20184
+ 'listens',
20185
+ 'this',
20186
+
20187
+ // Access
20188
+ 'static',
20189
+ 'private',
20190
+ 'protected',
20191
+ 'public',
20192
+ 'access',
20193
+ 'package',
20194
+
20195
+ '-other',
20196
+
20197
+ // Supplementary descriptions
20198
+ 'see',
20199
+ 'example',
20200
+
20201
+ // METADATA
20202
+
20203
+ // Other Closure (undocumented) metadata
20204
+ 'closurePrimitive',
20205
+ 'customElement',
20206
+ 'expose',
20207
+ 'hidden',
20208
+ 'idGenerator',
20209
+ 'meaning',
20210
+ 'ngInject',
20211
+ 'owner',
20212
+ 'wizaction',
20213
+
20214
+ // Other Closure (documented) metadata
20215
+ 'define',
20216
+ 'dict',
20217
+ 'export',
20218
+ 'externs',
20219
+ 'implicitCast',
20220
+ 'noalias',
20221
+ 'nocollapse',
20222
+ 'nocompile',
20223
+ 'noinline',
20224
+ 'nosideeffects',
20225
+ 'polymer',
20226
+ 'polymerBehavior',
20227
+ 'preserve',
20228
+ 'struct',
20229
+ 'suppress',
20230
+ 'unrestricted',
20231
+
20232
+ // @homer0/prettier-plugin-jsdoc metadata
20233
+ 'category',
20234
+
20235
+ // Non-Closure metadata
20236
+ 'ignore',
20237
+ 'author',
20238
+ 'version',
20239
+ 'variation',
20240
+ 'since',
20241
+ 'deprecated',
20242
+ 'todo',
20243
+ ];
20244
+ ```
20245
+
20246
+ <a name="eslint-plugin-jsdoc-rules-sort-tags-options-40-alphabetizeextras"></a>
20247
+ ##### <code>alphabetizeExtras</code>
20248
+
20249
+ Defaults to `false`. Alphabetizes any items not within `tagSequence` after any
20250
+ items within `tagSequence` (or in place of the special `-other` pseudo-tag)
20251
+ are sorted.
20252
+
20253
+ |||
20254
+ |---|---|
20255
+ |Context|everywhere|
20256
+ |Tags|any|
20257
+ |Recommended|false|
20258
+ |Settings||
20259
+ |Options|`tagSequence`, `alphabetizeExtras`|
20260
+
20261
+ The following patterns are considered problems:
20262
+
20263
+ ````js
20264
+ /**
20265
+ * @returns {string}
20266
+ * @param b
20267
+ * @param a
20268
+ */
20269
+ function quux () {}
20270
+ // 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
20271
+
20272
+ /**
20273
+ * Some description
20274
+ * @returns {string}
20275
+ * @param b
20276
+ * @param a
20277
+ */
20278
+ function quux () {}
20279
+ // 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
20280
+
20281
+ /**
20282
+ * @returns {string}
20283
+ * @param b A long
20284
+ * description
20285
+ * @param a
20286
+ */
20287
+ function quux () {}
20288
+ // 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
20289
+
20290
+ /**
20291
+ * Some description
20292
+ * @returns {string}
20293
+ * @param b A long
20294
+ * description
20295
+ * @param a
20296
+ */
20297
+ function quux () {}
20298
+ // 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
20299
+
20300
+ /**
20301
+ * @param b A long
20302
+ * description
20303
+ * @returns {string}
20304
+ * @param a
20305
+ */
20306
+ function quux () {}
20307
+ // 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
20308
+
20309
+ /**
20310
+ * @def
20311
+ * @xyz
20312
+ * @abc
20313
+ */
20314
+ function quux () {}
20315
+ // "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":true}]
20316
+ // 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
20317
+
20318
+ /**
20319
+ * @xyz
20320
+ * @def
20321
+ * @abc
20322
+ */
20323
+ function quux () {}
20324
+ // "jsdoc/sort-tags": ["error"|"warn", {"tagSequence":["def","xyz","abc"]}]
20325
+ // Message: Tags are not in the prescribed order: def, xyz, abc
20326
+
20327
+ /**
20328
+ * @returns {string}
20329
+ * @ignore
20330
+ * @param b A long
20331
+ * description
20332
+ * @param a
20333
+ * @module
20334
+ */
20335
+ function quux () {}
20336
+ // 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
20337
+
20338
+ /**
20339
+ * @xyz
20340
+ * @abc
20341
+ * @abc
20342
+ * @def
20343
+ * @xyz
20344
+ */
20345
+ function quux () {}
20346
+ // "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":true}]
20347
+ // 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
20348
+
20349
+ /**
20350
+ * @param b A long
20351
+ * description
20352
+ * @module
20353
+ */
20354
+ function quux () {}
20355
+ // 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
20356
+ ````
20357
+
20358
+ The following patterns are not considered problems:
20359
+
20360
+ ````js
20361
+ /**
20362
+ * @param b
20363
+ * @param a
20364
+ * @returns {string}
20365
+ */
20366
+ function quux () {}
20367
+
20368
+ /**
20369
+ * @abc
20370
+ * @def
20371
+ * @xyz
20372
+ */
20373
+ function quux () {}
20374
+ // "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":true}]
20375
+
20376
+ /**
20377
+ * @def
20378
+ * @xyz
20379
+ * @abc
20380
+ */
20381
+ function quux () {}
20382
+ // "jsdoc/sort-tags": ["error"|"warn", {"alphabetizeExtras":false}]
20383
+
20384
+ /**
20385
+ * @def
20386
+ * @xyz
20387
+ * @abc
20388
+ */
20389
+ function quux () {}
20390
+ // "jsdoc/sort-tags": ["error"|"warn", {"tagSequence":["def","xyz","abc"]}]
20391
+
20392
+ /** @def */
20393
+ function quux () {}
20394
+ ````
20395
+
20396
+
19979
20397
  <a name="eslint-plugin-jsdoc-rules-tag-lines"></a>
19980
20398
  ### <code>tag-lines</code>
19981
20399
 
19982
20400
  Enforces lines (or no lines) between tags.
19983
20401
 
19984
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40"></a>
20402
+ <a name="eslint-plugin-jsdoc-rules-tag-lines-options-41"></a>
19985
20403
  #### Options
19986
20404
 
19987
20405
  The first option is a single string set to "always", "never", or "any"
@@ -19992,18 +20410,18 @@ for particular tags).
19992
20410
 
19993
20411
  The second option is an object with the following optional properties.
19994
20412
 
19995
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40-count-defaults-to-1"></a>
20413
+ <a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-count-defaults-to-1"></a>
19996
20414
  ##### <code>count</code> (defaults to 1)
19997
20415
 
19998
20416
  Use with "always" to indicate the number of lines to require be present.
19999
20417
 
20000
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40-noendlines-defaults-to-false"></a>
20418
+ <a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-noendlines-defaults-to-false"></a>
20001
20419
  ##### <code>noEndLines</code> (defaults to <code>false</code>)
20002
20420
 
20003
20421
  Use with "always" to indicate the normal lines to be added after tags should
20004
20422
  not be added after the final tag.
20005
20423
 
20006
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40-tags-default-to-empty-object"></a>
20424
+ <a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-tags-default-to-empty-object"></a>
20007
20425
  ##### <code>tags</code> (default to empty object)
20008
20426
 
20009
20427
  Overrides the default behavior depending on specific tags.
@@ -20399,7 +20817,7 @@ for valid types (based on the tag's `type` value), and either portion checked
20399
20817
  for presence (based on `false` `name` or `type` values or their `required`
20400
20818
  value). See the setting for more details.
20401
20819
 
20402
- <a name="eslint-plugin-jsdoc-rules-valid-types-options-41"></a>
20820
+ <a name="eslint-plugin-jsdoc-rules-valid-types-options-42"></a>
20403
20821
  #### Options
20404
20822
 
20405
20823
  - `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"}
package/dist/index.js CHANGED
@@ -97,6 +97,8 @@ var _requireYields = _interopRequireDefault(require("./rules/requireYields"));
97
97
 
98
98
  var _requireYieldsCheck = _interopRequireDefault(require("./rules/requireYieldsCheck"));
99
99
 
100
+ var _sortTags = _interopRequireDefault(require("./rules/sortTags"));
101
+
100
102
  var _tagLines = _interopRequireDefault(require("./rules/tagLines"));
101
103
 
102
104
  var _validTypes = _interopRequireDefault(require("./rules/validTypes"));
@@ -154,6 +156,7 @@ var _default = {
154
156
  'jsdoc/require-throws': 'off',
155
157
  'jsdoc/require-yields': 'warn',
156
158
  'jsdoc/require-yields-check': 'warn',
159
+ 'jsdoc/sort-tags': 'off',
157
160
  'jsdoc/tag-lines': 'warn',
158
161
  'jsdoc/valid-types': 'warn'
159
162
  }
@@ -206,6 +209,7 @@ var _default = {
206
209
  'require-throws': _requireThrows.default,
207
210
  'require-yields': _requireYields.default,
208
211
  'require-yields-check': _requireYieldsCheck.default,
212
+ 'sort-tags': _sortTags.default,
209
213
  'tag-lines': _tagLines.default,
210
214
  'valid-types': _validTypes.default
211
215
  }