eslint-plugin-jsdoc 61.1.11 → 61.2.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/dist/buildForbidRuleDefinition.cjs +1 -3
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildForbidRuleDefinition.d.ts +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +1 -3
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.d.ts +1 -1
- package/dist/cjs/buildForbidRuleDefinition.d.ts +1 -1
- package/dist/cjs/buildRejectOrPreferRuleDefinition.d.ts +1 -1
- package/dist/cjs/iterateJsdoc.d.ts +2 -4
- package/dist/cjs/rules/checkTypes.d.ts +1 -1
- package/dist/cjs/rules/convertToJsdocComments.d.ts +105 -97
- package/dist/cjs/rules/noRestrictedSyntax.d.ts +1 -1
- package/dist/cjs/rules/requireTags.d.ts +1 -1
- package/dist/exportParser.cjs +1 -0
- package/dist/exportParser.cjs.map +1 -1
- package/dist/iterateJsdoc.cjs +3 -7
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +2 -4
- package/dist/jsdocUtils.cjs +4 -2
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkTypes.d.ts +1 -1
- package/dist/rules/convertToJsdocComments.cjs +1 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.d.ts +105 -97
- package/dist/rules/noRestrictedSyntax.d.ts +1 -1
- package/dist/rules/noUndefinedTypes.cjs +10 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +1 -1
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +1 -0
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +1 -1
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireTags.d.ts +1 -1
- package/dist/rules/sortTags.cjs +13 -1
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules.d.ts +10 -0
- package/package.json +7 -7
- package/src/buildForbidRuleDefinition.js +1 -3
- package/src/buildRejectOrPreferRuleDefinition.js +1 -3
- package/src/exportParser.js +1 -0
- package/src/iterateJsdoc.js +3 -7
- package/src/jsdocUtils.js +9 -3
- package/src/rules/convertToJsdocComments.js +1 -0
- package/src/rules/noUndefinedTypes.js +11 -0
- package/src/rules/requireFileOverview.js +1 -1
- package/src/rules/requireJsdoc.js +1 -0
- package/src/rules/requireParam.js +1 -1
- package/src/rules/sortTags.js +13 -1
- package/src/rules.d.ts +10 -0
|
@@ -466,6 +466,16 @@ export default iterateJsdoc(({
|
|
|
466
466
|
return utils.isNamepathOrUrlReferencingTag(tag);
|
|
467
467
|
}).map(tagToParsedType('namepathOrURL'));
|
|
468
468
|
|
|
469
|
+
const definedNamesAndNamepaths = new Set(utils.filterTags(({
|
|
470
|
+
tag,
|
|
471
|
+
}) => {
|
|
472
|
+
return utils.isNameOrNamepathDefiningTag(tag);
|
|
473
|
+
}).map(({
|
|
474
|
+
name,
|
|
475
|
+
}) => {
|
|
476
|
+
return name;
|
|
477
|
+
}));
|
|
478
|
+
|
|
469
479
|
const tagsWithTypes = /** @type {TypeAndTagInfo[]} */ ([
|
|
470
480
|
...typeTags,
|
|
471
481
|
...namepathReferencingTags,
|
|
@@ -520,6 +530,7 @@ export default iterateJsdoc(({
|
|
|
520
530
|
if (type === 'JsdocTypeName') {
|
|
521
531
|
const structuredTypes = structuredTags[tag.tag]?.type;
|
|
522
532
|
if (!allDefinedTypes.has(val) &&
|
|
533
|
+
!definedNamesAndNamepaths.has(val) &&
|
|
523
534
|
(!Array.isArray(structuredTypes) || !structuredTypes.includes(val))
|
|
524
535
|
) {
|
|
525
536
|
const parent =
|
|
@@ -207,7 +207,7 @@ will be checked, but you must use \`file\` on the configuration object).`,
|
|
|
207
207
|
state,
|
|
208
208
|
}) {
|
|
209
209
|
if (!state.hasNonComment) {
|
|
210
|
-
state.hasNonComment = node.range[0];
|
|
210
|
+
state.hasNonComment = /** @type {[number, number]} */ (node.range)?.[0];
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
213
|
});
|
|
@@ -74,7 +74,7 @@ export default iterateJsdoc(({
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if (node && node.parent
|
|
77
|
+
if (node && node.parent?.type === 'VariableDeclarator' &&
|
|
78
78
|
'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
package/src/rules/sortTags.js
CHANGED
|
@@ -5,11 +5,13 @@ export default iterateJsdoc(({
|
|
|
5
5
|
context,
|
|
6
6
|
jsdoc,
|
|
7
7
|
utils,
|
|
8
|
+
// eslint-disable-next-line complexity -- Temporary
|
|
8
9
|
}) => {
|
|
9
10
|
const
|
|
10
11
|
/**
|
|
11
12
|
* @type {{
|
|
12
13
|
* linesBetween: import('../iterateJsdoc.js').Integer,
|
|
14
|
+
* tagExceptions: Record<string, number>,
|
|
13
15
|
* tagSequence: {
|
|
14
16
|
* tags: string[]
|
|
15
17
|
* }[],
|
|
@@ -22,6 +24,7 @@ export default iterateJsdoc(({
|
|
|
22
24
|
linesBetween = 1,
|
|
23
25
|
reportIntraTagGroupSpacing = true,
|
|
24
26
|
reportTagGroupSpacing = true,
|
|
27
|
+
tagExceptions = {},
|
|
25
28
|
tagSequence = defaultTagOrder,
|
|
26
29
|
} = context.options[0] || {};
|
|
27
30
|
|
|
@@ -328,7 +331,7 @@ export default iterateJsdoc(({
|
|
|
328
331
|
}
|
|
329
332
|
|
|
330
333
|
const ct = countTagEmptyLines(tag);
|
|
331
|
-
if (ct) {
|
|
334
|
+
if (ct && (!tagExceptions[tag.tag] || tagExceptions[tag.tag] < ct)) {
|
|
332
335
|
const fixer = () => {
|
|
333
336
|
let foundFirstTag = false;
|
|
334
337
|
|
|
@@ -548,6 +551,15 @@ will not have spacing applied regardless. For adding line breaks there, you
|
|
|
548
551
|
may wish to use the \`endLines\` option of the \`tag-lines\` rule.`,
|
|
549
552
|
type: 'boolean',
|
|
550
553
|
},
|
|
554
|
+
tagExceptions: {
|
|
555
|
+
description: 'Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.',
|
|
556
|
+
patternProperties: {
|
|
557
|
+
'.*': {
|
|
558
|
+
type: 'number',
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
type: 'object',
|
|
562
|
+
},
|
|
551
563
|
tagSequence: {
|
|
552
564
|
description: `An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
553
565
|
|
package/src/rules.d.ts
CHANGED
|
@@ -2660,6 +2660,16 @@ export interface Rules {
|
|
|
2660
2660
|
* may wish to use the `endLines` option of the `tag-lines` rule.
|
|
2661
2661
|
*/
|
|
2662
2662
|
reportTagGroupSpacing?: boolean;
|
|
2663
|
+
/**
|
|
2664
|
+
* Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.
|
|
2665
|
+
*/
|
|
2666
|
+
tagExceptions?: {
|
|
2667
|
+
/**
|
|
2668
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
2669
|
+
* via the `patternProperty` ".*".
|
|
2670
|
+
*/
|
|
2671
|
+
[k: string]: number;
|
|
2672
|
+
};
|
|
2663
2673
|
/**
|
|
2664
2674
|
* An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
2665
2675
|
*
|