eslint-plugin-jsdoc 60.5.0 → 60.7.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 (91) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/jsdocUtils.d.ts +1 -0
  3. package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
  4. package/dist/generateDocs.cjs +5 -6
  5. package/dist/generateDocs.cjs.map +1 -1
  6. package/dist/index-cjs.cjs +4 -1
  7. package/dist/index-cjs.cjs.map +1 -1
  8. package/dist/index.cjs +4 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/jsdocUtils.cjs +3 -2
  11. package/dist/jsdocUtils.cjs.map +1 -1
  12. package/dist/jsdocUtils.d.ts +1 -0
  13. package/dist/rules/checkLineAlignment.cjs +1 -2
  14. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  15. package/dist/rules/checkTypes.cjs +2 -3
  16. package/dist/rules/checkTypes.cjs.map +1 -1
  17. package/dist/rules/convertToJsdocComments.cjs +2 -4
  18. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  19. package/dist/rules/emptyTags.cjs +1 -2
  20. package/dist/rules/emptyTags.cjs.map +1 -1
  21. package/dist/rules/escapeInlineTags.cjs +149 -0
  22. package/dist/rules/escapeInlineTags.cjs.map +1 -0
  23. package/dist/rules/escapeInlineTags.d.ts +3 -0
  24. package/dist/rules/informativeDocs.cjs +3 -6
  25. package/dist/rules/informativeDocs.cjs.map +1 -1
  26. package/dist/rules/linesBeforeBlock.cjs +4 -8
  27. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  28. package/dist/rules/matchDescription.cjs +2 -4
  29. package/dist/rules/matchDescription.cjs.map +1 -1
  30. package/dist/rules/matchName.cjs +1 -2
  31. package/dist/rules/matchName.cjs.map +1 -1
  32. package/dist/rules/multilineBlocks.cjs +3 -6
  33. package/dist/rules/multilineBlocks.cjs.map +1 -1
  34. package/dist/rules/noBadBlocks.cjs +1 -2
  35. package/dist/rules/noBadBlocks.cjs.map +1 -1
  36. package/dist/rules/noTypes.cjs +1 -2
  37. package/dist/rules/noTypes.cjs.map +1 -1
  38. package/dist/rules/preferImportTag.cjs +6 -2
  39. package/dist/rules/preferImportTag.cjs.map +1 -1
  40. package/dist/rules/requireAsteriskPrefix.cjs +1 -2
  41. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  42. package/dist/rules/requireDescriptionCompleteSentence.cjs +1 -2
  43. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  44. package/dist/rules/requireFileOverview.cjs +1 -3
  45. package/dist/rules/requireFileOverview.cjs.map +1 -1
  46. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -2
  47. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  48. package/dist/rules/requireJsdoc.cjs +3 -6
  49. package/dist/rules/requireJsdoc.cjs.map +1 -1
  50. package/dist/rules/requireParam.cjs +6 -12
  51. package/dist/rules/requireParam.cjs.map +1 -1
  52. package/dist/rules/requireParamName.cjs +1 -2
  53. package/dist/rules/requireParamName.cjs.map +1 -1
  54. package/dist/rules/requireReturns.cjs +1 -2
  55. package/dist/rules/requireReturns.cjs.map +1 -1
  56. package/dist/rules/requireReturnsCheck.cjs +13 -1
  57. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  58. package/dist/rules/requireTemplate.cjs +1 -2
  59. package/dist/rules/requireTemplate.cjs.map +1 -1
  60. package/dist/rules/sortTags.cjs +1 -2
  61. package/dist/rules/sortTags.cjs.map +1 -1
  62. package/dist/rules.d.ts +30 -37
  63. package/package.json +9 -9
  64. package/src/index-cjs.js +4 -0
  65. package/src/index.js +4 -0
  66. package/src/jsdocUtils.js +17 -1
  67. package/src/rules/checkLineAlignment.js +1 -2
  68. package/src/rules/checkTypes.js +3 -15
  69. package/src/rules/convertToJsdocComments.js +2 -4
  70. package/src/rules/emptyTags.js +1 -2
  71. package/src/rules/escapeInlineTags.js +189 -0
  72. package/src/rules/informativeDocs.js +3 -6
  73. package/src/rules/linesBeforeBlock.js +4 -8
  74. package/src/rules/matchDescription.js +2 -4
  75. package/src/rules/matchName.js +1 -2
  76. package/src/rules/multilineBlocks.js +3 -6
  77. package/src/rules/noBadBlocks.js +1 -2
  78. package/src/rules/noTypes.js +1 -2
  79. package/src/rules/preferImportTag.js +8 -3
  80. package/src/rules/requireAsteriskPrefix.js +1 -2
  81. package/src/rules/requireDescriptionCompleteSentence.js +1 -2
  82. package/src/rules/requireFileOverview.js +1 -3
  83. package/src/rules/requireHyphenBeforeParamDescription.js +1 -2
  84. package/src/rules/requireJsdoc.js +3 -6
  85. package/src/rules/requireParam.js +6 -12
  86. package/src/rules/requireParamName.js +1 -2
  87. package/src/rules/requireReturns.js +1 -2
  88. package/src/rules/requireReturnsCheck.js +16 -1
  89. package/src/rules/requireTemplate.js +1 -2
  90. package/src/rules/sortTags.js +1 -2
  91. package/src/rules.d.ts +30 -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
  /**
@@ -437,7 +436,6 @@ export interface Rules {
437
436
  *
438
437
  * Defaults to `ArrowFunctionExpression`, `FunctionDeclaration`,
439
438
  * `FunctionExpression`, `TSDeclareFunction`.
440
- *
441
439
  */
442
440
  contexts?: (
443
441
  | string
@@ -496,7 +494,6 @@ export interface Rules {
496
494
  * ```
497
495
  *
498
496
  * Defaults to `multi`.
499
- *
500
497
  */
501
498
  enforceJsdocLineStyle?: "multi" | "single";
502
499
  /**
@@ -526,12 +523,36 @@ export interface Rules {
526
523
  * 'jsdoc/empty-tags': ['error', {tags: ['event']}]
527
524
  * }
528
525
  * ```
529
- *
530
526
  */
531
527
  tags?: string[];
532
528
  }
533
529
  ];
534
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
+
535
556
  /** Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors). */
536
557
  "jsdoc/implements-on-classes":
537
558
  | []
@@ -588,7 +609,6 @@ export interface Rules {
588
609
  * "a": ["an", "our"]
589
610
  * }
590
611
  * ```
591
- *
592
612
  */
593
613
  aliases?: {
594
614
  /**
@@ -610,7 +630,6 @@ export interface Rules {
610
630
  * ```
611
631
  *
612
632
  * No tags are excluded by default.
613
- *
614
633
  */
615
634
  excludedTags?: string[];
616
635
  /**
@@ -628,7 +647,6 @@ export interface Rules {
628
647
  * ```json
629
648
  * ["a", "an", "i", "in", "of", "s", "the"]
630
649
  * ```
631
- *
632
650
  */
633
651
  uselessWords?: string[];
634
652
  }
@@ -642,26 +660,22 @@ export interface Rules {
642
660
  /**
643
661
  * Whether to additionally check the start of blocks, such as classes or functions.
644
662
  * Defaults to `false`.
645
- *
646
663
  */
647
664
  checkBlockStarts?: boolean;
648
665
  /**
649
666
  * An array of tags whose presence in the JSDoc block will prevent the
650
667
  * application of the rule. Defaults to `['type']` (i.e., if `@type` is present,
651
668
  * lines before the block will not be added).
652
- *
653
669
  */
654
670
  excludedTags?: string[];
655
671
  /**
656
672
  * This option excludes cases where the JSDoc block occurs on the same line as a
657
673
  * preceding code or comment. Defaults to `true`.
658
- *
659
674
  */
660
675
  ignoreSameLine?: boolean;
661
676
  /**
662
677
  * This option excludes cases where the JSDoc block is only one line long.
663
678
  * Defaults to `true`.
664
- *
665
679
  */
666
680
  ignoreSingleLines?: boolean;
667
681
  /**
@@ -689,7 +703,6 @@ export interface Rules {
689
703
  *
690
704
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
691
705
  * section of our Advanced docs for more on the expected format.
692
- *
693
706
  */
694
707
  contexts?: (
695
708
  | string
@@ -771,7 +784,6 @@ export interface Rules {
771
784
  *
772
785
  * This can be overridden per tag or for the main block description by setting
773
786
  * `message` within `tags` or `mainDescription`, respectively.
774
- *
775
787
  */
776
788
  message?: string;
777
789
  /**
@@ -869,7 +881,6 @@ export interface Rules {
869
881
  * tag of the desired tag and/or name and no `disallowName` (or `allowName`) is
870
882
  * supplied. In such a case, only one error will be reported, but no fixer will
871
883
  * be applied, however.
872
- *
873
884
  */
874
885
  match: {
875
886
  /**
@@ -958,7 +969,6 @@ export interface Rules {
958
969
  * lines.
959
970
  *
960
971
  * Defaults to `['*']`.
961
- *
962
972
  */
963
973
  multilineTags?: "*" | string[];
964
974
  /**
@@ -983,7 +993,6 @@ export interface Rules {
983
993
  * are whitelisted in `singleLineTags`.
984
994
  *
985
995
  * Defaults to `false`.
986
- *
987
996
  */
988
997
  noSingleLineBlocks?: boolean;
989
998
  /**
@@ -1004,7 +1013,6 @@ export interface Rules {
1004
1013
  * descriptions.
1005
1014
  *
1006
1015
  * Defaults to `null`.
1007
- *
1008
1016
  */
1009
1017
  requireSingleLineUnderCount?: number;
1010
1018
  /**
@@ -1031,7 +1039,6 @@ export interface Rules {
1031
1039
  *
1032
1040
  * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
1033
1041
  * (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
1034
- *
1035
1042
  */
1036
1043
  ignore?: string[];
1037
1044
  /**
@@ -1239,7 +1246,6 @@ export interface Rules {
1239
1246
  *
1240
1247
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
1241
1248
  * section of our Advanced docs for more on the expected format.
1242
- *
1243
1249
  */
1244
1250
  contexts?: (
1245
1251
  | string
@@ -1332,7 +1338,6 @@ export interface Rules {
1332
1338
  * }]
1333
1339
  * }
1334
1340
  * ```
1335
- *
1336
1341
  */
1337
1342
  tags?: {
1338
1343
  /**
@@ -1452,7 +1457,6 @@ export interface Rules {
1452
1457
  * its "description" (e.g., for `@returns {someType} some description`, the
1453
1458
  * description is `some description` while for `@some-tag xyz`, the description
1454
1459
  * is `xyz`).
1455
- *
1456
1460
  */
1457
1461
  tags?: string[];
1458
1462
  }
@@ -1583,8 +1587,6 @@ export interface Rules {
1583
1587
  * in this configuration object regardless of whether you have configured
1584
1588
  * `fileoverview` instead of `file` on `tagNamePreference` (i.e., `fileoverview`
1585
1589
  * will be checked, but you must use `file` on the configuration object).
1586
- *
1587
- *
1588
1590
  */
1589
1591
  tags?: {
1590
1592
  /**
@@ -1615,7 +1617,6 @@ export interface Rules {
1615
1617
  * `'*': 'always'` to apply hyphen checking to any tag (besides the preferred
1616
1618
  * `@param` tag which follows the main string option setting and besides any
1617
1619
  * other `tags` entries).
1618
- *
1619
1620
  */
1620
1621
  tags?:
1621
1622
  | {
@@ -1646,7 +1647,6 @@ export interface Rules {
1646
1647
  * getters should be checked but only when there is no setter. This may be useful
1647
1648
  * if one only wishes documentation on one of the two accessors. Defaults to
1648
1649
  * `false`.
1649
- *
1650
1650
  */
1651
1651
  checkGetters?: boolean | "no-setter";
1652
1652
  /**
@@ -1701,7 +1701,6 @@ export interface Rules {
1701
1701
  * function/method names are sufficient for themselves as documentation).
1702
1702
  *
1703
1703
  * Defaults to `false`.
1704
- *
1705
1704
  */
1706
1705
  exemptEmptyFunctions?: boolean;
1707
1706
  /**
@@ -1734,7 +1733,6 @@ export interface Rules {
1734
1733
  * - `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
1735
1734
  * - `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
1736
1735
  * - `window` - Window global exports are checked for JSDoc comments
1737
- *
1738
1736
  */
1739
1737
  publicOnly?:
1740
1738
  | boolean
@@ -1801,13 +1799,11 @@ export interface Rules {
1801
1799
  /**
1802
1800
  * Numeric to indicate the number at which to begin auto-incrementing roots.
1803
1801
  * Defaults to `0`.
1804
- *
1805
1802
  */
1806
1803
  autoIncrementBase?: number;
1807
1804
  /**
1808
1805
  * A value indicating whether `constructor`s should be checked. Defaults to
1809
1806
  * `true`.
1810
- *
1811
1807
  */
1812
1808
  checkConstructors?: boolean;
1813
1809
  /**
@@ -1824,7 +1820,6 @@ export interface Rules {
1824
1820
  * implied to be `false` (i.e., the inside of the roots will not be checked
1825
1821
  * either, e.g., it will also not complain if `a` or `b` do not have their own
1826
1822
  * documentation). Defaults to `true`.
1827
- *
1828
1823
  */
1829
1824
  checkDestructuredRoots?: boolean;
1830
1825
  /**
@@ -1882,7 +1877,6 @@ export interface Rules {
1882
1877
  * function quux ({num, ...extra}) {
1883
1878
  * }
1884
1879
  * ```
1885
- *
1886
1880
  */
1887
1881
  checkRestProperty?: boolean;
1888
1882
  /**
@@ -1936,7 +1930,6 @@ export interface Rules {
1936
1930
  *
1937
1931
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
1938
1932
  * section of our Advanced docs for more on the expected format.
1939
- *
1940
1933
  */
1941
1934
  contexts?: (
1942
1935
  | string
@@ -1983,7 +1976,6 @@ export interface Rules {
1983
1976
  * type to use.
1984
1977
  *
1985
1978
  * Defaults to `true`.
1986
- *
1987
1979
  */
1988
1980
  enableRestElementFixer?: boolean;
1989
1981
  /**
@@ -2134,7 +2126,6 @@ export interface Rules {
2134
2126
  *
2135
2127
  * See the ["AST and Selectors"](../#advanced-ast-and-selectors)
2136
2128
  * section of our Advanced docs for more on the expected format.
2137
- *
2138
2129
  */
2139
2130
  contexts?: (
2140
2131
  | string
@@ -2287,7 +2278,6 @@ export interface Rules {
2287
2278
  * - `esm` - ESM exports are checked for `@returns` JSDoc comments (Defaults to `true`)
2288
2279
  * - `cjs` - CommonJS exports are checked for `@returns` JSDoc comments (Defaults to `true`)
2289
2280
  * - `window` - Window global exports are checked for `@returns` JSDoc comments
2290
- *
2291
2281
  */
2292
2282
  publicOnly?:
2293
2283
  | boolean
@@ -2327,6 +2317,11 @@ export interface Rules {
2327
2317
  * if you wish for a missing `return` to be flagged regardless.
2328
2318
  */
2329
2319
  exemptGenerators?: boolean;
2320
+ /**
2321
+ * Whether to check that async functions do not
2322
+ * indicate they return non-native types. Defaults to `true`.
2323
+ */
2324
+ noNativeTypes?: boolean;
2330
2325
  /**
2331
2326
  * If `true` and no return or
2332
2327
  * resolve value is found, this setting will even insist that reporting occur
@@ -2444,7 +2439,6 @@ export interface Rules {
2444
2439
  * ```
2445
2440
  *
2446
2441
  * Defaults to `false`.
2447
- *
2448
2442
  */
2449
2443
  requireSeparateTemplates?: boolean;
2450
2444
  }
@@ -2848,7 +2842,6 @@ export interface Rules {
2848
2842
  * 'todo',
2849
2843
  * ]}];
2850
2844
  * ```
2851
- *
2852
2845
  */
2853
2846
  tagSequence?: {
2854
2847
  /**