eslint-plugin-jsdoc 60.4.1 → 60.6.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 (96) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/iterateJsdoc.d.ts +5 -0
  3. package/dist/cjs/jsdocUtils.d.ts +19 -2
  4. package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
  5. package/dist/generateDocs.cjs +5 -6
  6. package/dist/generateDocs.cjs.map +1 -1
  7. package/dist/index-cjs.cjs +14 -1
  8. package/dist/index-cjs.cjs.map +1 -1
  9. package/dist/index-esm.cjs +0 -2
  10. package/dist/index-esm.cjs.map +1 -1
  11. package/dist/index.cjs +14 -3
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/iterateJsdoc.cjs +12 -0
  14. package/dist/iterateJsdoc.cjs.map +1 -1
  15. package/dist/iterateJsdoc.d.ts +5 -0
  16. package/dist/jsdocUtils.cjs +21 -17
  17. package/dist/jsdocUtils.cjs.map +1 -1
  18. package/dist/jsdocUtils.d.ts +19 -2
  19. package/dist/rules/checkLineAlignment.cjs +1 -2
  20. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  21. package/dist/rules/checkTagNames.cjs +16 -0
  22. package/dist/rules/checkTagNames.cjs.map +1 -1
  23. package/dist/rules/convertToJsdocComments.cjs +2 -4
  24. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  25. package/dist/rules/emptyTags.cjs +1 -2
  26. package/dist/rules/emptyTags.cjs.map +1 -1
  27. package/dist/rules/escapeInlineTags.cjs +149 -0
  28. package/dist/rules/escapeInlineTags.cjs.map +1 -0
  29. package/dist/rules/escapeInlineTags.d.ts +3 -0
  30. package/dist/rules/informativeDocs.cjs +3 -6
  31. package/dist/rules/informativeDocs.cjs.map +1 -1
  32. package/dist/rules/linesBeforeBlock.cjs +4 -8
  33. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  34. package/dist/rules/matchDescription.cjs +2 -4
  35. package/dist/rules/matchDescription.cjs.map +1 -1
  36. package/dist/rules/matchName.cjs +1 -2
  37. package/dist/rules/matchName.cjs.map +1 -1
  38. package/dist/rules/multilineBlocks.cjs +3 -6
  39. package/dist/rules/multilineBlocks.cjs.map +1 -1
  40. package/dist/rules/noBadBlocks.cjs +1 -2
  41. package/dist/rules/noBadBlocks.cjs.map +1 -1
  42. package/dist/rules/noTypes.cjs +1 -2
  43. package/dist/rules/noTypes.cjs.map +1 -1
  44. package/dist/rules/noUndefinedTypes.cjs +1 -1
  45. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  46. package/dist/rules/requireAsteriskPrefix.cjs +1 -2
  47. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  48. package/dist/rules/requireDescriptionCompleteSentence.cjs +1 -2
  49. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  50. package/dist/rules/requireFileOverview.cjs +1 -3
  51. package/dist/rules/requireFileOverview.cjs.map +1 -1
  52. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -2
  53. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  54. package/dist/rules/requireJsdoc.cjs +3 -6
  55. package/dist/rules/requireJsdoc.cjs.map +1 -1
  56. package/dist/rules/requireParam.cjs +6 -12
  57. package/dist/rules/requireParam.cjs.map +1 -1
  58. package/dist/rules/requireParamName.cjs +1 -2
  59. package/dist/rules/requireParamName.cjs.map +1 -1
  60. package/dist/rules/requireReturns.cjs +1 -2
  61. package/dist/rules/requireReturns.cjs.map +1 -1
  62. package/dist/rules/requireTemplate.cjs +1 -2
  63. package/dist/rules/requireTemplate.cjs.map +1 -1
  64. package/dist/rules/sortTags.cjs +1 -2
  65. package/dist/rules/sortTags.cjs.map +1 -1
  66. package/dist/rules.d.ts +34 -37
  67. package/package.json +11 -11
  68. package/src/index-cjs.js +16 -0
  69. package/src/index-esm.js +0 -2
  70. package/src/index.js +16 -2
  71. package/src/iterateJsdoc.js +13 -0
  72. package/src/jsdocUtils.js +22 -17
  73. package/src/rules/checkLineAlignment.js +1 -2
  74. package/src/rules/checkTagNames.js +19 -0
  75. package/src/rules/convertToJsdocComments.js +2 -4
  76. package/src/rules/emptyTags.js +1 -2
  77. package/src/rules/escapeInlineTags.js +189 -0
  78. package/src/rules/informativeDocs.js +3 -6
  79. package/src/rules/linesBeforeBlock.js +4 -8
  80. package/src/rules/matchDescription.js +2 -4
  81. package/src/rules/matchName.js +1 -2
  82. package/src/rules/multilineBlocks.js +3 -6
  83. package/src/rules/noBadBlocks.js +1 -2
  84. package/src/rules/noTypes.js +1 -2
  85. package/src/rules/noUndefinedTypes.js +7 -1
  86. package/src/rules/requireAsteriskPrefix.js +1 -2
  87. package/src/rules/requireDescriptionCompleteSentence.js +1 -2
  88. package/src/rules/requireFileOverview.js +1 -3
  89. package/src/rules/requireHyphenBeforeParamDescription.js +1 -2
  90. package/src/rules/requireJsdoc.js +3 -6
  91. package/src/rules/requireParam.js +6 -12
  92. package/src/rules/requireParamName.js +1 -2
  93. package/src/rules/requireReturns.js +1 -2
  94. package/src/rules/requireTemplate.js +1 -2
  95. package/src/rules/sortTags.js +1 -2
  96. package/src/rules.d.ts +34 -37
package/src/rules.d.ts CHANGED
@@ -82,7 +82,6 @@ export interface Rules {
82
82
  /**
83
83
  * An object with any of the following spacing keys set to an integer.
84
84
  * If a spacing is not defined, it defaults to one.
85
- *
86
85
  */
87
86
  customSpacings?: {
88
87
  /**
@@ -261,6 +260,12 @@ export interface Rules {
261
260
  * Set to `false` to disable auto-removal of types that are redundant with the [`typed` option](#typed).
262
261
  */
263
262
  enableFixer?: boolean;
263
+ /**
264
+ * List of tags to allow inline.
265
+ *
266
+ * Defaults to array of `'link', 'linkcode', 'linkplain', 'tutorial'`
267
+ */
268
+ inlineTags?: string[];
264
269
  /**
265
270
  * If this is set to `true`, all of the following tags used to control JSX output are allowed:
266
271
  *
@@ -431,7 +436,6 @@ export interface Rules {
431
436
  *
432
437
  * Defaults to `ArrowFunctionExpression`, `FunctionDeclaration`,
433
438
  * `FunctionExpression`, `TSDeclareFunction`.
434
- *
435
439
  */
436
440
  contexts?: (
437
441
  | string
@@ -490,7 +494,6 @@ export interface Rules {
490
494
  * ```
491
495
  *
492
496
  * Defaults to `multi`.
493
- *
494
497
  */
495
498
  enforceJsdocLineStyle?: "multi" | "single";
496
499
  /**
@@ -520,12 +523,36 @@ export interface Rules {
520
523
  * 'jsdoc/empty-tags': ['error', {tags: ['event']}]
521
524
  * }
522
525
  * ```
523
- *
524
526
  */
525
527
  tags?: string[];
526
528
  }
527
529
  ];
528
530
 
531
+ /** Reports use of JSDoc tags in non-tag positions (in the default "typescript" mode). */
532
+ "jsdoc/escape-inline-tags":
533
+ | []
534
+ | [
535
+ {
536
+ /**
537
+ * A listing of tags you wish to allow unescaped. Defaults to an empty array.
538
+ */
539
+ allowedInlineTags?: string[];
540
+ /**
541
+ * Whether to enable the fixer. Defaults to `false`.
542
+ */
543
+ enableFixer?: boolean;
544
+ /**
545
+ * How to escape the inline tag.
546
+ *
547
+ * May be "backticks" to enclose tags in backticks (treating as code segments), or
548
+ * "backslash" to escape tags with a backslash, i.e., `\@`
549
+ *
550
+ * Defaults to "backslash".
551
+ */
552
+ fixType?: "backticks" | "backslash";
553
+ }
554
+ ];
555
+
529
556
  /** Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors). */
530
557
  "jsdoc/implements-on-classes":
531
558
  | []
@@ -582,7 +609,6 @@ export interface Rules {
582
609
  * "a": ["an", "our"]
583
610
  * }
584
611
  * ```
585
- *
586
612
  */
587
613
  aliases?: {
588
614
  /**
@@ -604,7 +630,6 @@ export interface Rules {
604
630
  * ```
605
631
  *
606
632
  * No tags are excluded by default.
607
- *
608
633
  */
609
634
  excludedTags?: string[];
610
635
  /**
@@ -622,7 +647,6 @@ export interface Rules {
622
647
  * ```json
623
648
  * ["a", "an", "i", "in", "of", "s", "the"]
624
649
  * ```
625
- *
626
650
  */
627
651
  uselessWords?: string[];
628
652
  }
@@ -636,26 +660,22 @@ export interface Rules {
636
660
  /**
637
661
  * Whether to additionally check the start of blocks, such as classes or functions.
638
662
  * Defaults to `false`.
639
- *
640
663
  */
641
664
  checkBlockStarts?: boolean;
642
665
  /**
643
666
  * An array of tags whose presence in the JSDoc block will prevent the
644
667
  * application of the rule. Defaults to `['type']` (i.e., if `@type` is present,
645
668
  * lines before the block will not be added).
646
- *
647
669
  */
648
670
  excludedTags?: string[];
649
671
  /**
650
672
  * This option excludes cases where the JSDoc block occurs on the same line as a
651
673
  * preceding code or comment. Defaults to `true`.
652
- *
653
674
  */
654
675
  ignoreSameLine?: boolean;
655
676
  /**
656
677
  * This option excludes cases where the JSDoc block is only one line long.
657
678
  * Defaults to `true`.
658
- *
659
679
  */
660
680
  ignoreSingleLines?: boolean;
661
681
  /**
@@ -683,7 +703,6 @@ export interface Rules {
683
703
  *
684
704
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
685
705
  * section of our Advanced docs for more on the expected format.
686
- *
687
706
  */
688
707
  contexts?: (
689
708
  | string
@@ -765,7 +784,6 @@ export interface Rules {
765
784
  *
766
785
  * This can be overridden per tag or for the main block description by setting
767
786
  * `message` within `tags` or `mainDescription`, respectively.
768
- *
769
787
  */
770
788
  message?: string;
771
789
  /**
@@ -863,7 +881,6 @@ export interface Rules {
863
881
  * tag of the desired tag and/or name and no `disallowName` (or `allowName`) is
864
882
  * supplied. In such a case, only one error will be reported, but no fixer will
865
883
  * be applied, however.
866
- *
867
884
  */
868
885
  match: {
869
886
  /**
@@ -952,7 +969,6 @@ export interface Rules {
952
969
  * lines.
953
970
  *
954
971
  * Defaults to `['*']`.
955
- *
956
972
  */
957
973
  multilineTags?: "*" | string[];
958
974
  /**
@@ -977,7 +993,6 @@ export interface Rules {
977
993
  * are whitelisted in `singleLineTags`.
978
994
  *
979
995
  * Defaults to `false`.
980
- *
981
996
  */
982
997
  noSingleLineBlocks?: boolean;
983
998
  /**
@@ -998,7 +1013,6 @@ export interface Rules {
998
1013
  * descriptions.
999
1014
  *
1000
1015
  * Defaults to `null`.
1001
- *
1002
1016
  */
1003
1017
  requireSingleLineUnderCount?: number;
1004
1018
  /**
@@ -1025,7 +1039,6 @@ export interface Rules {
1025
1039
  *
1026
1040
  * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
1027
1041
  * (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
1028
- *
1029
1042
  */
1030
1043
  ignore?: string[];
1031
1044
  /**
@@ -1233,7 +1246,6 @@ export interface Rules {
1233
1246
  *
1234
1247
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
1235
1248
  * section of our Advanced docs for more on the expected format.
1236
- *
1237
1249
  */
1238
1250
  contexts?: (
1239
1251
  | string
@@ -1326,7 +1338,6 @@ export interface Rules {
1326
1338
  * }]
1327
1339
  * }
1328
1340
  * ```
1329
- *
1330
1341
  */
1331
1342
  tags?: {
1332
1343
  /**
@@ -1446,7 +1457,6 @@ export interface Rules {
1446
1457
  * its "description" (e.g., for `@returns {someType} some description`, the
1447
1458
  * description is `some description` while for `@some-tag xyz`, the description
1448
1459
  * is `xyz`).
1449
- *
1450
1460
  */
1451
1461
  tags?: string[];
1452
1462
  }
@@ -1577,8 +1587,6 @@ export interface Rules {
1577
1587
  * in this configuration object regardless of whether you have configured
1578
1588
  * `fileoverview` instead of `file` on `tagNamePreference` (i.e., `fileoverview`
1579
1589
  * will be checked, but you must use `file` on the configuration object).
1580
- *
1581
- *
1582
1590
  */
1583
1591
  tags?: {
1584
1592
  /**
@@ -1609,7 +1617,6 @@ export interface Rules {
1609
1617
  * `'*': 'always'` to apply hyphen checking to any tag (besides the preferred
1610
1618
  * `@param` tag which follows the main string option setting and besides any
1611
1619
  * other `tags` entries).
1612
- *
1613
1620
  */
1614
1621
  tags?:
1615
1622
  | {
@@ -1640,7 +1647,6 @@ export interface Rules {
1640
1647
  * getters should be checked but only when there is no setter. This may be useful
1641
1648
  * if one only wishes documentation on one of the two accessors. Defaults to
1642
1649
  * `false`.
1643
- *
1644
1650
  */
1645
1651
  checkGetters?: boolean | "no-setter";
1646
1652
  /**
@@ -1695,7 +1701,6 @@ export interface Rules {
1695
1701
  * function/method names are sufficient for themselves as documentation).
1696
1702
  *
1697
1703
  * Defaults to `false`.
1698
- *
1699
1704
  */
1700
1705
  exemptEmptyFunctions?: boolean;
1701
1706
  /**
@@ -1728,7 +1733,6 @@ export interface Rules {
1728
1733
  * - `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
1729
1734
  * - `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
1730
1735
  * - `window` - Window global exports are checked for JSDoc comments
1731
- *
1732
1736
  */
1733
1737
  publicOnly?:
1734
1738
  | boolean
@@ -1795,13 +1799,11 @@ export interface Rules {
1795
1799
  /**
1796
1800
  * Numeric to indicate the number at which to begin auto-incrementing roots.
1797
1801
  * Defaults to `0`.
1798
- *
1799
1802
  */
1800
1803
  autoIncrementBase?: number;
1801
1804
  /**
1802
1805
  * A value indicating whether `constructor`s should be checked. Defaults to
1803
1806
  * `true`.
1804
- *
1805
1807
  */
1806
1808
  checkConstructors?: boolean;
1807
1809
  /**
@@ -1818,7 +1820,6 @@ export interface Rules {
1818
1820
  * implied to be `false` (i.e., the inside of the roots will not be checked
1819
1821
  * either, e.g., it will also not complain if `a` or `b` do not have their own
1820
1822
  * documentation). Defaults to `true`.
1821
- *
1822
1823
  */
1823
1824
  checkDestructuredRoots?: boolean;
1824
1825
  /**
@@ -1876,7 +1877,6 @@ export interface Rules {
1876
1877
  * function quux ({num, ...extra}) {
1877
1878
  * }
1878
1879
  * ```
1879
- *
1880
1880
  */
1881
1881
  checkRestProperty?: boolean;
1882
1882
  /**
@@ -1930,7 +1930,6 @@ export interface Rules {
1930
1930
  *
1931
1931
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
1932
1932
  * section of our Advanced docs for more on the expected format.
1933
- *
1934
1933
  */
1935
1934
  contexts?: (
1936
1935
  | string
@@ -1977,7 +1976,6 @@ export interface Rules {
1977
1976
  * type to use.
1978
1977
  *
1979
1978
  * Defaults to `true`.
1980
- *
1981
1979
  */
1982
1980
  enableRestElementFixer?: boolean;
1983
1981
  /**
@@ -2128,7 +2126,6 @@ export interface Rules {
2128
2126
  *
2129
2127
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
2130
2128
  * section of our Advanced docs for more on the expected format.
2131
- *
2132
2129
  */
2133
2130
  contexts?: (
2134
2131
  | string
@@ -2281,7 +2278,6 @@ export interface Rules {
2281
2278
  * - `esm` - ESM exports are checked for `@returns` JSDoc comments (Defaults to `true`)
2282
2279
  * - `cjs` - CommonJS exports are checked for `@returns` JSDoc comments (Defaults to `true`)
2283
2280
  * - `window` - Window global exports are checked for `@returns` JSDoc comments
2284
- *
2285
2281
  */
2286
2282
  publicOnly?:
2287
2283
  | boolean
@@ -2438,12 +2434,14 @@ export interface Rules {
2438
2434
  * ```
2439
2435
  *
2440
2436
  * Defaults to `false`.
2441
- *
2442
2437
  */
2443
2438
  requireSeparateTemplates?: boolean;
2444
2439
  }
2445
2440
  ];
2446
2441
 
2442
+ /** Requires a description for `@template` tags */
2443
+ "jsdoc/require-template-description": [];
2444
+
2447
2445
  /** Requires that throw statements are documented with `@throws` tags. */
2448
2446
  "jsdoc/require-throws":
2449
2447
  | []
@@ -2839,7 +2837,6 @@ export interface Rules {
2839
2837
  * 'todo',
2840
2838
  * ]}];
2841
2839
  * ```
2842
- *
2843
2840
  */
2844
2841
  tagSequence?: {
2845
2842
  /**