eslint-plugin-jsdoc 60.5.0 → 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 (77) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
  3. package/dist/generateDocs.cjs +5 -6
  4. package/dist/generateDocs.cjs.map +1 -1
  5. package/dist/index-cjs.cjs +4 -1
  6. package/dist/index-cjs.cjs.map +1 -1
  7. package/dist/index.cjs +4 -1
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/rules/checkLineAlignment.cjs +1 -2
  10. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  11. package/dist/rules/convertToJsdocComments.cjs +2 -4
  12. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  13. package/dist/rules/emptyTags.cjs +1 -2
  14. package/dist/rules/emptyTags.cjs.map +1 -1
  15. package/dist/rules/escapeInlineTags.cjs +149 -0
  16. package/dist/rules/escapeInlineTags.cjs.map +1 -0
  17. package/dist/rules/escapeInlineTags.d.ts +3 -0
  18. package/dist/rules/informativeDocs.cjs +3 -6
  19. package/dist/rules/informativeDocs.cjs.map +1 -1
  20. package/dist/rules/linesBeforeBlock.cjs +4 -8
  21. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  22. package/dist/rules/matchDescription.cjs +2 -4
  23. package/dist/rules/matchDescription.cjs.map +1 -1
  24. package/dist/rules/matchName.cjs +1 -2
  25. package/dist/rules/matchName.cjs.map +1 -1
  26. package/dist/rules/multilineBlocks.cjs +3 -6
  27. package/dist/rules/multilineBlocks.cjs.map +1 -1
  28. package/dist/rules/noBadBlocks.cjs +1 -2
  29. package/dist/rules/noBadBlocks.cjs.map +1 -1
  30. package/dist/rules/noTypes.cjs +1 -2
  31. package/dist/rules/noTypes.cjs.map +1 -1
  32. package/dist/rules/requireAsteriskPrefix.cjs +1 -2
  33. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  34. package/dist/rules/requireDescriptionCompleteSentence.cjs +1 -2
  35. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  36. package/dist/rules/requireFileOverview.cjs +1 -3
  37. package/dist/rules/requireFileOverview.cjs.map +1 -1
  38. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -2
  39. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  40. package/dist/rules/requireJsdoc.cjs +3 -6
  41. package/dist/rules/requireJsdoc.cjs.map +1 -1
  42. package/dist/rules/requireParam.cjs +6 -12
  43. package/dist/rules/requireParam.cjs.map +1 -1
  44. package/dist/rules/requireParamName.cjs +1 -2
  45. package/dist/rules/requireParamName.cjs.map +1 -1
  46. package/dist/rules/requireReturns.cjs +1 -2
  47. package/dist/rules/requireReturns.cjs.map +1 -1
  48. package/dist/rules/requireTemplate.cjs +1 -2
  49. package/dist/rules/requireTemplate.cjs.map +1 -1
  50. package/dist/rules/sortTags.cjs +1 -2
  51. package/dist/rules/sortTags.cjs.map +1 -1
  52. package/dist/rules.d.ts +25 -37
  53. package/package.json +8 -8
  54. package/src/index-cjs.js +4 -0
  55. package/src/index.js +4 -0
  56. package/src/rules/checkLineAlignment.js +1 -2
  57. package/src/rules/convertToJsdocComments.js +2 -4
  58. package/src/rules/emptyTags.js +1 -2
  59. package/src/rules/escapeInlineTags.js +189 -0
  60. package/src/rules/informativeDocs.js +3 -6
  61. package/src/rules/linesBeforeBlock.js +4 -8
  62. package/src/rules/matchDescription.js +2 -4
  63. package/src/rules/matchName.js +1 -2
  64. package/src/rules/multilineBlocks.js +3 -6
  65. package/src/rules/noBadBlocks.js +1 -2
  66. package/src/rules/noTypes.js +1 -2
  67. package/src/rules/requireAsteriskPrefix.js +1 -2
  68. package/src/rules/requireDescriptionCompleteSentence.js +1 -2
  69. package/src/rules/requireFileOverview.js +1 -3
  70. package/src/rules/requireHyphenBeforeParamDescription.js +1 -2
  71. package/src/rules/requireJsdoc.js +3 -6
  72. package/src/rules/requireParam.js +6 -12
  73. package/src/rules/requireParamName.js +1 -2
  74. package/src/rules/requireReturns.js +1 -2
  75. package/src/rules/requireTemplate.js +1 -2
  76. package/src/rules/sortTags.js +1 -2
  77. package/src/rules.d.ts +25 -37
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
10
+ context,
11
+ jsdoc,
12
+ settings,
13
+ utils
14
+ }) => {
15
+ const {
16
+ mode
17
+ } = settings;
18
+ if (mode !== 'typescript') {
19
+ return;
20
+ }
21
+ const {
22
+ allowedInlineTags = [],
23
+ enableFixer = false,
24
+ fixType = 'backslash'
25
+ } = context.options[0] || {};
26
+ const {
27
+ description
28
+ } = utils.getDescription();
29
+
30
+ /** @type {string[]} */
31
+ const tagNames = [];
32
+
33
+ /** @type {number[]} */
34
+ const indexes = [];
35
+ const unescapedInlineTagRegex = /(?:^|\s)@(\w+)/gv;
36
+ for (const [idx, descLine] of (description.startsWith('\n') ? description.slice(1) : description).split('\n').entries()) {
37
+ descLine.replaceAll(unescapedInlineTagRegex, (_, tagName) => {
38
+ if (allowedInlineTags.includes(tagName)) {
39
+ return _;
40
+ }
41
+ tagNames.push(tagName);
42
+ indexes.push(idx);
43
+ return _;
44
+ });
45
+ }
46
+ for (const [idx, tagName] of tagNames.entries()) {
47
+ utils.reportJSDoc(`Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\@${tagName}, or \`@${tagName}\`?`, {
48
+ line: indexes[idx] + 1
49
+ }, enableFixer ? () => {
50
+ utils.setBlockDescription((info, seedTokens, descLines) => {
51
+ return descLines.map(desc => {
52
+ const newDesc = desc.replaceAll(new RegExp(`(^|\\s)@${
53
+ // No need to escape, as contains only safe characters
54
+ tagName}`, 'gv'), fixType === 'backticks' ? '$1`@' + tagName + '`' : '$1\\@' + tagName);
55
+ return {
56
+ number: 0,
57
+ source: '',
58
+ tokens: seedTokens({
59
+ ...info,
60
+ description: newDesc,
61
+ postDelimiter: newDesc.trim() ? ' ' : ''
62
+ })
63
+ };
64
+ });
65
+ });
66
+ } : null);
67
+ }
68
+
69
+ /**
70
+ * @param {string} tagName
71
+ * @returns {[
72
+ * RegExp,
73
+ * (description: string) => string
74
+ * ]}
75
+ */
76
+ const escapeInlineTags = tagName => {
77
+ const regex = new RegExp(`(^|\\s)@${
78
+ // No need to escape, as contains only safe characters
79
+ tagName}`, 'gv');
80
+ return [regex,
81
+ /**
82
+ * @param {string} desc
83
+ */
84
+ desc => {
85
+ return desc.replaceAll(regex, fixType === 'backticks' ? '$1`@' + tagName + '`' : '$1\\@' + tagName);
86
+ }];
87
+ };
88
+ for (const tag of jsdoc.tags) {
89
+ if (tag.tag === 'example') {
90
+ continue;
91
+ }
92
+
93
+ /** @type {string} */
94
+ let tagName = '';
95
+ while (/** @type {string[]} */utils.getTagDescription(tag, true)
96
+ // eslint-disable-next-line no-loop-func -- Safe
97
+ .some(desc => {
98
+ tagName = unescapedInlineTagRegex.exec(desc)?.[1] ?? '';
99
+ if (allowedInlineTags.includes(tagName)) {
100
+ return false;
101
+ }
102
+ return tagName;
103
+ })) {
104
+ const line = utils.setTagDescription(tag, ...escapeInlineTags(tagName)) + tag.source[0].number;
105
+ utils.reportJSDoc(`Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\@${tagName}, or \`@${tagName}\`?`, {
106
+ line
107
+ }, enableFixer ? () => {} : null, true);
108
+ }
109
+ }
110
+ }, {
111
+ iterateAllJsdocs: true,
112
+ meta: {
113
+ docs: {
114
+ description: 'Reports use of JSDoc tags in non-tag positions (in the default "typescript" mode).',
115
+ url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/escape-inline-tags.md#repos-sticky-header'
116
+ },
117
+ fixable: 'code',
118
+ schema: [{
119
+ additionalProperties: false,
120
+ properties: {
121
+ allowedInlineTags: {
122
+ description: 'A listing of tags you wish to allow unescaped. Defaults to an empty array.',
123
+ items: {
124
+ type: 'string'
125
+ },
126
+ type: 'array'
127
+ },
128
+ enableFixer: {
129
+ description: 'Whether to enable the fixer. Defaults to `false`.',
130
+ type: 'boolean'
131
+ },
132
+ fixType: {
133
+ description: `How to escape the inline tag.
134
+
135
+ May be "backticks" to enclose tags in backticks (treating as code segments), or
136
+ "backslash" to escape tags with a backslash, i.e., \`\\@\`
137
+
138
+ Defaults to "backslash".`,
139
+ enum: ['backticks', 'backslash'],
140
+ type: 'string'
141
+ }
142
+ },
143
+ type: 'object'
144
+ }],
145
+ type: 'suggestion'
146
+ }
147
+ });
148
+ module.exports = exports.default;
149
+ //# sourceMappingURL=escapeInlineTags.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escapeInlineTags.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","jsdoc","settings","utils","mode","allowedInlineTags","enableFixer","fixType","options","description","getDescription","tagNames","indexes","unescapedInlineTagRegex","idx","descLine","startsWith","slice","split","entries","replaceAll","_","tagName","includes","push","reportJSDoc","line","setBlockDescription","info","seedTokens","descLines","map","desc","newDesc","RegExp","number","source","tokens","postDelimiter","trim","escapeInlineTags","regex","tag","tags","getTagDescription","some","exec","setTagDescription","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","type","enum","module"],"sources":["../../src/rules/escapeInlineTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n settings,\n utils,\n}) => {\n const {\n mode,\n } = settings;\n\n if (mode !== 'typescript') {\n return;\n }\n\n const {\n allowedInlineTags = [],\n enableFixer = false,\n fixType = 'backslash',\n } = context.options[0] || {};\n\n const {\n description,\n } = utils.getDescription();\n\n /** @type {string[]} */\n const tagNames = [];\n\n /** @type {number[]} */\n const indexes = [];\n\n const unescapedInlineTagRegex = /(?:^|\\s)@(\\w+)/gv;\n for (const [\n idx,\n descLine,\n ] of (\n description.startsWith('\\n') ? description.slice(1) : description\n ).split('\\n').entries()\n ) {\n descLine.replaceAll(unescapedInlineTagRegex, (_, tagName) => {\n if (allowedInlineTags.includes(tagName)) {\n return _;\n }\n\n tagNames.push(tagName);\n indexes.push(idx);\n\n return _;\n });\n }\n\n for (const [\n idx,\n tagName,\n ] of tagNames.entries()) {\n utils.reportJSDoc(\n `Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\\\@${tagName}, or \\`@${tagName}\\`?`,\n {\n line: indexes[idx] + 1,\n },\n enableFixer ?\n () => {\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return descLines.map((desc) => {\n const newDesc = desc.replaceAll(\n new RegExp(`(^|\\\\s)@${\n // No need to escape, as contains only safe characters\n tagName\n }`, 'gv'),\n fixType === 'backticks' ? '$1`@' + tagName + '`' : '$1\\\\@' + tagName,\n );\n\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: newDesc,\n postDelimiter: newDesc.trim() ? ' ' : '',\n }),\n };\n });\n });\n } :\n null,\n );\n }\n\n /**\n * @param {string} tagName\n * @returns {[\n * RegExp,\n * (description: string) => string\n * ]}\n */\n const escapeInlineTags = (tagName) => {\n const regex = new RegExp(`(^|\\\\s)@${\n // No need to escape, as contains only safe characters\n tagName\n }`, 'gv');\n\n return [\n regex,\n /**\n * @param {string} desc\n */\n (desc) => {\n return desc.replaceAll(\n regex,\n fixType === 'backticks' ? '$1`@' + tagName + '`' : '$1\\\\@' + tagName,\n );\n },\n ];\n };\n\n for (const tag of jsdoc.tags) {\n if (tag.tag === 'example') {\n continue;\n }\n\n /** @type {string} */\n let tagName = '';\n while (/** @type {string[]} */ (\n utils.getTagDescription(tag, true)\n // eslint-disable-next-line no-loop-func -- Safe\n ).some((desc) => {\n tagName = unescapedInlineTagRegex.exec(desc)?.[1] ?? '';\n if (allowedInlineTags.includes(tagName)) {\n return false;\n }\n\n return tagName;\n })) {\n const line = utils.setTagDescription(tag, ...escapeInlineTags(tagName)) +\n tag.source[0].number;\n utils.reportJSDoc(\n `Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\\\@${tagName}, or \\`@${tagName}\\`?`,\n {\n line,\n },\n enableFixer ? () => {} : null,\n true,\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports use of JSDoc tags in non-tag positions (in the default \"typescript\" mode).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/escape-inline-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedInlineTags: {\n description: 'A listing of tags you wish to allow unescaped. Defaults to an empty array.',\n items: {\n type: 'string',\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `false`.',\n type: 'boolean',\n },\n fixType: {\n description: `How to escape the inline tag.\n\nMay be \"backticks\" to enclose tags in backticks (treating as code segments), or\n\"backslash\" to escape tags with a backslash, i.e., \\`\\\\@\\`\n\nDefaults to \"backslash\".`,\n enum: [\n 'backticks',\n 'backslash',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC;EACF,CAAC,GAAGF,QAAQ;EAEZ,IAAIE,IAAI,KAAK,YAAY,EAAE;IACzB;EACF;EAEA,MAA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+1,3 @@
1
+ declare const _default: import("eslint").Rule.RuleModule;
2
+ export default _default;
3
+ //# sourceMappingURL=escapeInlineTags.d.ts.map
@@ -129,8 +129,7 @@ The default \`aliases\` option is:
129
129
  {
130
130
  "a": ["an", "our"]
131
131
  }
132
- \`\`\`
133
- `,
132
+ \`\`\``,
134
133
  patternProperties: {
135
134
  '.*': {
136
135
  items: {
@@ -152,8 +151,7 @@ function computeTypes(node) {
152
151
  }
153
152
  \`\`\`
154
153
 
155
- No tags are excluded by default.
156
- `,
154
+ No tags are excluded by default.`,
157
155
  items: {
158
156
  type: 'string'
159
157
  },
@@ -173,8 +171,7 @@ The default \`uselessWords\` option is:
173
171
 
174
172
  \`\`\`json
175
173
  ["a", "an", "i", "in", "of", "s", "the"]
176
- \`\`\`
177
- `,
174
+ \`\`\``,
178
175
  items: {
179
176
  type: 'string'
180
177
  },
@@ -1 +1 @@
1
- {"version":3,"file":"informativeDocs.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_areDocsInformative","e","__esModule","default","defaultAliases","a","defaultUselessWords","getNamesFromNode","node","type","parent","key","id","declaration","name","declarations","init","filter","Boolean","_default","exports","iterateJsdoc","context","jsdoc","report","utils","aliases","excludedTags","uselessWords","options","nodeNames","descriptionIsRedundant","text","extraName","textTrimmed","trim","areDocsInformative","join","description","lastDescriptionLine","getDescription","descriptionReported","tag","tags","includes","reportJSDoc","line","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","patternProperties","items","module"],"sources":["../../src/rules/informativeDocs.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n areDocsInformative,\n} from 'are-docs-informative';\n\nconst defaultAliases = {\n a: [\n 'an', 'our',\n ],\n};\n\nconst defaultUselessWords = [\n 'a', 'an', 'i', 'in', 'of', 's', 'the',\n];\n\n/**\n * @param {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Node|null|undefined} node\n * @returns {string[]}\n */\nconst getNamesFromNode = (node) => {\n switch (node?.type) {\n case 'AccessorProperty':\n case 'MethodDefinition':\n case 'PropertyDefinition':\n case 'TSAbstractAccessorProperty':\n case 'TSAbstractMethodDefinition':\n case 'TSAbstractPropertyDefinition':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node.parent\n ).parent,\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n ),\n ];\n\n case 'ClassDeclaration':\n case 'ClassExpression':\n case 'FunctionDeclaration':\n case 'FunctionExpression':\n case 'TSDeclareFunction':\n case 'TSEnumDeclaration':\n case 'TSEnumMember':\n case 'TSInterfaceDeclaration':\n case 'TSMethodSignature':\n case 'TSModuleDeclaration':\n case 'TSTypeAliasDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ClassDeclaration} */\n (node).id,\n );\n case 'ExportDefaultDeclaration':\n case 'ExportNamedDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ExportNamedDeclaration} */\n (node).declaration,\n );\n case 'Identifier':\n return [\n node.name,\n ];\n case 'Property':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n );\n case 'VariableDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.declarations[0]),\n );\n case 'VariableDeclarator':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.id),\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.init),\n ),\n ].filter(Boolean);\n default:\n return [];\n }\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const /** @type {{aliases: {[key: string]: string[]}, excludedTags: string[], uselessWords: string[]}} */ {\n aliases = defaultAliases,\n excludedTags = [],\n uselessWords = defaultUselessWords,\n } = context.options[0] || {};\n const nodeNames = getNamesFromNode(node);\n\n /**\n * @param {string} text\n * @param {string} extraName\n * @returns {boolean}\n */\n const descriptionIsRedundant = (text, extraName = '') => {\n const textTrimmed = text.trim();\n return Boolean(textTrimmed) && !areDocsInformative(textTrimmed, [\n extraName, nodeNames,\n ].filter(Boolean).join(' '), {\n aliases,\n uselessWords,\n });\n };\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n let descriptionReported = false;\n\n for (const tag of jsdoc.tags) {\n if (excludedTags.includes(tag.tag)) {\n continue;\n }\n\n if (descriptionIsRedundant(tag.description, tag.name)) {\n utils.reportJSDoc(\n 'This tag description only repeats the name it describes.',\n tag,\n );\n }\n\n descriptionReported ||= tag.description === description &&\n /** @type {import('comment-parser').Spec & {line: import('../iterateJsdoc.js').Integer}} */\n (tag).line === lastDescriptionLine;\n }\n\n if (!descriptionReported && descriptionIsRedundant(description)) {\n report('This description only repeats the name it describes.');\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description:\n 'This rule reports doc comments that only restate their attached name.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/informative-docs.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n aliases: {\n description: `The \\`aliases\\` option allows indicating words as synonyms (aliases) of each other.\n\nFor example, with \\`{ aliases: { emoji: [\"smiley\", \"winkey\"] } }\\`, the following comment would be considered uninformative:\n\n\\`\\`\\`js\n/** A smiley/winkey. */\nlet emoji;\n\\`\\`\\`\n\nThe default \\`aliases\\` option is:\n\n\\`\\`\\`json\n{\n \"a\": [\"an\", \"our\"]\n}\n\\`\\`\\`\n`,\n patternProperties: {\n '.*': {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n },\n excludedTags: {\n description: `Tags that should not be checked for valid contents.\n\nFor example, with \\`{ excludedTags: [\"category\"] }\\`, the following comment would not be considered uninformative:\n\n\\`\\`\\`js\n/** @category Types */\nfunction computeTypes(node) {\n // ...\n}\n\\`\\`\\`\n\nNo tags are excluded by default.\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n uselessWords: {\n description: `Words that are ignored when searching for one that adds meaning.\n\nFor example, with \\`{ uselessWords: [\"our\"] }\\`, the following comment would be considered uninformative:\n\n\\`\\`\\`js\n/** Our text. */\nlet text;\n\\`\\`\\`\n\nThe default \\`uselessWords\\` option is:\n\n\\`\\`\\`json\n[\"a\", \"an\", \"i\", \"in\", \"of\", \"s\", \"the\"]\n\\`\\`\\`\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAE8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,cAAc,GAAG;EACrBC,CAAC,EAAE,CACD,IAAI,EAAE,KAAK;AAEf,CAAC;AAED,MAAMC,mBAAmB,GAAG,CAC1B,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CACvC;;AAED;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAIC,IAAI,IAAK;EACjC,QAAQA,IAAI,EAAEC,IAAI;IAChB,KAAK,kBAAkB;IACvB,KAAK,kBAAkB;IACvB,KAAK,oBAAoB;IACzB,KAAK,4BAA4B;IACjC,KAAK,4BAA4B;IACjC,KAAK,8BAA8B;MACjC,OAAO,CACL,GAAGF,gBAAgB,CACnB,+DACIC,IAAI,CAACE,MAAM,CACXA,MACJ,CAAC,EACD,GAAGH,gBAAgB,CACnB;MACGC,IAAI,CAACG,GACR,CAAC,CACF;IAEH,KAAK,kBAAkB;IACvB,KAAK,iBAAiB;IACtB,KAAK,qBAAqB;IAC1B,KAAK,oBAAoB;IACzB,KAAK,mBAAmB;IACxB,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ACjB,IAAI,EAAE;cACJC,KAAK,EAAE;gBACL9C,IAAI,EAAE;cACR,CAAC;cACDA,IAAI,EAAE;YACR;UACF;QACF,CAAC;QACDkB,YAAY,EAAE;UACZW,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWiB,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDmB,YAAY,EAAE;UACZU,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWiB,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA+C,MAAA,CAAApC,OAAA,GAAAA,OAAA,CAAAjB,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"informativeDocs.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_areDocsInformative","e","__esModule","default","defaultAliases","a","defaultUselessWords","getNamesFromNode","node","type","parent","key","id","declaration","name","declarations","init","filter","Boolean","_default","exports","iterateJsdoc","context","jsdoc","report","utils","aliases","excludedTags","uselessWords","options","nodeNames","descriptionIsRedundant","text","extraName","textTrimmed","trim","areDocsInformative","join","description","lastDescriptionLine","getDescription","descriptionReported","tag","tags","includes","reportJSDoc","line","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","patternProperties","items","module"],"sources":["../../src/rules/informativeDocs.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n areDocsInformative,\n} from 'are-docs-informative';\n\nconst defaultAliases = {\n a: [\n 'an', 'our',\n ],\n};\n\nconst defaultUselessWords = [\n 'a', 'an', 'i', 'in', 'of', 's', 'the',\n];\n\n/**\n * @param {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Node|null|undefined} node\n * @returns {string[]}\n */\nconst getNamesFromNode = (node) => {\n switch (node?.type) {\n case 'AccessorProperty':\n case 'MethodDefinition':\n case 'PropertyDefinition':\n case 'TSAbstractAccessorProperty':\n case 'TSAbstractMethodDefinition':\n case 'TSAbstractPropertyDefinition':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node.parent\n ).parent,\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n ),\n ];\n\n case 'ClassDeclaration':\n case 'ClassExpression':\n case 'FunctionDeclaration':\n case 'FunctionExpression':\n case 'TSDeclareFunction':\n case 'TSEnumDeclaration':\n case 'TSEnumMember':\n case 'TSInterfaceDeclaration':\n case 'TSMethodSignature':\n case 'TSModuleDeclaration':\n case 'TSTypeAliasDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ClassDeclaration} */\n (node).id,\n );\n case 'ExportDefaultDeclaration':\n case 'ExportNamedDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ExportNamedDeclaration} */\n (node).declaration,\n );\n case 'Identifier':\n return [\n node.name,\n ];\n case 'Property':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n );\n case 'VariableDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.declarations[0]),\n );\n case 'VariableDeclarator':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.id),\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.init),\n ),\n ].filter(Boolean);\n default:\n return [];\n }\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const /** @type {{aliases: {[key: string]: string[]}, excludedTags: string[], uselessWords: string[]}} */ {\n aliases = defaultAliases,\n excludedTags = [],\n uselessWords = defaultUselessWords,\n } = context.options[0] || {};\n const nodeNames = getNamesFromNode(node);\n\n /**\n * @param {string} text\n * @param {string} extraName\n * @returns {boolean}\n */\n const descriptionIsRedundant = (text, extraName = '') => {\n const textTrimmed = text.trim();\n return Boolean(textTrimmed) && !areDocsInformative(textTrimmed, [\n extraName, nodeNames,\n ].filter(Boolean).join(' '), {\n aliases,\n uselessWords,\n });\n };\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n let descriptionReported = false;\n\n for (const tag of jsdoc.tags) {\n if (excludedTags.includes(tag.tag)) {\n continue;\n }\n\n if (descriptionIsRedundant(tag.description, tag.name)) {\n utils.reportJSDoc(\n 'This tag description only repeats the name it describes.',\n tag,\n );\n }\n\n descriptionReported ||= tag.description === description &&\n /** @type {import('comment-parser').Spec & {line: import('../iterateJsdoc.js').Integer}} */\n (tag).line === lastDescriptionLine;\n }\n\n if (!descriptionReported && descriptionIsRedundant(description)) {\n report('This description only repeats the name it describes.');\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description:\n 'This rule reports doc comments that only restate their attached name.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/informative-docs.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n aliases: {\n description: `The \\`aliases\\` option allows indicating words as synonyms (aliases) of each other.\n\nFor example, with \\`{ aliases: { emoji: [\"smiley\", \"winkey\"] } }\\`, the following comment would be considered uninformative:\n\n\\`\\`\\`js\n/** A smiley/winkey. */\nlet emoji;\n\\`\\`\\`\n\nThe default \\`aliases\\` option is:\n\n\\`\\`\\`json\n{\n \"a\": [\"an\", \"our\"]\n}\n\\`\\`\\``,\n patternProperties: {\n '.*': {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n },\n excludedTags: {\n description: `Tags that should not be checked for valid contents.\n\nFor example, with \\`{ excludedTags: [\"category\"] }\\`, the following comment would not be considered uninformative:\n\n\\`\\`\\`js\n/** @category Types */\nfunction computeTypes(node) {\n // ...\n}\n\\`\\`\\`\n\nNo tags are excluded by default.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n uselessWords: {\n description: `Words that are ignored when searching for one that adds meaning.\n\nFor example, with \\`{ uselessWords: [\"our\"] }\\`, the following comment would be considered uninformative:\n\n\\`\\`\\`js\n/** Our text. */\nlet text;\n\\`\\`\\`\n\nThe default \\`uselessWords\\` option is:\n\n\\`\\`\\`json\n[\"a\", \"an\", \"i\", \"in\", \"of\", \"s\", \"the\"]\n\\`\\`\\``,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAE8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,cAAc,GAAG;EACrBC,CAAC,EAAE,CACD,IAAI,EAAE,KAAK;AAEf,CAAC;AAED,MAAMC,mBAAmB,GAAG,CAC1B,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CACvC;;AAED;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAIC,IAAI,IAAK;EACjC,QAAQA,IAAI,EAAEC,IAAI;IAChB,KAAK,kBAAkB;IACvB,KAAK,kBAAkB;IACvB,KAAK,oBAAoB;IACzB,KAAK,4BAA4B;IACjC,KAAK,4BAA4B;IACjC,KAAK,8BAA8B;MACjC,OAAO,CACL,GAAGF,gBAAgB,CACnB,+DACIC,IAAI,CAACE,MAAM,CACXA,MACJ,CAAC,EACD,GAAGH,gBAAgB,CACnB;MACGC,IAAI,CAACG,GACR,CAAC,CACF;IAEH,KAAK,kBAAkB;IACvB,KAAK,iBAAiB;IACtB,KAAK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AACA;AACA;AACA;AACA;AACA,OAAO;UACKgB,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJC,KAAK,EAAE;gBACL9C,IAAI,EAAE;cACR,CAAC;cACDA,IAAI,EAAE;YACR;UACF;QACF,CAAC;QACDkB,YAAY,EAAE;UACZW,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;UACrBiB,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDmB,YAAY,EAAE;UACZU,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiB,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA+C,MAAA,CAAApC,OAAA,GAAAA,OAAA,CAAAjB,OAAA","ignoreList":[]}
@@ -84,15 +84,13 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
84
84
  properties: {
85
85
  checkBlockStarts: {
86
86
  description: `Whether to additionally check the start of blocks, such as classes or functions.
87
- Defaults to \`false\`.
88
- `,
87
+ Defaults to \`false\`.`,
89
88
  type: 'boolean'
90
89
  },
91
90
  excludedTags: {
92
91
  description: `An array of tags whose presence in the JSDoc block will prevent the
93
92
  application of the rule. Defaults to \`['type']\` (i.e., if \`@type\` is present,
94
- lines before the block will not be added).
95
- `,
93
+ lines before the block will not be added).`,
96
94
  items: {
97
95
  type: 'string'
98
96
  },
@@ -100,14 +98,12 @@ lines before the block will not be added).
100
98
  },
101
99
  ignoreSameLine: {
102
100
  description: `This option excludes cases where the JSDoc block occurs on the same line as a
103
- preceding code or comment. Defaults to \`true\`.
104
- `,
101
+ preceding code or comment. Defaults to \`true\`.`,
105
102
  type: 'boolean'
106
103
  },
107
104
  ignoreSingleLines: {
108
105
  description: `This option excludes cases where the JSDoc block is only one line long.
109
- Defaults to \`true\`.
110
- `,
106
+ Defaults to \`true\`.`,
111
107
  type: 'boolean'
112
108
  },
113
109
  lines: {
@@ -1 +1 @@
1
- {"version":3,"file":"linesBeforeBlock.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","startPunctuators","Set","_default","exports","iterateJsdoc","context","jsdocNode","report","sourceCode","utils","checkBlockStarts","excludedTags","ignoreSameLine","ignoreSingleLines","lines","options","hasATag","tokensBefore","getTokensBefore","includeComments","tokenBefore","at","type","has","value","loc","end","line","start","startLine","sameLine","fix","fixer","indent","spaceDiff","column","match","slice","tokenPrior","startColumn","pop","repeat","insertTextAfter","iterateAllJsdocs","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/linesBeforeBlock.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * Punctuators that begin a logical group should not require a line before it skipped. Specifically\n * `[` starts an array, `{` starts an object or block, `(` starts a grouping, and `=` starts a\n * declaration (like a variable or a type alias).\n */\nconst startPunctuators = new Set([\n '(', '=', '[', '{',\n]);\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n utils,\n}) => {\n const {\n checkBlockStarts,\n excludedTags = [\n 'type',\n ],\n ignoreSameLine = true,\n ignoreSingleLines = true,\n lines = 1,\n } = context.options[0] || {};\n\n if (utils.hasATag(excludedTags)) {\n return;\n }\n\n const tokensBefore = sourceCode.getTokensBefore(jsdocNode, {\n includeComments: true,\n });\n const tokenBefore = tokensBefore.at(-1);\n if (\n !tokenBefore || (\n tokenBefore.type === 'Punctuator' &&\n !checkBlockStarts &&\n startPunctuators.has(tokenBefore.value)\n )\n ) {\n return;\n }\n\n if (tokenBefore.loc?.end?.line + lines >=\n /** @type {number} */\n (jsdocNode.loc?.start?.line)\n ) {\n const startLine = jsdocNode.loc?.start?.line;\n const sameLine = tokenBefore.loc?.end?.line === startLine;\n\n if (sameLine && ignoreSameLine) {\n return;\n }\n\n if (ignoreSingleLines && jsdocNode.loc?.start.line === jsdocNode.loc?.end.line) {\n return;\n }\n\n /** @type {import('eslint').Rule.ReportFixer} */\n const fix = (fixer) => {\n let indent = '';\n if (sameLine) {\n const spaceDiff = /** @type {number} */ (jsdocNode.loc?.start?.column) -\n /** @type {number} */ (tokenBefore.loc?.end?.column);\n // @ts-expect-error Should be a comment\n indent = /** @type {import('estree').Comment} */ (\n jsdocNode\n ).value.match(/^\\*\\n([\\t ]*) \\*/v)?.[1]?.slice(spaceDiff);\n if (!indent) {\n /** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */\n let tokenPrior = tokenBefore;\n let startColumn;\n while (tokenPrior && tokenPrior?.loc?.start?.line === startLine) {\n startColumn = tokenPrior.loc?.start?.column;\n tokenPrior = tokensBefore.pop();\n }\n\n indent = ' '.repeat(\n /* c8 ignore next */\n /** @type {number} */ (startColumn ? startColumn - 1 : 0),\n );\n }\n }\n\n return fixer.insertTextAfter(\n /** @type {import('eslint').AST.Token} */\n (tokenBefore),\n '\\n'.repeat(lines) +\n (sameLine ? '\\n' + indent : ''),\n );\n };\n\n report(`Required ${lines} line(s) before JSDoc block`, fix);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces minimum number of newlines before JSDoc comment blocks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkBlockStarts: {\n description: `Whether to additionally check the start of blocks, such as classes or functions.\nDefaults to \\`false\\`.\n`,\n type: 'boolean',\n },\n excludedTags: {\n description: `An array of tags whose presence in the JSDoc block will prevent the\napplication of the rule. Defaults to \\`['type']\\` (i.e., if \\`@type\\` is present,\nlines before the block will not be added).\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreSameLine: {\n description: `This option excludes cases where the JSDoc block occurs on the same line as a\npreceding code or comment. Defaults to \\`true\\`.\n`,\n type: 'boolean',\n },\n ignoreSingleLines: {\n description: `This option excludes cases where the JSDoc block is only one line long.\nDefaults to \\`true\\`.\n`,\n type: 'boolean',\n },\n lines: {\n description: 'The minimum number of lines to require. Defaults to 1.',\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CACnB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEY,IAAAK,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,SAAS;EACTC,MAAM;EACNC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,gBAAgB;IAChBC,YAAY,GAAG,CACb,MAAM,CACP;IACDC,cAAc,GAAG,IAAI;IACrBC,iBAAiB,GAAG,IAAI;IACxBC,KAAK,GAAG;EACV,CAAC,GAAGT,OAAO,CAACU,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,IAAIN,KAAK,CAACO,OAAO,CAACL,YAAY,CAAC,EAAE;IAC/B;EACF;EAEA,MAAMM,YAAY,GAAGT,UAAU,CAACU,eAAe,CAACZ,SAAS,EAAE;IACzDa,eAAe,EAAE;EACnB,CAAC,CAAC;EACF,MAAMC,WAAW,GAAGH,YAAY,CAACI,EAAE,CAAC,CAAC,CAAC,CAAC;EACvC,IACE,CAACD,WAAW,IACVA,WAAW,CAACE,IAAI,KAAK,YAAY,IACjC,CAACZ,gBAAgB,IACjBV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 {"version":3,"file":"linesBeforeBlock.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","startPunctuators","Set","_default","exports","iterateJsdoc","context","jsdocNode","report","sourceCode","utils","checkBlockStarts","excludedTags","ignoreSameLine","ignoreSingleLines","lines","options","hasATag","tokensBefore","getTokensBefore","includeComments","tokenBefore","at","type","has","value","loc","end","line","start","startLine","sameLine","fix","fixer","indent","spaceDiff","column","match","slice","tokenPrior","startColumn","pop","repeat","insertTextAfter","iterateAllJsdocs","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/linesBeforeBlock.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * Punctuators that begin a logical group should not require a line before it skipped. Specifically\n * `[` starts an array, `{` starts an object or block, `(` starts a grouping, and `=` starts a\n * declaration (like a variable or a type alias).\n */\nconst startPunctuators = new Set([\n '(', '=', '[', '{',\n]);\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n utils,\n}) => {\n const {\n checkBlockStarts,\n excludedTags = [\n 'type',\n ],\n ignoreSameLine = true,\n ignoreSingleLines = true,\n lines = 1,\n } = context.options[0] || {};\n\n if (utils.hasATag(excludedTags)) {\n return;\n }\n\n const tokensBefore = sourceCode.getTokensBefore(jsdocNode, {\n includeComments: true,\n });\n const tokenBefore = tokensBefore.at(-1);\n if (\n !tokenBefore || (\n tokenBefore.type === 'Punctuator' &&\n !checkBlockStarts &&\n startPunctuators.has(tokenBefore.value)\n )\n ) {\n return;\n }\n\n if (tokenBefore.loc?.end?.line + lines >=\n /** @type {number} */\n (jsdocNode.loc?.start?.line)\n ) {\n const startLine = jsdocNode.loc?.start?.line;\n const sameLine = tokenBefore.loc?.end?.line === startLine;\n\n if (sameLine && ignoreSameLine) {\n return;\n }\n\n if (ignoreSingleLines && jsdocNode.loc?.start.line === jsdocNode.loc?.end.line) {\n return;\n }\n\n /** @type {import('eslint').Rule.ReportFixer} */\n const fix = (fixer) => {\n let indent = '';\n if (sameLine) {\n const spaceDiff = /** @type {number} */ (jsdocNode.loc?.start?.column) -\n /** @type {number} */ (tokenBefore.loc?.end?.column);\n // @ts-expect-error Should be a comment\n indent = /** @type {import('estree').Comment} */ (\n jsdocNode\n ).value.match(/^\\*\\n([\\t ]*) \\*/v)?.[1]?.slice(spaceDiff);\n if (!indent) {\n /** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */\n let tokenPrior = tokenBefore;\n let startColumn;\n while (tokenPrior && tokenPrior?.loc?.start?.line === startLine) {\n startColumn = tokenPrior.loc?.start?.column;\n tokenPrior = tokensBefore.pop();\n }\n\n indent = ' '.repeat(\n /* c8 ignore next */\n /** @type {number} */ (startColumn ? startColumn - 1 : 0),\n );\n }\n }\n\n return fixer.insertTextAfter(\n /** @type {import('eslint').AST.Token} */\n (tokenBefore),\n '\\n'.repeat(lines) +\n (sameLine ? '\\n' + indent : ''),\n );\n };\n\n report(`Required ${lines} line(s) before JSDoc block`, fix);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces minimum number of newlines before JSDoc comment blocks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkBlockStarts: {\n description: `Whether to additionally check the start of blocks, such as classes or functions.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n excludedTags: {\n description: `An array of tags whose presence in the JSDoc block will prevent the\napplication of the rule. Defaults to \\`['type']\\` (i.e., if \\`@type\\` is present,\nlines before the block will not be added).`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreSameLine: {\n description: `This option excludes cases where the JSDoc block occurs on the same line as a\npreceding code or comment. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n ignoreSingleLines: {\n description: `This option excludes cases where the JSDoc block is only one line long.\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n lines: {\n description: 'The minimum number of lines to require. Defaults to 1.',\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CACnB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEY,IAAAK,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,SAAS;EACTC,MAAM;EACNC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,gBAAgB;IAChBC,YAAY,GAAG,CACb,MAAM,CACP;IACDC,cAAc,GAAG,IAAI;IACrBC,iBAAiB,GAAG,IAAI;IACxBC,KAAK,GAAG;EACV,CAAC,GAAGT,OAAO,CAACU,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,IAAIN,KAAK,CAACO,OAAO,CAACL,YAAY,CAAC,EAAE;IAC/B;EACF;EAEA,MAAMM,YAAY,GAAGT,UAAU,CAACU,eAAe,CAACZ,SAAS,EAAE;IACzDa,eAAe,EAAE;EACnB,CAAC,CAAC;EACF,MAAMC,WAAW,GAAGH,YAAY,CAACI,EAAE,CAAC,CAAC,CAAC,CAAC;EACvC,IACE,CAACD,WAAW,IACVA,WAAW,CAACE,IAAI,KAAK,YAAY,IACjC,CAACZ,gBAAgB,IACjBV,gBAAgB,CAACuB,GAAG,CAACH,WAAW,CAACI,KAAK,CACvC,EACD;IACA;EACF;EAEA,IAAIJ,WAAW,CAACK,GAAG,EAAEC,GAAG,EAAEC,IAAI,GAAGb,KAAK,KACtC;EACKR,SAAS,CAACmB,G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CAC1B;MACCtB,WAAW,EACZ,IAAI,CAACqB,MAAM,CAAC3B,KAAK,CAAC,IACjBgB,QAAQ,GAAG,IAAI,GAAGG,MAAM,GAAG,EAAE,CAChC,CAAC;IACH,CAAC;IAED1B,MAAM,CAAC,YAAYO,KAAK,6BAA6B,EAAEiB,GAAG,CAAC;EAC7D;AACF,CAAC,EAAE;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,iEAAiE;MAC9EC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVzC,gBAAgB,EAAE;UAChBoC,WAAW,EAAE;AACzB,uBAAuB;UACXxB,IAAI,EAAE;QACR,CAAC;QACDX,YAAY,EAAE;UACZmC,WAAW,EAAE;AACzB;AACA,2CAA2C;UAC/BM,KAAK,EAAE;YACL9B,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDV,cAAc,EAAE;UACdkC,WAAW,EAAE;AACzB,iDAAiD;UACrCxB,IAAI,EAAE;QACR,CAAC;QACDT,iBAAiB,EAAE;UACjBiC,WAAW,EAAE;AACzB,sBAAsB;UACVxB,IAAI,EAAE;QACR,CAAC;QACDR,KAAK,EAAE;UACLgC,WAAW,EAAE,wDAAwD;UACrExB,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA+B,MAAA,CAAAlD,OAAA,GAAAA,OAAA,CAAAJ,OAAA","ignoreList":[]}
@@ -147,8 +147,7 @@ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclarati
147
147
  JSDoc block throughout your files.
148
148
 
149
149
  See the ["AST and Selectors"](../#advanced-ast-and-selectors)
150
- section of our Advanced docs for more on the expected format.
151
- `,
150
+ section of our Advanced docs for more on the expected format.`,
152
151
  items: {
153
152
  anyOf: [{
154
153
  type: 'string'
@@ -255,8 +254,7 @@ literal, e.g., \`/[A-Z].*\\./vi\`.
255
254
  \`\`\`
256
255
 
257
256
  This can be overridden per tag or for the main block description by setting
258
- \`message\` within \`tags\` or \`mainDescription\`, respectively.
259
- `,
257
+ \`message\` within \`tags\` or \`mainDescription\`, respectively.`,
260
258
  type: 'string'
261
259
  },
262
260
  nonemptyTags: {
@@ -1 +1 @@
1
- {"version":3,"file":"matchDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","matchDescriptionDefault","stringOrDefault","value","userDefault","_default","exports","iterateJsdoc","context","jsdoc","report","utils","mainDescription","matchDescription","message","nonemptyTags","tags","options","validateDescription","desc","tag","mainDescriptionMatch","errorMessage","match","Object","hasOwn","tagValue","tagName","regex","getRegexFromString","test","line","source","number","description","getDescription","hasNoTag","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","keys","length","hasOptionTag","Boolean","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum","module"],"sources":["../../src/rules/matchDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^\\n?([A-Z`\\\\d_][\\\\s\\\\S]*[.?!`\\\\p{RGI_Emoji}]\\\\s*)?$';\n\n/**\n * @param {string} value\n * @param {string} userDefault\n * @returns {string}\n */\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n nonemptyTags = true,\n tags = {},\n } = context.options[0] || {};\n\n /**\n * @param {string} desc\n * @param {import('comment-parser').Spec} [tag]\n * @returns {void}\n */\n const validateDescription = (desc, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.hasOwn(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(desc)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n const {\n description,\n } = utils.getDescription();\n if (description) {\n validateDescription(description);\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasNoTag = (tagName) => {\n return !tags[tagName];\n };\n\n for (const tag of [\n 'description',\n 'summary',\n 'file',\n 'classdesc',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasNoTag(targetTagName)) {\n validateDescription(desc, matchingJsdocTag);\n }\n }, true);\n }\n\n if (nonemptyTags) {\n for (const tag of [\n 'copyright',\n 'example',\n 'see',\n 'todo',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n\n if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {\n report(\n 'JSDoc description must not be empty.',\n null,\n matchingJsdocTag,\n );\n }\n });\n }\n }\n\n if (!Object.keys(tags).length) {\n return;\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^[\\- ]*/v, '')\n .trim();\n\n return validateDescription(desc, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(desc, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied (e.g.,\n\\`ClassDeclaration\\` for ES6 classes).\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want the rule to apply to any\nJSDoc block throughout your files.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.\n`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n mainDescription: {\n description: `If you wish to override the main block description without changing the\ndefault \\`match-description\\` (which can cascade to the \\`tags\\` with \\`true\\`),\nyou may use \\`mainDescription\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: '[A-Z].*\\\\\\\\.',\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\`\n\nThere is no need to add \\`mainDescription: true\\`, as by default, the main\nblock description (and only the main block description) is linted, though you\nmay disable checking it by setting it to \\`false\\`.\n\nYou may also provide an object with \\`message\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: {\n message: 'Capitalize first word of JSDoc block descriptions',\n match: '[A-Z].*\\\\\\\\.'\n },\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\``,\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n description: `You can supply your own expression to override the default, passing a\n\\`matchDescription\\` string on the options object.\n\nDefaults to using (only) the \\`v\\` flag, so\nto add your own flags, encapsulate your expression as a string, but like a\nliteral, e.g., \\`/[A-Z].*\\\\./vi\\`.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\\\\\.'}]\n}\n\\`\\`\\``,\n format: 'regex',\n type: 'string',\n },\n message: {\n description: `You may provide a custom default message by using the following format:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n message: 'The default description should begin with a capital letter.'\n }]\n}\n\\`\\`\\`\n\nThis can be overridden per tag or for the main block description by setting\n\\`message\\` within \\`tags\\` or \\`mainDescription\\`, respectively.\n`,\n type: 'string',\n },\n nonemptyTags: {\n description: `If not set to \\`false\\`, will enforce that the following tags have at least\nsome content:\n\n- \\`@copyright\\`\n- \\`@example\\`\n- \\`@see\\`\n- \\`@todo\\`\n\nIf you supply your own tag description for any of the above tags in \\`tags\\`,\nyour description will take precedence.`,\n type: 'boolean',\n },\n tags: {\n description: `If you want different regular expressions to apply to tags, you may use\nthe \\`tags\\` option object:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: '\\\\\\\\- [A-Z].*\\\\\\\\.',\n returns: '[A-Z].*\\\\\\\\.'\n }}]\n}\n\\`\\`\\`\n\nIn place of a string, you can also add \\`true\\` to indicate that a particular\ntag should be linted with the \\`matchDescription\\` value (or the default).\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: true,\n returns: true\n }}]\n}\n\\`\\`\\`\n\nAlternatively, you may supply an object with a \\`message\\` property to indicate\nthe error message for that tag.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: {message: 'Begin with a hyphen', match: '\\\\\\\\- [A-Z].*\\\\\\\\.'},\n returns: {message: 'Capitalize for returns (the default)', match: true}\n }}]\n}\n\\`\\`\\`\n\nThe tags \\`@param\\`/\\`@arg\\`/\\`@argument\\` and \\`@property\\`/\\`@prop\\` will be properly\nparsed to ensure that the matched \"description\" text includes only the text\nafter the name.\n\nAll other tags will treat the text following the tag name, a space, and\nan optional curly-bracketed type expression (and another space) as part of\nits \"description\" (e.g., for \\`@returns {someType} some description\\`, the\ndescription is \\`some description\\` while for \\`@some-tag xyz\\`, the description\nis \\`xyz\\`).`,\n patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA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2C,KAAK,EAAE,CACL;kBACEC,MAAM,EAAE,OAAO;kBACfH,IAAI,EAAE;gBACR,CAAC,EACD;kBACEA,IAAI,EAAE;gBACR,CAAC;cAEL,CAAC;cACDlD,OAAO,EAAE;gBACPkD,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDnD,gBAAgB,EAAE;UAChBqB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,MAAM,EAAE,OAAO;UACfH,IAAI,EAAE;QACR,CAAC;QACDlD,OAAO,EAAE;UACPoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACW8B,IAAI,EAAE;QACR,CAAC;QACDjD,YAAY,EAAE;UACZmB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B8B,IAAI,EAAE;QACR,CAAC;QACDhD,IAAI,EAAE;UACJkB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;UACDkC,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,KAAK,EAAE,CACL;gBACEC,MAAM,EAAE,OAAO;gBACfH,IAAI,EAAE;cACR,CAAC,EACD;gBACEK,IAAI,EAAE,CACJ,IAAI,CACL;gBACDL,IAAI,EAAE;cACR,CAAC,EACD;gBACEL,oBAAoB,EAAE,KAAK;gBAC3BC,UAAU,EAAE;kBACVrC,KAAK,EAAE;oBACL2C,KAAK,EAAE,CACL;sBACEC,MAAM,EAAE,OAAO;sBACfH,IAAI,EAAE;oBACR,CAAC,EACD;sBACEK,IAAI,EAAE,CACJ,IAAI,CACL;sBACDL,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACDlD,OAAO,EAAE;oBACPkD,IAAI,EAAE;kBACR;gBACF,CAAC;gBACDA,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAAhE,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"matchDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","matchDescriptionDefault","stringOrDefault","value","userDefault","_default","exports","iterateJsdoc","context","jsdoc","report","utils","mainDescription","matchDescription","message","nonemptyTags","tags","options","validateDescription","desc","tag","mainDescriptionMatch","errorMessage","match","Object","hasOwn","tagValue","tagName","regex","getRegexFromString","test","line","source","number","description","getDescription","hasNoTag","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","keys","length","hasOptionTag","Boolean","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum","module"],"sources":["../../src/rules/matchDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^\\n?([A-Z`\\\\d_][\\\\s\\\\S]*[.?!`\\\\p{RGI_Emoji}]\\\\s*)?$';\n\n/**\n * @param {string} value\n * @param {string} userDefault\n * @returns {string}\n */\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n nonemptyTags = true,\n tags = {},\n } = context.options[0] || {};\n\n /**\n * @param {string} desc\n * @param {import('comment-parser').Spec} [tag]\n * @returns {void}\n */\n const validateDescription = (desc, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.hasOwn(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(desc)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n const {\n description,\n } = utils.getDescription();\n if (description) {\n validateDescription(description);\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasNoTag = (tagName) => {\n return !tags[tagName];\n };\n\n for (const tag of [\n 'description',\n 'summary',\n 'file',\n 'classdesc',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasNoTag(targetTagName)) {\n validateDescription(desc, matchingJsdocTag);\n }\n }, true);\n }\n\n if (nonemptyTags) {\n for (const tag of [\n 'copyright',\n 'example',\n 'see',\n 'todo',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n\n if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {\n report(\n 'JSDoc description must not be empty.',\n null,\n matchingJsdocTag,\n );\n }\n });\n }\n }\n\n if (!Object.keys(tags).length) {\n return;\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^[\\- ]*/v, '')\n .trim();\n\n return validateDescription(desc, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(desc, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied (e.g.,\n\\`ClassDeclaration\\` for ES6 classes).\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want the rule to apply to any\nJSDoc block throughout your files.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n mainDescription: {\n description: `If you wish to override the main block description without changing the\ndefault \\`match-description\\` (which can cascade to the \\`tags\\` with \\`true\\`),\nyou may use \\`mainDescription\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: '[A-Z].*\\\\\\\\.',\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\`\n\nThere is no need to add \\`mainDescription: true\\`, as by default, the main\nblock description (and only the main block description) is linted, though you\nmay disable checking it by setting it to \\`false\\`.\n\nYou may also provide an object with \\`message\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: {\n message: 'Capitalize first word of JSDoc block descriptions',\n match: '[A-Z].*\\\\\\\\.'\n },\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\``,\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n description: `You can supply your own expression to override the default, passing a\n\\`matchDescription\\` string on the options object.\n\nDefaults to using (only) the \\`v\\` flag, so\nto add your own flags, encapsulate your expression as a string, but like a\nliteral, e.g., \\`/[A-Z].*\\\\./vi\\`.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\\\\\.'}]\n}\n\\`\\`\\``,\n format: 'regex',\n type: 'string',\n },\n message: {\n description: `You may provide a custom default message by using the following format:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n message: 'The default description should begin with a capital letter.'\n }]\n}\n\\`\\`\\`\n\nThis can be overridden per tag or for the main block description by setting\n\\`message\\` within \\`tags\\` or \\`mainDescription\\`, respectively.`,\n type: 'string',\n },\n nonemptyTags: {\n description: `If not set to \\`false\\`, will enforce that the following tags have at least\nsome content:\n\n- \\`@copyright\\`\n- \\`@example\\`\n- \\`@see\\`\n- \\`@todo\\`\n\nIf you supply your own tag description for any of the above tags in \\`tags\\`,\nyour description will take precedence.`,\n type: 'boolean',\n },\n tags: {\n description: `If you want different regular expressions to apply to tags, you may use\nthe \\`tags\\` option object:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: '\\\\\\\\- [A-Z].*\\\\\\\\.',\n returns: '[A-Z].*\\\\\\\\.'\n }}]\n}\n\\`\\`\\`\n\nIn place of a string, you can also add \\`true\\` to indicate that a particular\ntag should be linted with the \\`matchDescription\\` value (or the default).\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: true,\n returns: true\n }}]\n}\n\\`\\`\\`\n\nAlternatively, you may supply an object with a \\`message\\` property to indicate\nthe error message for that tag.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: {message: 'Begin with a hyphen', match: '\\\\\\\\- [A-Z].*\\\\\\\\.'},\n returns: {message: 'Capitalize for returns (the default)', match: true}\n }}]\n}\n\\`\\`\\`\n\nThe tags \\`@param\\`/\\`@arg\\`/\\`@argument\\` and \\`@property\\`/\\`@prop\\` will be properly\nparsed to ensure that the matched \"description\" text includes only the text\nafter the name.\n\nAll other tags will treat the text following the tag name, a space, and\nan optional curly-bracketed type expression (and another space) as part of\nits \"description\" (e.g., for \\`@returns {someType} some description\\`, the\ndescription is \\`some description\\` while for \\`@some-tag xyz\\`, the description\nis \\`xyz\\`).`,\n patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,W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AAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACVrC,KAAK,EAAE;gBACL2C,KAAK,EAAE,CACL;kBACEC,MAAM,EAAE,OAAO;kBACfH,IAAI,EAAE;gBACR,CAAC,EACD;kBACEA,IAAI,EAAE;gBACR,CAAC;cAEL,CAAC;cACDlD,OAAO,EAAE;gBACPkD,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDnD,gBAAgB,EAAE;UAChBqB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,MAAM,EAAE,OAAO;UACfH,IAAI,EAAE;QACR,CAAC;QACDlD,OAAO,EAAE;UACPoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;UACtD8B,IAAI,EAAE;QACR,CAAC;QACDjD,YAAY,EAAE;UACZmB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B8B,IAAI,EAAE;QACR,CAAC;QACDhD,IAAI,EAAE;UACJkB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;UACDkC,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,KAAK,EAAE,CACL;gBACEC,MAAM,EAAE,OAAO;gBACfH,IAAI,EAAE;cACR,CAAC,EACD;gBACEK,IAAI,EAAE,CACJ,IAAI,CACL;gBACDL,IAAI,EAAE;cACR,CAAC,EACD;gBACEL,oBAAoB,EAAE,KAAK;gBAC3BC,UAAU,EAAE;kBACVrC,KAAK,EAAE;oBACL2C,KAAK,EAAE,CACL;sBACEC,MAAM,EAAE,OAAO;sBACfH,IAAI,EAAE;oBACR,CAAC,EACD;sBACEK,IAAI,EAAE,CACJ,IAAI,CACL;sBACDL,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACDlD,OAAO,EAAE;oBACPkD,IAAI,EAAE;kBACR;gBACF,CAAC;gBACDA,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAAhE,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
@@ -100,8 +100,7 @@ fixes found by the likes of \`disallowName\` even when a different tag has the
100
100
  disallowed name. An alternative is to ensure that \`comment\` finds the specific
101
101
  tag of the desired tag and/or name and no \`disallowName\` (or \`allowName\`) is
102
102
  supplied. In such a case, only one error will be reported, but no fixer will
103
- be applied, however.
104
- `,
103
+ be applied, however.`,
105
104
  items: {
106
105
  additionalProperties: false,
107
106
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"matchName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","info","lastIndex","jsdoc","report","utils","match","options","allowName","disallowName","replacement","tags","allowNameRegex","getRegexFromString","disallowNameRegex","applicableTags","includes","getPresentTags","reported","tag","tagName","name","replace","allowed","test","disallowed","hasRegex","fixer","src","source","tokens","message","reportJSDoc","undefined","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","comment","required","module"],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n lastIndex,\n },\n jsdoc,\n report,\n utils,\n}) => {\n const {\n match,\n } = context.options[0] || {};\n if (!match) {\n report('Rule `no-restricted-syntax` is missing a `match` option.');\n\n return;\n }\n\n const {\n allowName,\n disallowName,\n replacement,\n tags = [\n '*',\n ],\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n\n const allowNameRegex = allowName && utils.getRegexFromString(allowName);\n const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);\n\n let applicableTags = jsdoc.tags;\n if (!tags.includes('*')) {\n applicableTags = utils.getPresentTags(tags);\n }\n\n let reported = false;\n for (const tag of applicableTags) {\n const tagName = tag.name.replace(/^\\[/v, '').replace(/(=.*)?\\]$/v, '');\n const allowed = !allowNameRegex || allowNameRegex.test(tagName);\n const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);\n const hasRegex = allowNameRegex || disallowNameRegex;\n if (hasRegex && allowed && !disallowed) {\n continue;\n }\n\n if (!hasRegex && reported) {\n continue;\n }\n\n const fixer = () => {\n for (const src of tag.source) {\n if (src.tokens.name) {\n src.tokens.name = src.tokens.name.replace(\n disallowNameRegex, replacement,\n );\n break;\n }\n }\n };\n\n let {\n message,\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n if (!message) {\n if (hasRegex) {\n message = disallowed ?\n `Only allowing names not matching \\`${disallowNameRegex}\\` but found \"${tagName}\".` :\n `Only allowing names matching \\`${allowNameRegex}\\` but found \"${tagName}\".`;\n } else {\n message = `Prohibited context for \"${tagName}\".`;\n }\n }\n\n utils.reportJSDoc(\n message,\n hasRegex ? tag : null,\n\n // We could match up\n disallowNameRegex && replacement !== undefined ?\n fixer :\n null,\n false,\n {\n // Could also supply `context`, `comment`, `tags`\n allowName,\n disallowName,\n name: tagName,\n },\n );\n if (!hasRegex) {\n reported = true;\n }\n }\n}, {\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n match: {\n description: `\\`match\\` is a required option containing an array of objects which determine\nthe conditions whereby a name is reported as being problematic.\n\nThese objects can have any combination of the following groups of optional\nproperties, all of which act to confine one another.\n\nNote that \\`comment\\`, even if targeting a specific tag, is used to match the\nwhole block. So if a \\`comment\\` finds its specific tag, it may still apply\nfixes found by the likes of \\`disallowName\\` even when a different tag has the\ndisallowed name. An alternative is to ensure that \\`comment\\` finds the specific\ntag of the desired tag and/or name and no \\`disallowName\\` (or \\`allowName\\`) is\nsupplied. In such a case, only one error will be reported, but no fixer will\nbe applied, however.\n`,\n items: {\n additionalProperties: false,\n properties: {\n allowName: {\n description: `Indicates which names are allowed for the given tag (or \\`*\\`).\nAccepts a string regular expression (optionally wrapped between two\n\\`/\\` delimiters followed by optional flags) used to match the name.`,\n type: 'string',\n },\n comment: {\n description: 'As with `context` but AST for the JSDoc block comment and types.',\n type: 'string',\n },\n context: {\n description: `AST to confine the allowing or disallowing to JSDoc blocks\nassociated with a particular context. See the\n[\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n type: 'string',\n },\n disallowName: {\n description: 'As with `allowName` but indicates names that are not allowed.',\n type: 'string',\n },\n message: {\n description: 'An optional custom message to use when there is a match.',\n type: 'string',\n },\n replacement: {\n description: `If \\`disallowName\\` is supplied and this value is present, it\nwill replace the matched \\`disallowName\\` text.`,\n type: 'string',\n },\n tags: {\n description: `This array should include tag names or \\`*\\` to indicate the\n match will apply for all tags (except as confined by any context\n properties). If \\`*\\` is not used, then these rules will only apply to\n the specified tags. If \\`tags\\` is omitted, then \\`*\\` is assumed.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n required: [\n 'match',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE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,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVpC,KAAK,EAAE;UACL+B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWM,KAAK,EAAE;YACLF,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACVlC,SAAS,EAAE;gBACT6B,WAAW,EAAE;AAC/B;AACA,qEAAqE;gBACnDO,IAAI,EAAE;cACR,CAAC;cACDC,OAAO,EAAE;gBACPR,WAAW,EAAE,kEAAkE;gBAC/EO,IAAI,EAAE;cACR,CAAC;cACD5C,OAAO,EAAE;gBACPqC,WAAW,EAAE;AAC/B;AACA;AACA,8DAA8D;gBAC5CO,IAAI,EAAE;cACR,CAAC;cACDnC,YAAY,EAAE;gBACZ4B,WAAW,EAAE,+DAA+D;gBAC5EO,IAAI,EAAE;cACR,CAAC;cACDb,OAAO,EAAE;gBACPM,WAAW,EAAE,0DAA0D;gBACvEO,IAAI,EAAE;cACR,CAAC;cACDlC,WAAW,EAAE;gBACX2B,WAAW,EAAE;AAC/B,gDAAgD;gBAC9BO,IAAI,EAAE;cACR,CAAC;cACDjC,IAAI,EAAE;gBACJ0B,WAAW,EAAE;AAC/B;AACA;AACA,qEAAqE;gBACnDM,KAAK,EAAE;kBACLC,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDE,QAAQ,EAAE,CACR,OAAO,CACR;MACDF,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAjD,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"matchName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","info","lastIndex","jsdoc","report","utils","match","options","allowName","disallowName","replacement","tags","allowNameRegex","getRegexFromString","disallowNameRegex","applicableTags","includes","getPresentTags","reported","tag","tagName","name","replace","allowed","test","disallowed","hasRegex","fixer","src","source","tokens","message","reportJSDoc","undefined","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","comment","required","module"],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n lastIndex,\n },\n jsdoc,\n report,\n utils,\n}) => {\n const {\n match,\n } = context.options[0] || {};\n if (!match) {\n report('Rule `no-restricted-syntax` is missing a `match` option.');\n\n return;\n }\n\n const {\n allowName,\n disallowName,\n replacement,\n tags = [\n '*',\n ],\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n\n const allowNameRegex = allowName && utils.getRegexFromString(allowName);\n const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);\n\n let applicableTags = jsdoc.tags;\n if (!tags.includes('*')) {\n applicableTags = utils.getPresentTags(tags);\n }\n\n let reported = false;\n for (const tag of applicableTags) {\n const tagName = tag.name.replace(/^\\[/v, '').replace(/(=.*)?\\]$/v, '');\n const allowed = !allowNameRegex || allowNameRegex.test(tagName);\n const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);\n const hasRegex = allowNameRegex || disallowNameRegex;\n if (hasRegex && allowed && !disallowed) {\n continue;\n }\n\n if (!hasRegex && reported) {\n continue;\n }\n\n const fixer = () => {\n for (const src of tag.source) {\n if (src.tokens.name) {\n src.tokens.name = src.tokens.name.replace(\n disallowNameRegex, replacement,\n );\n break;\n }\n }\n };\n\n let {\n message,\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n if (!message) {\n if (hasRegex) {\n message = disallowed ?\n `Only allowing names not matching \\`${disallowNameRegex}\\` but found \"${tagName}\".` :\n `Only allowing names matching \\`${allowNameRegex}\\` but found \"${tagName}\".`;\n } else {\n message = `Prohibited context for \"${tagName}\".`;\n }\n }\n\n utils.reportJSDoc(\n message,\n hasRegex ? tag : null,\n\n // We could match up\n disallowNameRegex && replacement !== undefined ?\n fixer :\n null,\n false,\n {\n // Could also supply `context`, `comment`, `tags`\n allowName,\n disallowName,\n name: tagName,\n },\n );\n if (!hasRegex) {\n reported = true;\n }\n }\n}, {\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n match: {\n description: `\\`match\\` is a required option containing an array of objects which determine\nthe conditions whereby a name is reported as being problematic.\n\nThese objects can have any combination of the following groups of optional\nproperties, all of which act to confine one another.\n\nNote that \\`comment\\`, even if targeting a specific tag, is used to match the\nwhole block. So if a \\`comment\\` finds its specific tag, it may still apply\nfixes found by the likes of \\`disallowName\\` even when a different tag has the\ndisallowed name. An alternative is to ensure that \\`comment\\` finds the specific\ntag of the desired tag and/or name and no \\`disallowName\\` (or \\`allowName\\`) is\nsupplied. In such a case, only one error will be reported, but no fixer will\nbe applied, however.`,\n items: {\n additionalProperties: false,\n properties: {\n allowName: {\n description: `Indicates which names are allowed for the given tag (or \\`*\\`).\nAccepts a string regular expression (optionally wrapped between two\n\\`/\\` delimiters followed by optional flags) used to match the name.`,\n type: 'string',\n },\n comment: {\n description: 'As with `context` but AST for the JSDoc block comment and types.',\n type: 'string',\n },\n context: {\n description: `AST to confine the allowing or disallowing to JSDoc blocks\nassociated with a particular context. See the\n[\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n type: 'string',\n },\n disallowName: {\n description: 'As with `allowName` but indicates names that are not allowed.',\n type: 'string',\n },\n message: {\n description: 'An optional custom message to use when there is a match.',\n type: 'string',\n },\n replacement: {\n description: `If \\`disallowName\\` is supplied and this value is present, it\nwill replace the matched \\`disallowName\\` text.`,\n type: 'string',\n },\n tags: {\n description: `This array should include tag names or \\`*\\` to indicate the\n match will apply for all tags (except as confined by any context\n properties). If \\`*\\` is not used, then these rules will only apply to\n the specified tags. If \\`tags\\` is omitted, then \\`*\\` is assumed.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n required: [\n 'match',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI,EAAE;IACJC;EACF,CAAC;EACDC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC;EACF,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,IAAI,CAACD,KAAK,EAAE;IACVF,MAAM,CAAC,0DAA0D,CAAC;IAElE;EACF;EAEA,MAAM;IACJI,SAAS;IACTC,YAAY;IACZC,WAAW;IACXC,IAAI,GAAG,CACL,GAAG;EAEP,CAAC,GAAGL,KAAK,EAAC,mDAAqDJ,SAAS,EAAE;EAE1E,MAAMU,cAAc,GAAGJ,SAAS,IAAIH,KAAK,CAACQ,kBAAkB,CAACL,SAAS,CAAC;EACvE,MAAMM,iBAAiB,GAAGL,YAAY,IAAIJ,KAAK,CAACQ,kBAAkB,CAACJ,YAAY,CAAC;EAEhF,IAAIM,cAAc,GAAGZ,KAAK,CAACQ,IAAI;EAC/B,IAAI,CAACA,IAAI,CAACK,QAAQ,CAAC,GAAG,CAAC,EAAE;IACvBD,cAAc,GAAGV,KAAK,CA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AAqE;gBACnDM,KAAK,EAAE;kBACLC,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDE,QAAQ,EAAE,CACR,OAAO,CACR;MACDF,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAjD,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
@@ -362,8 +362,7 @@ such a tag will cause multiline blocks to be allowed.
362
362
  You may set this to an empty array to prevent any tag from permitting multiple
363
363
  lines.
364
364
 
365
- Defaults to \`['*']\`.
366
- `
365
+ Defaults to \`['*']\`.`
367
366
  },
368
367
  noFinalLineText: {
369
368
  description: `For multiline blocks, any non-whitespace text preceding the \`*/\` on the final
@@ -386,8 +385,7 @@ Defaults to \`false\`.`,
386
385
  description: `If this is \`true\`, any single line blocks will be reported, except those which
387
386
  are whitelisted in \`singleLineTags\`.
388
387
 
389
- Defaults to \`false\`.
390
- `,
388
+ Defaults to \`false\`.`,
391
389
  type: 'boolean'
392
390
  },
393
391
  noZeroLineText: {
@@ -407,8 +405,7 @@ for such cases. Blocks are not reported which have multi-line descriptions,
407
405
  multiple tags, a block description and tag, or tags with multi-line types or
408
406
  descriptions.
409
407
 
410
- Defaults to \`null\`.
411
- `,
408
+ Defaults to \`null\`.`,
412
409
  type: 'number'
413
410
  },
414
411
  singleLineTags: {