eslint-plugin-jsdoc 50.6.17 → 50.7.1
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/alignTransform.cjs +10 -10
- package/dist/alignTransform.cjs.map +1 -1
- package/dist/exportParser.cjs +141 -135
- package/dist/exportParser.cjs.map +1 -1
- package/dist/generateRule.cjs +10 -12
- package/dist/generateRule.cjs.map +1 -1
- package/dist/getDefaultTagStructureForMode.cjs +73 -73
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +121 -110
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/index.cjs +17 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/iterateJsdoc.cjs +87 -66
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/jsdocUtils.cjs +144 -142
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +2 -2
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +22 -28
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +2 -2
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +14 -14
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +21 -15
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +2 -2
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +11 -11
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +21 -22
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +10 -10
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +11 -14
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +26 -27
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/emptyTags.cjs +6 -6
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/importsAsDependencies.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +12 -12
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +12 -12
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +1 -1
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +4 -4
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +10 -10
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +3 -3
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +6 -6
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +2 -2
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +17 -20
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +4 -4
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +2 -2
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +8 -8
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +6 -6
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -4
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +19 -19
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +12 -12
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireProperty.cjs +1 -1
- package/dist/rules/requireProperty.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +3 -3
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +1 -1
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +1 -1
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +16 -15
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +4 -4
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +6 -6
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +13 -13
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +11 -11
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +2 -2
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +15 -15
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/tagNames.cjs +1 -1
- package/dist/tagNames.cjs.map +1 -1
- package/dist/utils/hasReturnValue.cjs +176 -176
- package/dist/utils/hasReturnValue.cjs.map +1 -1
- package/eslint.config.js +36 -32
- package/package.json +29 -29
- package/pnpm-workspace.yaml +1 -0
- package/src/alignTransform.js +15 -15
- package/src/exportParser.js +386 -373
- package/src/getDefaultTagStructureForMode.js +45 -45
- package/src/getJsdocProcessorPlugin.js +175 -128
- package/src/index.js +66 -37
- package/src/iterateJsdoc.js +61 -28
- package/src/jsdocUtils.js +354 -338
- package/src/rules/checkAlignment.js +2 -2
- package/src/rules/checkExamples.js +16 -20
- package/src/rules/checkIndentation.js +2 -2
- package/src/rules/checkLineAlignment.js +10 -10
- package/src/rules/checkParamNames.js +22 -14
- package/src/rules/checkPropertyNames.js +1 -1
- package/src/rules/checkTagNames.js +7 -7
- package/src/rules/checkTemplateNames.js +52 -38
- package/src/rules/checkTypes.js +7 -7
- package/src/rules/checkValues.js +16 -17
- package/src/rules/convertToJsdocComments.js +47 -37
- package/src/rules/emptyTags.js +14 -7
- package/src/rules/importsAsDependencies.js +3 -1
- package/src/rules/informativeDocs.js +58 -58
- package/src/rules/linesBeforeBlock.js +25 -17
- package/src/rules/matchDescription.js +1 -1
- package/src/rules/matchName.js +2 -2
- package/src/rules/multilineBlocks.js +10 -10
- package/src/rules/noBadBlocks.js +3 -3
- package/src/rules/noMultiAsterisks.js +4 -4
- package/src/rules/noRestrictedSyntax.js +1 -1
- package/src/rules/noTypes.js +1 -1
- package/src/rules/noUndefinedTypes.js +29 -23
- package/src/rules/requireAsteriskPrefix.js +3 -3
- package/src/rules/requireDescription.js +1 -1
- package/src/rules/requireDescriptionCompleteSentence.js +6 -6
- package/src/rules/requireFileOverview.js +3 -3
- package/src/rules/requireHyphenBeforeParamDescription.js +2 -5
- package/src/rules/requireJsdoc.js +14 -14
- package/src/rules/requireParam.js +9 -9
- package/src/rules/requireProperty.js +1 -1
- package/src/rules/requireReturns.js +1 -1
- package/src/rules/requireReturnsCheck.js +1 -1
- package/src/rules/requireReturnsDescription.js +1 -1
- package/src/rules/requireTemplate.js +59 -38
- package/src/rules/requireYields.js +3 -3
- package/src/rules/requireYieldsCheck.js +1 -1
- package/src/rules/sortTags.js +7 -7
- package/src/rules/tagLines.js +8 -8
- package/src/rules/textEscaping.js +2 -0
- package/src/rules/validTypes.js +29 -29
- package/src/tagNames.js +2 -2
- package/src/utils/hasReturnValue.js +298 -283
package/src/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getJsdocProcessorPlugin,
|
|
3
|
+
} from './getJsdocProcessorPlugin.js';
|
|
1
4
|
import checkAccess from './rules/checkAccess.js';
|
|
2
5
|
import checkAlignment from './rules/checkAlignment.js';
|
|
3
6
|
import checkExamples from './rules/checkExamples.js';
|
|
@@ -56,17 +59,18 @@ import tagLines from './rules/tagLines.js';
|
|
|
56
59
|
import textEscaping from './rules/textEscaping.js';
|
|
57
60
|
import validTypes from './rules/validTypes.js';
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
/* eslint-disable jsdoc/valid-types -- Bug */
|
|
61
63
|
/**
|
|
62
64
|
* @typedef {"recommended" | "stylistic" | "contents" | "logical" | "requirements"} ConfigGroups
|
|
63
65
|
* @typedef {"" | "-typescript" | "-typescript-flavor"} ConfigVariants
|
|
64
66
|
* @typedef {"" | "-error"} ErrorLevelVariants
|
|
65
67
|
* @type {import('eslint').ESLint.Plugin & {
|
|
66
|
-
* configs: Record<`flat/${ConfigGroups}${ConfigVariants}${ErrorLevelVariants}`,
|
|
67
|
-
*
|
|
68
|
-
|
|
68
|
+
* configs: Record<`flat/${ConfigGroups}${ConfigVariants}${ErrorLevelVariants}`,
|
|
69
|
+
* import('eslint').Linter.Config>
|
|
70
|
+
* }}
|
|
71
|
+
*/
|
|
69
72
|
const index = {
|
|
73
|
+
/* eslint-enable jsdoc/valid-types -- Bug */
|
|
70
74
|
// @ts-expect-error Ok
|
|
71
75
|
configs: {},
|
|
72
76
|
rules: {
|
|
@@ -137,7 +141,9 @@ const index = {
|
|
|
137
141
|
*/
|
|
138
142
|
const createRecommendedRuleset = (warnOrError, flatName) => {
|
|
139
143
|
return {
|
|
140
|
-
...(flatName ? {
|
|
144
|
+
...(flatName ? {
|
|
145
|
+
name: 'jsdoc/' + flatName,
|
|
146
|
+
} : {}),
|
|
141
147
|
// @ts-expect-error Ok
|
|
142
148
|
plugins:
|
|
143
149
|
flatName ? {
|
|
@@ -219,7 +225,7 @@ const createRecommendedTypeScriptRuleset = (warnOrError, flatName) => {
|
|
|
219
225
|
...ruleset,
|
|
220
226
|
rules: {
|
|
221
227
|
...ruleset.rules,
|
|
222
|
-
/* eslint-disable indent -- Extra indent to avoid use by auto-rule-editing */
|
|
228
|
+
/* eslint-disable @stylistic/indent -- Extra indent to avoid use by auto-rule-editing */
|
|
223
229
|
'jsdoc/check-tag-names': [
|
|
224
230
|
warnOrError, {
|
|
225
231
|
typed: true,
|
|
@@ -230,7 +236,7 @@ const createRecommendedTypeScriptRuleset = (warnOrError, flatName) => {
|
|
|
230
236
|
'jsdoc/require-param-type': 'off',
|
|
231
237
|
'jsdoc/require-property-type': 'off',
|
|
232
238
|
'jsdoc/require-returns-type': 'off',
|
|
233
|
-
/* eslint-enable indent */
|
|
239
|
+
/* eslint-enable @stylistic/indent */
|
|
234
240
|
},
|
|
235
241
|
};
|
|
236
242
|
};
|
|
@@ -247,9 +253,9 @@ const createRecommendedTypeScriptFlavorRuleset = (warnOrError, flatName) => {
|
|
|
247
253
|
...ruleset,
|
|
248
254
|
rules: {
|
|
249
255
|
...ruleset.rules,
|
|
250
|
-
/* eslint-disable indent -- Extra indent to avoid use by auto-rule-editing */
|
|
256
|
+
/* eslint-disable @stylistic/indent -- Extra indent to avoid use by auto-rule-editing */
|
|
251
257
|
'jsdoc/no-undefined-types': 'off',
|
|
252
|
-
/* eslint-enable indent */
|
|
258
|
+
/* eslint-enable @stylistic/indent */
|
|
253
259
|
},
|
|
254
260
|
};
|
|
255
261
|
};
|
|
@@ -266,26 +272,39 @@ const createStandaloneRulesetFactory = (ruleNames) => {
|
|
|
266
272
|
return (warnOrError, flatName) => {
|
|
267
273
|
return {
|
|
268
274
|
name: 'jsdoc/' + flatName,
|
|
269
|
-
plugins: {
|
|
275
|
+
plugins: {
|
|
276
|
+
jsdoc: index,
|
|
277
|
+
},
|
|
270
278
|
rules: Object.fromEntries(
|
|
271
279
|
ruleNames.map(
|
|
272
|
-
ruleName =>
|
|
273
|
-
typeof ruleName ===
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
280
|
+
(ruleName) => {
|
|
281
|
+
return (typeof ruleName === 'string' ?
|
|
282
|
+
[
|
|
283
|
+
ruleName, warnOrError,
|
|
284
|
+
] :
|
|
285
|
+
[
|
|
286
|
+
ruleName[0], [
|
|
287
|
+
warnOrError, ...ruleName.slice(1),
|
|
288
|
+
],
|
|
289
|
+
]);
|
|
290
|
+
},
|
|
291
|
+
),
|
|
277
292
|
),
|
|
278
293
|
};
|
|
279
294
|
};
|
|
280
|
-
}
|
|
295
|
+
};
|
|
281
296
|
|
|
282
297
|
const contentsRules = [
|
|
283
298
|
'jsdoc/informative-docs',
|
|
284
299
|
'jsdoc/match-description',
|
|
285
300
|
'jsdoc/no-blank-block-descriptions',
|
|
286
301
|
'jsdoc/no-blank-blocks',
|
|
287
|
-
[
|
|
288
|
-
|
|
302
|
+
[
|
|
303
|
+
'jsdoc/text-escaping', {
|
|
304
|
+
escapeHTML: true,
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
];
|
|
289
308
|
|
|
290
309
|
const createContentsTypescriptRuleset = createStandaloneRulesetFactory(contentsRules);
|
|
291
310
|
|
|
@@ -346,7 +365,9 @@ const stylisticRules = [
|
|
|
346
365
|
'jsdoc/multiline-blocks',
|
|
347
366
|
'jsdoc/no-multi-asterisks',
|
|
348
367
|
'jsdoc/require-asterisk-prefix',
|
|
349
|
-
[
|
|
368
|
+
[
|
|
369
|
+
'jsdoc/require-hyphen-before-param-description', 'never',
|
|
370
|
+
],
|
|
350
371
|
'jsdoc/tag-lines',
|
|
351
372
|
];
|
|
352
373
|
|
|
@@ -392,16 +413,20 @@ index.configs['flat/stylistic-typescript-flavor-error'] = createStylisticTypeScr
|
|
|
392
413
|
|
|
393
414
|
index.configs.examples = /** @type {import('eslint').Linter.FlatConfig[]} */ ([
|
|
394
415
|
{
|
|
416
|
+
files: [
|
|
417
|
+
'**/*.js',
|
|
418
|
+
],
|
|
395
419
|
name: 'jsdoc/examples/processor',
|
|
396
|
-
files: ['**/*.js'],
|
|
397
420
|
plugins: {
|
|
398
|
-
examples: getJsdocProcessorPlugin()
|
|
421
|
+
examples: getJsdocProcessorPlugin(),
|
|
399
422
|
},
|
|
400
423
|
processor: 'examples/examples',
|
|
401
424
|
},
|
|
402
425
|
{
|
|
426
|
+
files: [
|
|
427
|
+
'**/*.md/*.js',
|
|
428
|
+
],
|
|
403
429
|
name: 'jsdoc/examples/rules',
|
|
404
|
-
files: ['**/*.md/*.js'],
|
|
405
430
|
rules: {
|
|
406
431
|
// "always" newline rule at end unlikely in sample code
|
|
407
432
|
'eol-last': 0,
|
|
@@ -436,26 +461,30 @@ index.configs.examples = /** @type {import('eslint').Linter.FlatConfig[]} */ ([
|
|
|
436
461
|
|
|
437
462
|
// Can generally look nicer to pad a little even if code imposes more stringency
|
|
438
463
|
'padded-blocks': 0,
|
|
439
|
-
}
|
|
440
|
-
}
|
|
464
|
+
},
|
|
465
|
+
},
|
|
441
466
|
]);
|
|
442
467
|
|
|
443
468
|
index.configs['default-expressions'] = /** @type {import('eslint').Linter.FlatConfig[]} */ ([
|
|
444
469
|
{
|
|
445
|
-
files: [
|
|
470
|
+
files: [
|
|
471
|
+
'**/*.js',
|
|
472
|
+
],
|
|
446
473
|
name: 'jsdoc/default-expressions/processor',
|
|
447
474
|
plugins: {
|
|
448
475
|
examples: getJsdocProcessorPlugin({
|
|
449
476
|
checkDefaults: true,
|
|
450
477
|
checkParams: true,
|
|
451
|
-
checkProperties: true
|
|
452
|
-
})
|
|
478
|
+
checkProperties: true,
|
|
479
|
+
}),
|
|
453
480
|
},
|
|
454
|
-
processor: 'examples/examples'
|
|
481
|
+
processor: 'examples/examples',
|
|
455
482
|
},
|
|
456
483
|
{
|
|
484
|
+
files: [
|
|
485
|
+
'**/*.jsdoc-defaults', '**/*.jsdoc-params', '**/*.jsdoc-properties',
|
|
486
|
+
],
|
|
457
487
|
name: 'jsdoc/default-expressions/rules',
|
|
458
|
-
files: ['**/*.jsdoc-defaults', '**/*.jsdoc-params', '**/*.jsdoc-properties'],
|
|
459
488
|
rules: {
|
|
460
489
|
...index.configs.examples[1].rules,
|
|
461
490
|
'chai-friendly/no-unused-expressions': 0,
|
|
@@ -468,9 +497,9 @@ index.configs['default-expressions'] = /** @type {import('eslint').Linter.FlatCo
|
|
|
468
497
|
semi: [
|
|
469
498
|
'error', 'never',
|
|
470
499
|
],
|
|
471
|
-
strict: 0
|
|
500
|
+
strict: 0,
|
|
472
501
|
},
|
|
473
|
-
}
|
|
502
|
+
},
|
|
474
503
|
]);
|
|
475
504
|
|
|
476
505
|
index.configs['examples-and-default-expressions'] = /** @type {import('eslint').Linter.FlatConfig[]} */ ([
|
|
@@ -480,22 +509,22 @@ index.configs['examples-and-default-expressions'] = /** @type {import('eslint').
|
|
|
480
509
|
examples: getJsdocProcessorPlugin({
|
|
481
510
|
checkDefaults: true,
|
|
482
511
|
checkParams: true,
|
|
483
|
-
checkProperties: true
|
|
484
|
-
})
|
|
512
|
+
checkProperties: true,
|
|
513
|
+
}),
|
|
485
514
|
},
|
|
486
515
|
},
|
|
487
516
|
...index.configs.examples.map((config) => {
|
|
488
517
|
return {
|
|
489
518
|
...config,
|
|
490
|
-
plugins: {}
|
|
519
|
+
plugins: {},
|
|
491
520
|
};
|
|
492
521
|
}),
|
|
493
522
|
...index.configs['default-expressions'].map((config) => {
|
|
494
523
|
return {
|
|
495
524
|
...config,
|
|
496
|
-
plugins: {}
|
|
525
|
+
plugins: {},
|
|
497
526
|
};
|
|
498
|
-
})
|
|
527
|
+
}),
|
|
499
528
|
]);
|
|
500
529
|
|
|
501
530
|
export default index;
|
package/src/iterateJsdoc.js
CHANGED
|
@@ -594,8 +594,8 @@ const globalState = new Map();
|
|
|
594
594
|
* @returns {BasicUtils}
|
|
595
595
|
*/
|
|
596
596
|
const getBasicUtils = (context, {
|
|
597
|
-
tagNamePreference,
|
|
598
597
|
mode,
|
|
598
|
+
tagNamePreference,
|
|
599
599
|
}) => {
|
|
600
600
|
/** @type {BasicUtils} */
|
|
601
601
|
const utils = {};
|
|
@@ -706,23 +706,23 @@ const getUtils = (
|
|
|
706
706
|
const utils = /** @type {Utils} */ (getBasicUtils(context, settings));
|
|
707
707
|
|
|
708
708
|
const {
|
|
709
|
-
|
|
710
|
-
overrideReplacesDocs,
|
|
709
|
+
augmentsExtendsReplacesDocs,
|
|
711
710
|
ignoreReplacesDocs,
|
|
712
711
|
implementsReplacesDocs,
|
|
713
|
-
augmentsExtendsReplacesDocs,
|
|
714
712
|
maxLines,
|
|
715
713
|
minLines,
|
|
716
714
|
mode,
|
|
715
|
+
overrideReplacesDocs,
|
|
716
|
+
tagNamePreference,
|
|
717
717
|
} = settings;
|
|
718
718
|
|
|
719
719
|
/** @type {IsIteratingFunction} */
|
|
720
720
|
utils.isIteratingFunction = () => {
|
|
721
721
|
return !iteratingAll || [
|
|
722
|
-
'MethodDefinition',
|
|
723
722
|
'ArrowFunctionExpression',
|
|
724
723
|
'FunctionDeclaration',
|
|
725
724
|
'FunctionExpression',
|
|
725
|
+
'MethodDefinition',
|
|
726
726
|
].includes(String(node && node.type));
|
|
727
727
|
};
|
|
728
728
|
|
|
@@ -815,8 +815,8 @@ const getUtils = (
|
|
|
815
815
|
jsdoc.source.some(({
|
|
816
816
|
tokens: {
|
|
817
817
|
description,
|
|
818
|
-
tag,
|
|
819
818
|
end,
|
|
819
|
+
tag,
|
|
820
820
|
},
|
|
821
821
|
}, idx) => {
|
|
822
822
|
if (tag) {
|
|
@@ -870,12 +870,12 @@ const getUtils = (
|
|
|
870
870
|
|
|
871
871
|
jsdoc.source.some(({
|
|
872
872
|
tokens: {
|
|
873
|
-
description,
|
|
874
|
-
start,
|
|
875
873
|
delimiter,
|
|
874
|
+
description,
|
|
875
|
+
end,
|
|
876
876
|
postDelimiter,
|
|
877
|
+
start,
|
|
877
878
|
tag,
|
|
878
|
-
end,
|
|
879
879
|
},
|
|
880
880
|
}, idx) => {
|
|
881
881
|
if (delimiter === '/**') {
|
|
@@ -927,8 +927,8 @@ const getUtils = (
|
|
|
927
927
|
jsdoc.source.some(({
|
|
928
928
|
tokens: {
|
|
929
929
|
description,
|
|
930
|
-
tag,
|
|
931
930
|
end,
|
|
931
|
+
tag,
|
|
932
932
|
},
|
|
933
933
|
}, idx) => {
|
|
934
934
|
/* c8 ignore next 3 -- Already checked */
|
|
@@ -1003,8 +1003,8 @@ const getUtils = (
|
|
|
1003
1003
|
let spliceCount = 1;
|
|
1004
1004
|
tagSource.slice(tagIdx + 1).some(({
|
|
1005
1005
|
tokens: {
|
|
1006
|
-
tag,
|
|
1007
1006
|
end: ending,
|
|
1007
|
+
tag,
|
|
1008
1008
|
},
|
|
1009
1009
|
}) => {
|
|
1010
1010
|
if (!tag && !ending) {
|
|
@@ -1058,7 +1058,8 @@ const getUtils = (
|
|
|
1058
1058
|
|
|
1059
1059
|
return true;
|
|
1060
1060
|
}
|
|
1061
|
-
/* c8 ignore next */
|
|
1061
|
+
/* c8 ignore next 2 */
|
|
1062
|
+
// eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
|
|
1062
1063
|
return false;
|
|
1063
1064
|
});
|
|
1064
1065
|
for (const [
|
|
@@ -1211,7 +1212,8 @@ const getUtils = (
|
|
|
1211
1212
|
|
|
1212
1213
|
return true;
|
|
1213
1214
|
}
|
|
1214
|
-
/* c8 ignore next */
|
|
1215
|
+
/* c8 ignore next 2 */
|
|
1216
|
+
// eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
|
|
1215
1217
|
return false;
|
|
1216
1218
|
});
|
|
1217
1219
|
|
|
@@ -1233,11 +1235,11 @@ const getUtils = (
|
|
|
1233
1235
|
],
|
|
1234
1236
|
} = jsdoc;
|
|
1235
1237
|
const {
|
|
1236
|
-
postDelimiter,
|
|
1237
1238
|
description,
|
|
1238
1239
|
lineEnd,
|
|
1239
|
-
tag,
|
|
1240
1240
|
name,
|
|
1241
|
+
postDelimiter,
|
|
1242
|
+
tag,
|
|
1241
1243
|
type,
|
|
1242
1244
|
} = tokens;
|
|
1243
1245
|
|
|
@@ -1308,7 +1310,7 @@ const getUtils = (
|
|
|
1308
1310
|
*/ (node).generator ||
|
|
1309
1311
|
node.type === 'MethodDefinition' && node.value.generator ||
|
|
1310
1312
|
[
|
|
1311
|
-
'
|
|
1313
|
+
'ExportDefaultDeclaration', 'ExportNamedDeclaration',
|
|
1312
1314
|
].includes(node.type) &&
|
|
1313
1315
|
/** @type {import('estree').FunctionDeclaration} */
|
|
1314
1316
|
(
|
|
@@ -1342,8 +1344,11 @@ const getUtils = (
|
|
|
1342
1344
|
return jsdocUtils.getPreferredTagName(
|
|
1343
1345
|
jsdoc, {
|
|
1344
1346
|
...args,
|
|
1345
|
-
context,
|
|
1346
|
-
|
|
1347
|
+
context,
|
|
1348
|
+
mode,
|
|
1349
|
+
report,
|
|
1350
|
+
tagNamePreference,
|
|
1351
|
+
},
|
|
1347
1352
|
);
|
|
1348
1353
|
};
|
|
1349
1354
|
|
|
@@ -1536,7 +1541,7 @@ const getUtils = (
|
|
|
1536
1541
|
/** @type {HasYieldValue} */
|
|
1537
1542
|
utils.hasYieldValue = () => {
|
|
1538
1543
|
if ([
|
|
1539
|
-
'
|
|
1544
|
+
'ExportDefaultDeclaration', 'ExportNamedDeclaration',
|
|
1540
1545
|
].includes(/** @type {Node} */ (node).type)) {
|
|
1541
1546
|
return jsdocUtils.hasYieldValue(
|
|
1542
1547
|
/** @type {import('estree').Declaration|import('estree').Expression} */ (
|
|
@@ -1647,9 +1652,12 @@ const getUtils = (
|
|
|
1647
1652
|
utils.forEachPreferredTag = (tagName, arrayHandler, skipReportingBlockedTag) => {
|
|
1648
1653
|
return jsdocUtils.forEachPreferredTag(
|
|
1649
1654
|
jsdoc, tagName, arrayHandler, {
|
|
1655
|
+
context,
|
|
1656
|
+
mode,
|
|
1657
|
+
report,
|
|
1650
1658
|
skipReportingBlockedTag,
|
|
1651
|
-
|
|
1652
|
-
}
|
|
1659
|
+
tagNamePreference,
|
|
1660
|
+
},
|
|
1653
1661
|
);
|
|
1654
1662
|
};
|
|
1655
1663
|
|
|
@@ -1722,11 +1730,34 @@ const getUtils = (
|
|
|
1722
1730
|
*/
|
|
1723
1731
|
|
|
1724
1732
|
/**
|
|
1725
|
-
* @
|
|
1733
|
+
* @typedef {{
|
|
1734
|
+
* settings?: {
|
|
1735
|
+
* jsdoc?: {
|
|
1736
|
+
* ignorePrivate: boolean,
|
|
1737
|
+
* ignoreInternal: boolean,
|
|
1738
|
+
* maxLines: Integer,
|
|
1739
|
+
* minLines: Integer,
|
|
1740
|
+
* tagNamePreference: import('./jsdocUtils.js').TagNamePreference,
|
|
1741
|
+
* preferredTypes: PreferredTypes,
|
|
1742
|
+
* structuredTags: StructuredTags,
|
|
1743
|
+
* overrideReplacesDocs: boolean,
|
|
1744
|
+
* ignoreReplacesDocs: boolean,
|
|
1745
|
+
* implementsReplacesDocs: boolean,
|
|
1746
|
+
* augmentsExtendsReplacesDocs: boolean,
|
|
1747
|
+
* exemptDestructuredRootsFromChecks: boolean,
|
|
1748
|
+
* mode: import('./jsdocUtils.js').ParserMode,
|
|
1749
|
+
* contexts: Context[],
|
|
1750
|
+
* }
|
|
1751
|
+
* }
|
|
1752
|
+
* }} JSDocSettings
|
|
1753
|
+
*/
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* @param {import('eslint').Rule.RuleContext & JSDocSettings} context
|
|
1726
1757
|
* @returns {Settings|false}
|
|
1727
1758
|
*/
|
|
1728
1759
|
const getSettings = (context) => {
|
|
1729
|
-
/*
|
|
1760
|
+
/* eslint-disable perfectionist/sort-objects */
|
|
1730
1761
|
const settings = {
|
|
1731
1762
|
// All rules
|
|
1732
1763
|
ignorePrivate: Boolean(context.settings.jsdoc?.ignorePrivate),
|
|
@@ -1759,7 +1790,7 @@ const getSettings = (context) => {
|
|
|
1759
1790
|
// Many rules
|
|
1760
1791
|
contexts: context.settings.jsdoc?.contexts,
|
|
1761
1792
|
};
|
|
1762
|
-
/*
|
|
1793
|
+
/* eslint-enable perfectionist/sort-objects */
|
|
1763
1794
|
|
|
1764
1795
|
jsdocUtils.setTagStructure(settings.mode);
|
|
1765
1796
|
try {
|
|
@@ -1822,7 +1853,6 @@ const makeReport = (context, commentNode) => {
|
|
|
1822
1853
|
},
|
|
1823
1854
|
};
|
|
1824
1855
|
|
|
1825
|
-
// Todo: Remove ignore once `check-examples` can be restored for ESLint 8+
|
|
1826
1856
|
if ('column' in jsdocLoc && typeof jsdocLoc.column === 'number') {
|
|
1827
1857
|
const colNumber = /** @type {import('eslint').AST.SourceLocation} */ (
|
|
1828
1858
|
commentNode.loc
|
|
@@ -2189,7 +2219,6 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveCommentContext
|
|
|
2189
2219
|
};
|
|
2190
2220
|
|
|
2191
2221
|
return {
|
|
2192
|
-
// @ts-expect-error ESLint accepts
|
|
2193
2222
|
create (context) {
|
|
2194
2223
|
/* c8 ignore next -- Fallback to deprecated method */
|
|
2195
2224
|
const {
|
|
@@ -2302,7 +2331,7 @@ const checkFile = (iterator, ruleConfig) => {
|
|
|
2302
2331
|
export {
|
|
2303
2332
|
getSettings,
|
|
2304
2333
|
// dslint-disable-next-line unicorn/prefer-export-from -- Avoid experimental parser
|
|
2305
|
-
|
|
2334
|
+
|
|
2306
2335
|
};
|
|
2307
2336
|
|
|
2308
2337
|
/**
|
|
@@ -2313,7 +2342,7 @@ export {
|
|
|
2313
2342
|
export default function iterateJsdoc (iterator, ruleConfig) {
|
|
2314
2343
|
const metaType = ruleConfig?.meta?.type;
|
|
2315
2344
|
if (!metaType || ![
|
|
2316
|
-
'
|
|
2345
|
+
'layout', 'problem', 'suggestion',
|
|
2317
2346
|
].includes(metaType)) {
|
|
2318
2347
|
throw new TypeError('Rule must include `meta.type` option (with value "problem", "suggestion", or "layout")');
|
|
2319
2348
|
}
|
|
@@ -2483,3 +2512,7 @@ export default function iterateJsdoc (iterator, ruleConfig) {
|
|
|
2483
2512
|
meta: ruleConfig.meta,
|
|
2484
2513
|
};
|
|
2485
2514
|
}
|
|
2515
|
+
|
|
2516
|
+
export {
|
|
2517
|
+
parseComment,
|
|
2518
|
+
} from '@es-joy/jsdoccomment';
|