eslint-plugin-jsdoc 44.2.3 → 44.2.5

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 (120) hide show
  1. package/dist/WarnSettings.js +0 -1
  2. package/dist/WarnSettings.js.map +1 -1
  3. package/dist/alignTransform.js +87 -5
  4. package/dist/alignTransform.js.map +1 -1
  5. package/dist/bin/generateRule.js +4 -3
  6. package/dist/bin/generateRule.js.map +1 -1
  7. package/dist/exportParser.js +272 -71
  8. package/dist/exportParser.js.map +1 -1
  9. package/dist/generateRule.js +4 -3
  10. package/dist/generateRule.js.map +1 -1
  11. package/dist/iterateJsdoc.js +921 -357
  12. package/dist/iterateJsdoc.js.map +1 -1
  13. package/dist/jsdocUtils.js +270 -168
  14. package/dist/jsdocUtils.js.map +1 -1
  15. package/dist/rules/checkAlignment.js +6 -0
  16. package/dist/rules/checkAlignment.js.map +1 -1
  17. package/dist/rules/checkExamples.js +73 -9
  18. package/dist/rules/checkExamples.js.map +1 -1
  19. package/dist/rules/checkIndentation.js +12 -2
  20. package/dist/rules/checkIndentation.js.map +1 -1
  21. package/dist/rules/checkLineAlignment.js +71 -7
  22. package/dist/rules/checkLineAlignment.js.map +1 -1
  23. package/dist/rules/checkParamNames.js +29 -11
  24. package/dist/rules/checkParamNames.js.map +1 -1
  25. package/dist/rules/checkPropertyNames.js +13 -7
  26. package/dist/rules/checkPropertyNames.js.map +1 -1
  27. package/dist/rules/checkTagNames.js +45 -9
  28. package/dist/rules/checkTagNames.js.map +1 -1
  29. package/dist/rules/checkTypes.js +98 -41
  30. package/dist/rules/checkTypes.js.map +1 -1
  31. package/dist/rules/checkValues.js +7 -7
  32. package/dist/rules/checkValues.js.map +1 -1
  33. package/dist/rules/emptyTags.js +8 -1
  34. package/dist/rules/emptyTags.js.map +1 -1
  35. package/dist/rules/informativeDocs.js +27 -8
  36. package/dist/rules/informativeDocs.js.map +1 -1
  37. package/dist/rules/matchDescription.js +18 -1
  38. package/dist/rules/matchDescription.js.map +1 -1
  39. package/dist/rules/matchName.js +2 -2
  40. package/dist/rules/matchName.js.map +1 -1
  41. package/dist/rules/multilineBlocks.js +12 -1
  42. package/dist/rules/multilineBlocks.js.map +1 -1
  43. package/dist/rules/noBadBlocks.js +4 -6
  44. package/dist/rules/noBadBlocks.js.map +1 -1
  45. package/dist/rules/noBlankBlockDescriptions.js +2 -0
  46. package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
  47. package/dist/rules/noMissingSyntax.js +53 -16
  48. package/dist/rules/noMissingSyntax.js.map +1 -1
  49. package/dist/rules/noMultiAsterisks.js +1 -6
  50. package/dist/rules/noMultiAsterisks.js.map +1 -1
  51. package/dist/rules/noRestrictedSyntax.js +12 -5
  52. package/dist/rules/noRestrictedSyntax.js.map +1 -1
  53. package/dist/rules/noTypes.js +3 -0
  54. package/dist/rules/noTypes.js.map +1 -1
  55. package/dist/rules/noUndefinedTypes.js +65 -27
  56. package/dist/rules/noUndefinedTypes.js.map +1 -1
  57. package/dist/rules/requireAsteriskPrefix.js +20 -0
  58. package/dist/rules/requireAsteriskPrefix.js.map +1 -1
  59. package/dist/rules/requireDescription.js +6 -2
  60. package/dist/rules/requireDescription.js.map +1 -1
  61. package/dist/rules/requireDescriptionCompleteSentence.js +75 -12
  62. package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
  63. package/dist/rules/requireFileOverview.js +9 -4
  64. package/dist/rules/requireFileOverview.js.map +1 -1
  65. package/dist/rules/requireHyphenBeforeParamDescription.js +21 -7
  66. package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
  67. package/dist/rules/requireJsdoc.js +150 -29
  68. package/dist/rules/requireJsdoc.js.map +1 -1
  69. package/dist/rules/requireParam.js +116 -10
  70. package/dist/rules/requireParam.js.map +1 -1
  71. package/dist/rules/requireProperty.js +1 -1
  72. package/dist/rules/requireProperty.js.map +1 -1
  73. package/dist/rules/requireReturns.js +2 -3
  74. package/dist/rules/requireReturns.js.map +1 -1
  75. package/dist/rules/requireReturnsCheck.js +9 -2
  76. package/dist/rules/requireReturnsCheck.js.map +1 -1
  77. package/dist/rules/requireThrows.js +2 -3
  78. package/dist/rules/requireThrows.js.map +1 -1
  79. package/dist/rules/requireYields.js +9 -3
  80. package/dist/rules/requireYields.js.map +1 -1
  81. package/dist/rules/requireYieldsCheck.js +19 -5
  82. package/dist/rules/requireYieldsCheck.js.map +1 -1
  83. package/dist/rules/sortTags.js +67 -9
  84. package/dist/rules/sortTags.js.map +1 -1
  85. package/dist/rules/tagLines.js +22 -3
  86. package/dist/rules/tagLines.js.map +1 -1
  87. package/dist/rules/textEscaping.js +18 -4
  88. package/dist/rules/textEscaping.js.map +1 -1
  89. package/dist/rules/validTypes.js +26 -9
  90. package/dist/rules/validTypes.js.map +1 -1
  91. package/dist/tagNames.js +0 -2
  92. package/dist/tagNames.js.map +1 -1
  93. package/dist/utils/hasReturnValue.js +77 -48
  94. package/dist/utils/hasReturnValue.js.map +1 -1
  95. package/docs/rules/check-line-alignment.md +7 -0
  96. package/docs/rules/check-tag-names.md +15 -0
  97. package/docs/rules/no-missing-syntax.md +6 -0
  98. package/docs/rules/no-undefined-types.md +6 -0
  99. package/docs/rules/require-description-complete-sentence.md +525 -289
  100. package/docs/rules/require-description.md +289 -525
  101. package/docs/rules/require-file-overview.md +7 -0
  102. package/docs/rules/require-jsdoc.md +1 -1
  103. package/docs/rules/require-param-description.md +116 -1694
  104. package/docs/rules/require-param-name.md +58 -133
  105. package/docs/rules/require-param-type.md +119 -55
  106. package/docs/rules/require-param.md +1704 -111
  107. package/docs/rules/require-property-description.md +39 -79
  108. package/docs/rules/require-property-name.md +21 -30
  109. package/docs/rules/require-property-type.md +21 -21
  110. package/docs/rules/require-property.md +82 -33
  111. package/docs/rules/require-returns-check.md +636 -747
  112. package/docs/rules/require-returns-description.md +61 -933
  113. package/docs/rules/require-returns-type.md +42 -79
  114. package/docs/rules/require-returns.md +1081 -61
  115. package/docs/rules/require-yields-check.md +238 -517
  116. package/docs/rules/require-yields.md +517 -238
  117. package/docs/rules/valid-types.md +1 -1
  118. package/docs/settings.md +3 -1
  119. package/package.json +10 -9
  120. package/tsconfig.json +2 -3
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _jsdoccomment = require("@es-joy/jsdoccomment");
8
- var _WarnSettings = _interopRequireDefault(require("./WarnSettings"));
9
7
  var _getDefaultTagStructureForMode = _interopRequireDefault(require("./getDefaultTagStructureForMode"));
10
8
  var _tagNames = require("./tagNames");
11
9
  var _hasReturnValue = require("./utils/hasReturnValue");
10
+ var _WarnSettings = _interopRequireDefault(require("./WarnSettings"));
11
+ var _jsdoccomment = require("@es-joy/jsdoccomment");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  /**
14
14
  * @typedef {number} Integer
@@ -33,6 +33,25 @@ const setTagStructure = mode => {
33
33
  tagStructure = (0, _getDefaultTagStructureForMode.default)(mode);
34
34
  };
35
35
 
36
+ /**
37
+ * @typedef {undefined|string|{
38
+ * name: Integer,
39
+ * restElement: boolean
40
+ * }|{
41
+ * isRestProperty: boolean|undefined,
42
+ * name: string,
43
+ * restElement: boolean
44
+ * }|{
45
+ * name: string,
46
+ * restElement: boolean
47
+ * }} ParamCommon
48
+ */
49
+ /**
50
+ * @typedef {ParamCommon|[string|undefined, (FlattendRootInfo & {
51
+ * annotationParamName?: string,
52
+ * })]|NestedParamInfo} ParamNameInfo
53
+ */
54
+
36
55
  /**
37
56
  * @typedef {{
38
57
  * hasPropertyRest: boolean,
@@ -41,15 +60,27 @@ const setTagStructure = mode => {
41
60
  * rests: boolean[],
42
61
  * }} FlattendRootInfo
43
62
  */
63
+ /**
64
+ * @typedef {[string, (string[]|ParamInfo[])]} NestedParamInfo
65
+ */
66
+ /**
67
+ * @typedef {ParamCommon|
68
+ * [string|undefined, (FlattendRootInfo & {
69
+ * annotationParamName?: string
70
+ * })]|
71
+ * NestedParamInfo} ParamInfo
72
+ */
44
73
 
45
74
  /**
46
75
  * Given a nested array of property names, reduce them to a single array,
47
- * appending the name of the root element along the way if present.
48
- *
49
- * @param {} params
50
- * @param {string} root
76
+ * appending the name of the root element along the way if present.
77
+ * @callback FlattenRoots
78
+ * @param {ParamInfo[]} params
79
+ * @param {string} [root]
51
80
  * @returns {FlattendRootInfo}
52
81
  */
82
+
83
+ /** @type {FlattenRoots} */
53
84
  const flattenRoots = (params, root = '') => {
54
85
  let hasRestElement = false;
55
86
  let hasPropertyRest = false;
@@ -58,7 +89,13 @@ const flattenRoots = (params, root = '') => {
58
89
  * @type {boolean[]}
59
90
  */
60
91
  const rests = [];
61
- const names = params.reduce((acc, cur) => {
92
+ const names = params.reduce(
93
+ /**
94
+ * @param {string[]} acc
95
+ * @param {ParamInfo} cur
96
+ * @returns {string[]}
97
+ */
98
+ (acc, cur) => {
62
99
  if (Array.isArray(cur)) {
63
100
  let nms;
64
101
  if (Array.isArray(cur[1])) {
@@ -79,21 +116,21 @@ const flattenRoots = (params, root = '') => {
79
116
  if (flattened.hasPropertyRest) {
80
117
  hasPropertyRest = true;
81
118
  }
82
- const inner = [root ? `${root}.${cur[0]}` : cur[0], ...flattened.names].filter(Boolean);
119
+ const inner = /** @type {string[]} */[root ? `${root}.${cur[0]}` : cur[0], ...flattened.names].filter(Boolean);
83
120
  rests.push(false, ...flattened.rests);
84
121
  return acc.concat(inner);
85
122
  }
86
123
  if (typeof cur === 'object') {
87
- if (cur.isRestProperty) {
124
+ if ('isRestProperty' in cur && cur.isRestProperty) {
88
125
  hasPropertyRest = true;
89
126
  rests.push(true);
90
127
  } else {
91
128
  rests.push(false);
92
129
  }
93
- if (cur.restElement) {
130
+ if ('restElement' in cur && cur.restElement) {
94
131
  hasRestElement = true;
95
132
  }
96
- acc.push(root ? `${root}.${cur.name}` : cur.name);
133
+ acc.push(root ? `${root}.${String(cur.name)}` : String(cur.name));
97
134
  } else if (typeof cur !== 'undefined') {
98
135
  rests.push(false);
99
136
  acc.push(root ? `${root}.${cur}` : cur);
@@ -109,59 +146,72 @@ const flattenRoots = (params, root = '') => {
109
146
  };
110
147
 
111
148
  /**
112
- * @param {ESTreeOrTypeScriptNode} propSignature
113
- * @returns {undefined|Array|string}
149
+ * @param {import('@typescript-eslint/types').TSESTree.TSIndexSignature|
150
+ * import('@typescript-eslint/types').TSESTree.TSConstructSignatureDeclaration|
151
+ * import('@typescript-eslint/types').TSESTree.TSCallSignatureDeclaration|
152
+ * import('@typescript-eslint/types').TSESTree.TSPropertySignature} propSignature
153
+ * @returns {undefined|string|[string, string[]]}
114
154
  */
115
155
  const getPropertiesFromPropertySignature = propSignature => {
116
156
  if (propSignature.type === 'TSIndexSignature' || propSignature.type === 'TSConstructSignatureDeclaration' || propSignature.type === 'TSCallSignatureDeclaration') {
117
157
  return undefined;
118
158
  }
119
159
  if (propSignature.typeAnnotation && propSignature.typeAnnotation.typeAnnotation.type === 'TSTypeLiteral') {
120
- return [propSignature.key.name, propSignature.typeAnnotation.typeAnnotation.members.map(member => {
121
- return getPropertiesFromPropertySignature(member);
160
+ return [/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */propSignature.key.name, propSignature.typeAnnotation.typeAnnotation.members.map(member => {
161
+ return (/** @type {string} */
162
+ getPropertiesFromPropertySignature( /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
163
+ member)
164
+ );
122
165
  })];
123
166
  }
124
- return propSignature.key.name;
167
+ return (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */propSignature.key.name
168
+ );
125
169
  };
126
170
 
127
171
  /**
128
- * @param {ESTreeOrTypeScriptNode} functionNode
172
+ * @param {ESTreeOrTypeScriptNode|null} functionNode
129
173
  * @param {boolean} [checkDefaultObjects]
130
- * @returns {Array}
174
+ * @throws {Error}
175
+ * @returns {ParamNameInfo[]}
131
176
  */
132
177
  const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
133
178
  var _functionNode$value;
134
179
  /* eslint-disable complexity -- Temporary */
135
180
  /**
136
- * @param {} param
181
+ * @param {import('estree').Identifier|import('estree').AssignmentPattern|
182
+ * import('estree').ObjectPattern|import('estree').Property|
183
+ * import('estree').RestElement|import('estree').ArrayPattern|
184
+ * import('@typescript-eslint/types').TSESTree.TSParameterProperty|
185
+ * import('@typescript-eslint/types').TSESTree.Property|
186
+ * import('@typescript-eslint/types').TSESTree.RestElement|
187
+ * import('@typescript-eslint/types').TSESTree.Identifier|
188
+ * import('@typescript-eslint/types').TSESTree.ObjectPattern|
189
+ * import('@typescript-eslint/types').TSESTree.BindingName|
190
+ * import('@typescript-eslint/types').TSESTree.Parameter
191
+ * } param
137
192
  * @param {boolean} [isProperty]
138
- * @returns {undefined|{
139
- * isRestProperty: boolean|undefined,
140
- * name: string,
141
- * restElement: true
142
- * }|[undefined|string, FlattendRootInfo|{
143
- * name: Integer,
144
- * restElement: boolean
145
- * }[]]}
193
+ * @returns {ParamNameInfo|[string, ParamNameInfo[]]}
146
194
  */
147
195
  const getParamName = (param, isProperty) => {
148
- var _param$left, _param$left3;
196
+ var _param$left2;
149
197
  /* eslint-enable complexity -- Temporary */
150
198
  const hasLeftTypeAnnotation = 'left' in param && 'typeAnnotation' in param.left;
151
199
  if ('typeAnnotation' in param || hasLeftTypeAnnotation) {
152
200
  var _typeAnnotation$typeA;
153
- const typeAnnotation = hasLeftTypeAnnotation ? param.left.typeAnnotation : param.typeAnnotation;
201
+ const typeAnnotation = hasLeftTypeAnnotation ? /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */param.left.typeAnnotation : /** @type {import('@typescript-eslint/types').TSESTree.Identifier|import('@typescript-eslint/types').TSESTree.ObjectPattern} */
202
+ param.typeAnnotation;
154
203
  if ((typeAnnotation === null || typeAnnotation === void 0 ? void 0 : (_typeAnnotation$typeA = typeAnnotation.typeAnnotation) === null || _typeAnnotation$typeA === void 0 ? void 0 : _typeAnnotation$typeA.type) === 'TSTypeLiteral') {
155
204
  const propertyNames = typeAnnotation.typeAnnotation.members.map(member => {
156
- return getPropertiesFromPropertySignature(member);
205
+ return getPropertiesFromPropertySignature( /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
206
+ member);
157
207
  });
158
208
  const flattened = {
159
209
  ...flattenRoots(propertyNames),
160
- annotationParamName: param.name
210
+ annotationParamName: 'name' in param ? param.name : undefined
161
211
  };
162
212
  const hasLeftName = 'left' in param && 'name' in param.left;
163
213
  if ('name' in param || hasLeftName) {
164
- return [hasLeftName ? param.left.name : param.name, flattened];
214
+ return [hasLeftName ? /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */param.left.name : /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */param.name, flattened];
165
215
  }
166
216
  return [undefined, flattened];
167
217
  }
@@ -172,9 +222,9 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
172
222
  if ('left' in param && 'name' in param.left) {
173
223
  return param.left.name;
174
224
  }
175
- if (param.type === 'ObjectPattern' || ((_param$left = param.left) === null || _param$left === void 0 ? void 0 : _param$left.type) === 'ObjectPattern') {
176
- var _param$left2;
177
- const properties = param.properties || ((_param$left2 = param.left) === null || _param$left2 === void 0 ? void 0 : _param$left2.properties);
225
+ if (param.type === 'ObjectPattern' || 'left' in param && param.left.type === 'ObjectPattern') {
226
+ var _param$left;
227
+ const properties = /** @type {import('@typescript-eslint/types').TSESTree.ObjectPattern} */param.properties || ( /** @type {import('estree').ObjectPattern} */(_param$left = /** @type {import('@typescript-eslint/types').TSESTree.AssignmentPattern} */param.left) === null || _param$left === void 0 ? void 0 : _param$left.properties);
178
228
  const roots = properties.map(prop => {
179
229
  return getParamName(prop, true);
180
230
  });
@@ -184,16 +234,22 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
184
234
  // eslint-disable-next-line default-case
185
235
  switch (param.value.type) {
186
236
  case 'ArrayPattern':
187
- return [param.key.name, /** @type {import('estree').ArrayPattern} */param.value.elements.map((prop, idx) => {
188
- return {
189
- name: idx,
190
- restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
191
- };
192
- })];
237
+ {
238
+ return [/** @type {import('estree').Identifier} */
239
+ param.key.name, /** @type {import('estree').ArrayPattern} */param.value.elements.map((prop, idx) => {
240
+ return {
241
+ name: idx,
242
+ restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
243
+ };
244
+ })];
245
+ }
193
246
  case 'ObjectPattern':
194
- return [param.key.name, /** @type {import('estree').ObjectPattern} */param.value.properties.map(prop => {
195
- return getParamName(prop, isProperty);
196
- })];
247
+ {
248
+ return [/** @type {import('estree').Identifier} */param.key.name, /** @type {import('estree').ObjectPattern} */param.value.properties.map(prop => {
249
+ return (/** @type {string|[string, string[]]} */getParamName(prop, isProperty)
250
+ );
251
+ })];
252
+ }
197
253
  case 'AssignmentPattern':
198
254
  {
199
255
  // eslint-disable-next-line default-case
@@ -201,17 +257,21 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
201
257
  case 'Identifier':
202
258
  // Default parameter
203
259
  if (checkDefaultObjects && param.value.right.type === 'ObjectExpression') {
204
- return [param.key.name, /** @type {import('estree').AssignmentPattern} */param.value.right.properties.map(prop => {
205
- return getParamName(prop, isProperty);
260
+ return [/** @type {import('estree').Identifier} */param.key.name, /** @type {import('estree').AssignmentPattern} */param.value.right.properties.map(prop => {
261
+ return (/** @type {string} */getParamName( /** @type {import('estree').Property} */
262
+ prop, isProperty)
263
+ );
206
264
  })];
207
265
  }
208
266
  break;
209
267
  case 'ObjectPattern':
210
- return [param.key.name, /** @type {import('estree').ObjectPattern} */param.value.left.properties.map(prop => {
268
+ return [/** @type {import('estree').Identifier} */
269
+ param.key.name, /** @type {import('estree').ObjectPattern} */param.value.left.properties.map(prop => {
211
270
  return getParamName(prop, isProperty);
212
271
  })];
213
272
  case 'ArrayPattern':
214
- return [param.key.name, /** @type {import('estree').ArrayPattern} */param.value.left.elements.map((prop, idx) => {
273
+ return [/** @type {import('estree').Identifier} */
274
+ param.key.name, /** @type {import('estree').ArrayPattern} */param.value.left.elements.map((prop, idx) => {
215
275
  return {
216
276
  name: idx,
217
277
  restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
@@ -226,9 +286,10 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
226
286
 
227
287
  // The key of an object could also be a string or number
228
288
  case 'Literal':
229
- return param.key.raw ||
230
- // istanbul ignore next -- `raw` may not be present in all parsers
231
- param.key.value;
289
+ return (/** @type {string} */param.key.raw ||
290
+ // istanbul ignore next -- `raw` may not be present in all parsers
291
+ param.key.value
292
+ );
232
293
 
233
294
  // case 'MemberExpression':
234
295
  default:
@@ -239,9 +300,9 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
239
300
  return undefined;
240
301
  }
241
302
  }
242
- if (param.type === 'ArrayPattern' || ((_param$left3 = param.left) === null || _param$left3 === void 0 ? void 0 : _param$left3.type) === 'ArrayPattern') {
243
- var _param$left4;
244
- const elements = /** @type {import('estree').ArrayPattern} */param.elements || ( /** @type {import('estree').ArrayPattern} */(_param$left4 = param.left) === null || _param$left4 === void 0 ? void 0 : _param$left4.elements);
303
+ if (param.type === 'ArrayPattern' || /** @type {import('estree').AssignmentPattern} */((_param$left2 = param.left) === null || _param$left2 === void 0 ? void 0 : _param$left2.type) === 'ArrayPattern') {
304
+ var _param$left3;
305
+ const elements = /** @type {import('estree').ArrayPattern} */param.elements || ( /** @type {import('estree').ArrayPattern} */(_param$left3 = /** @type {import('estree').AssignmentPattern} */param.left) === null || _param$left3 === void 0 ? void 0 : _param$left3.elements);
245
306
  const roots = elements.map((prop, idx) => {
246
307
  return {
247
308
  name: `"${idx}"`,
@@ -253,19 +314,20 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
253
314
  if (['RestElement', 'ExperimentalRestProperty'].includes(param.type)) {
254
315
  return {
255
316
  isRestProperty: isProperty,
256
- name: param.argument.name,
317
+ name: /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ /** @type {import('@typescript-eslint/types').TSESTree.RestElement} */param.argument.name,
257
318
  restElement: true
258
319
  };
259
320
  }
260
321
  if (param.type === 'TSParameterProperty') {
261
- return getParamName(param.parameter, true);
322
+ return getParamName( /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */
323
+ /** @type {import('@typescript-eslint/types').TSESTree.TSParameterProperty} */param.parameter, true);
262
324
  }
263
325
  throw new Error(`Unsupported function signature format: \`${param.type}\`.`);
264
326
  };
265
327
  if (!functionNode) {
266
328
  return [];
267
329
  }
268
- return (functionNode.params || ((_functionNode$value = functionNode.value) === null || _functionNode$value === void 0 ? void 0 : _functionNode$value.params) || []).map(param => {
330
+ return ( /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */functionNode.params || ( /** @type {import('@typescript-eslint/types').TSESTree.MethodDefinition} */(_functionNode$value = functionNode.value) === null || _functionNode$value === void 0 ? void 0 : _functionNode$value.params) || []).map(param => {
269
331
  return getParamName(param);
270
332
  });
271
333
  };
@@ -276,13 +338,13 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
276
338
  */
277
339
  const hasParams = functionNode => {
278
340
  // Should also check `functionNode.value.params` if supporting `MethodDefinition`
279
- return functionNode.params.length;
341
+ return (/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */functionNode.params.length
342
+ );
280
343
  };
281
344
 
282
345
  /**
283
346
  * Gets all names of the target type, including those that refer to a path, e.g.
284
347
  * "@param foo; @param foo.bar".
285
- *
286
348
  * @param {import('comment-parser').Block} jsdoc
287
349
  * @param {string} targetTagName
288
350
  * @returns {{
@@ -312,7 +374,7 @@ const getJsdocTagsDeep = (jsdoc, targetTagName) => {
312
374
  const modeWarnSettings = (0, _WarnSettings.default)();
313
375
 
314
376
  /**
315
- * @param {ParserMode} mode
377
+ * @param {ParserMode|undefined} mode
316
378
  * @param {import('eslint').Rule.RuleContext} context
317
379
  * @returns {import('./tagNames.js').AliasedTags}
318
380
  */
@@ -329,6 +391,10 @@ const getTagNamesForMode = (mode, context) => {
329
391
  if (!modeWarnSettings.hasBeenWarned(context, 'mode')) {
330
392
  context.report({
331
393
  loc: {
394
+ end: {
395
+ column: 1,
396
+ line: 1
397
+ },
332
398
  start: {
333
399
  column: 1,
334
400
  line: 1
@@ -346,10 +412,10 @@ const getTagNamesForMode = (mode, context) => {
346
412
 
347
413
  /**
348
414
  * @param {import('eslint').Rule.RuleContext} context
349
- * @param {ParserMode} mode
415
+ * @param {ParserMode|undefined} mode
350
416
  * @param {string} name
351
417
  * @param {TagNamePreference} tagPreference
352
- * @returns {string|boolean|{
418
+ * @returns {string|false|{
353
419
  * message: string;
354
420
  * replacement?: string|undefined;
355
421
  * }}
@@ -385,10 +451,10 @@ const getPreferredTagName = (context, mode, name, tagPreference = {}) => {
385
451
  };
386
452
 
387
453
  /**
388
- * @param context
389
- * @param {ParserMode} mode
454
+ * @param {import('eslint').Rule.RuleContext} context
455
+ * @param {ParserMode|undefined} mode
390
456
  * @param {string} name
391
- * @param {Array} definedTags
457
+ * @param {string[]} definedTags
392
458
  * @returns {boolean}
393
459
  */
394
460
  const isValidTag = (context, mode, name, definedTags) => {
@@ -400,7 +466,7 @@ const isValidTag = (context, mode, name, definedTags) => {
400
466
  };
401
467
 
402
468
  /**
403
- * @param {object} jsdoc
469
+ * @param {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc
404
470
  * @param {string} targetTagName
405
471
  * @returns {boolean}
406
472
  */
@@ -413,16 +479,12 @@ const hasTag = (jsdoc, targetTagName) => {
413
479
 
414
480
  /**
415
481
  * Get all tags, inline tags and inline tags in tags
416
- *
417
- * @param {import('comment-parser').Block & {
418
- * inlineTags: import('@es-joy/jsdoccomment').JsdocInlineTagNoType[]
419
- * }} jsdoc
420
- * @param {boolean} includeInlineTags
482
+ * @param {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc
421
483
  * @returns {(import('comment-parser').Spec|
422
484
  * import('@es-joy/jsdoccomment').JsdocInlineTagNoType)[]}
423
485
  */
424
- const getAllTags = (jsdoc, includeInlineTags) => {
425
- return includeInlineTags ? [...jsdoc.tags, ...jsdoc.inlineTags.map(inlineTag => {
486
+ const getAllTags = jsdoc => {
487
+ return [...jsdoc.tags, ...jsdoc.inlineTags.map(inlineTag => {
426
488
  // Tags don't have source or line numbers, so add before returning
427
489
  let line = -1;
428
490
  for (const {
@@ -450,7 +512,8 @@ const getAllTags = (jsdoc, includeInlineTags) => {
450
512
  }
451
513
  }
452
514
  for (const inlineTag of tag.inlineTags) {
453
- let line;
515
+ /** @type {import('./iterateJsdoc.js').Integer} */
516
+ let line = 0;
454
517
  for (const {
455
518
  number,
456
519
  tokens: {
@@ -472,11 +535,11 @@ const getAllTags = (jsdoc, includeInlineTags) => {
472
535
  */
473
536
  tag.inlineTags
474
537
  );
475
- })] : jsdoc.tags;
538
+ })];
476
539
  };
477
540
 
478
541
  /**
479
- * @param {object} jsdoc
542
+ * @param {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc
480
543
  * @param {string[]} targetTagNames
481
544
  * @returns {boolean}
482
545
  */
@@ -488,8 +551,7 @@ const hasATag = (jsdoc, targetTagNames) => {
488
551
 
489
552
  /**
490
553
  * Checks if the JSDoc comment has an undefined type.
491
- *
492
- * @param {import('comment-parser').Spec} tag
554
+ * @param {import('comment-parser').Spec|null|undefined} tag
493
555
  * the tag which should be checked.
494
556
  * @param {ParserMode} mode
495
557
  * @returns {boolean}
@@ -529,7 +591,7 @@ const mayBeUndefinedTypeTag = (tag, mode) => {
529
591
  /**
530
592
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} map
531
593
  * @param {string} tag
532
- * @returns {Map<string, string | boolean>}
594
+ * @returns {Map<string, string|string[]|boolean|undefined>}
533
595
  */
534
596
  const ensureMap = (map, tag) => {
535
597
  if (!map.has(tag)) {
@@ -539,20 +601,8 @@ const ensureMap = (map, tag) => {
539
601
  );
540
602
  };
541
603
 
542
- /* eslint-disable jsdoc/valid-types -- Older non-TS version */
543
- /**
544
- * @typedef {{
545
- * [tag: string]: {
546
- * name: string|boolean,
547
- * type: string[]|boolean,
548
- * required: string[]
549
- * }
550
- * }} StructuredTags
551
- */
552
- /* eslint-enable jsdoc/valid-types -- Older non-TS version */
553
-
554
604
  /**
555
- * @param {StructuredTags} structuredTags
605
+ * @param {import('./iterateJsdoc.js').StructuredTags} structuredTags
556
606
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
557
607
  * @returns {void}
558
608
  */
@@ -588,7 +638,7 @@ const overrideTagStructure = (structuredTags, tagMap = tagStructure) => {
588
638
 
589
639
  /**
590
640
  * @param {ParserMode} mode
591
- * @param {StructuredTags} structuredTags
641
+ * @param {import('./iterateJsdoc.js').StructuredTags} structuredTags
592
642
  * @returns {import('./getDefaultTagStructureForMode.js').TagStructure}
593
643
  */
594
644
  const getTagStructureForMode = (mode, structuredTags) => {
@@ -634,11 +684,12 @@ const isNamepathOrUrlReferencingTag = (tag, tagMap = tagStructure) => {
634
684
  /**
635
685
  * @param {string} tag
636
686
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
637
- * @returns {boolean}
687
+ * @returns {boolean|undefined}
638
688
  */
639
689
  const tagMustHaveTypePosition = (tag, tagMap = tagStructure) => {
640
690
  const tagStruct = ensureMap(tagMap, tag);
641
- return tagStruct.get('typeRequired');
691
+ return (/** @type {boolean|undefined} */tagStruct.get('typeRequired')
692
+ );
642
693
  };
643
694
 
644
695
  /**
@@ -651,7 +702,7 @@ const tagMightHaveTypePosition = (tag, tagMap = tagStructure) => {
651
702
  return true;
652
703
  }
653
704
  const tagStruct = ensureMap(tagMap, tag);
654
- const ret = tagStruct.get('typeAllowed');
705
+ const ret = /** @type {boolean|undefined} */tagStruct.get('typeAllowed');
655
706
  return ret === undefined ? true : ret;
656
707
  };
657
708
  const namepathTypes = new Set(['namepath-defining', 'namepath-referencing']);
@@ -674,42 +725,45 @@ const tagMightHaveNamePosition = (tag, tagMap = tagStructure) => {
674
725
  */
675
726
  const tagMightHaveNamepath = (tag, tagMap = tagStructure) => {
676
727
  const tagStruct = ensureMap(tagMap, tag);
677
- return namepathTypes.has(tagStruct.get('namepathRole'));
728
+ const nampathRole = tagStruct.get('namepathRole');
729
+ return nampathRole !== false && namepathTypes.has( /** @type {string} */nampathRole);
678
730
  };
679
731
 
680
732
  /**
681
733
  * @param {string} tag
682
734
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
683
- * @returns {boolean}
735
+ * @returns {boolean|undefined}
684
736
  */
685
737
  const tagMustHaveNamePosition = (tag, tagMap = tagStructure) => {
686
738
  const tagStruct = ensureMap(tagMap, tag);
687
- return tagStruct.get('nameRequired');
739
+ return (/** @type {boolean|undefined} */tagStruct.get('nameRequired')
740
+ );
688
741
  };
689
742
 
690
743
  /**
691
- * @param tag
744
+ * @param {string} tag
692
745
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
693
746
  * @returns {boolean}
694
747
  */
695
748
  const tagMightHaveEitherTypeOrNamePosition = (tag, tagMap) => {
696
- return tagMightHaveTypePosition(tag, tagMap) || tagMightHaveNamepath(tag, tagMap);
749
+ return Boolean(tagMightHaveTypePosition(tag, tagMap)) || tagMightHaveNamepath(tag, tagMap);
697
750
  };
698
751
 
699
752
  /**
700
753
  * @param {string} tag
701
754
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
702
- * @returns {boolean}
755
+ * @returns {boolean|undefined}
703
756
  */
704
757
  const tagMustHaveEitherTypeOrNamePosition = (tag, tagMap) => {
705
758
  const tagStruct = ensureMap(tagMap, tag);
706
- return tagStruct.get('typeOrNameRequired');
759
+ return (/** @type {boolean} */tagStruct.get('typeOrNameRequired')
760
+ );
707
761
  };
708
762
 
709
763
  /**
710
- * @param tag
764
+ * @param {import('comment-parser').Spec} tag
711
765
  * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
712
- * @returns {boolean}
766
+ * @returns {boolean|undefined}
713
767
  */
714
768
  const tagMissingRequiredTypeOrNamepath = (tag, tagMap = tagStructure) => {
715
769
  const mustHaveTypePosition = tagMustHaveTypePosition(tag.tag, tagMap);
@@ -723,7 +777,7 @@ const tagMissingRequiredTypeOrNamepath = (tag, tagMap = tagStructure) => {
723
777
 
724
778
  /* eslint-disable complexity -- Temporary */
725
779
  /**
726
- * @param {ESTreeOrTypeScriptNode} node
780
+ * @param {ESTreeOrTypeScriptNode|null|undefined} node
727
781
  * @param {boolean} [checkYieldReturnValue]
728
782
  * @returns {boolean}
729
783
  */
@@ -740,6 +794,7 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
740
794
  });
741
795
  }
742
796
 
797
+ // @ts-expect-error In Babel?
743
798
  // istanbul ignore next -- In Babel?
744
799
  case 'OptionalCallExpression':
745
800
  case 'CallExpression':
@@ -768,7 +823,8 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
768
823
  }
769
824
  case 'TryStatement':
770
825
  {
771
- return hasNonFunctionYield(node.block, checkYieldReturnValue) || hasNonFunctionYield(node.handler && node.handler.body, checkYieldReturnValue) || hasNonFunctionYield(node.finalizer, checkYieldReturnValue);
826
+ return hasNonFunctionYield(node.block, checkYieldReturnValue) || hasNonFunctionYield(node.handler && node.handler.body, checkYieldReturnValue) || hasNonFunctionYield( /** @type {import('@typescript-eslint/types').TSESTree.BlockStatement} */
827
+ node.finalizer, checkYieldReturnValue);
772
828
  }
773
829
  case 'SwitchStatement':
774
830
  {
@@ -817,17 +873,23 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
817
873
  // istanbul ignore next -- In Babel?
818
874
  case 'PropertyDefinition':
819
875
  /* eslint-disable no-fallthrough */
876
+ // @ts-expect-error In Babel?
820
877
  // istanbul ignore next -- In Babel?
821
878
  case 'ObjectProperty':
879
+ // @ts-expect-error In Babel?
822
880
  // istanbul ignore next -- In Babel?
823
881
  case 'ClassProperty':
824
882
  case 'Property':
825
883
  /* eslint-enable no-fallthrough */
826
884
  return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) || hasNonFunctionYield(node.value, checkYieldReturnValue);
885
+ // @ts-expect-error In Babel?
827
886
  // istanbul ignore next -- In Babel?
828
887
  case 'ObjectMethod':
888
+ // @ts-expect-error In Babel?
829
889
  // istanbul ignore next -- In Babel?
830
- return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) || node.arguments.some(nde => {
890
+ return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) ||
891
+ // @ts-expect-error In Babel?
892
+ node.arguments.some(nde => {
831
893
  return hasNonFunctionYield(nde, checkYieldReturnValue);
832
894
  });
833
895
  case 'SpreadElement':
@@ -836,12 +898,14 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
836
898
  case 'TaggedTemplateExpression':
837
899
  return hasNonFunctionYield(node.quasi, checkYieldReturnValue);
838
900
 
901
+ // @ts-expect-error In Babel?
839
902
  // ?.
840
903
  // istanbul ignore next -- In Babel?
841
904
  case 'OptionalMemberExpression':
842
905
  case 'MemberExpression':
843
906
  return hasNonFunctionYield(node.object, checkYieldReturnValue) || hasNonFunctionYield(node.property, checkYieldReturnValue);
844
907
 
908
+ // @ts-expect-error In Babel?
845
909
  // istanbul ignore next -- In Babel?
846
910
  case 'Import':
847
911
  case 'ImportExpression':
@@ -856,7 +920,7 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
856
920
  case 'YieldExpression':
857
921
  {
858
922
  if (checkYieldReturnValue) {
859
- if (node.parent.type === 'VariableDeclarator') {
923
+ if ( /** @type {import('eslint').Rule.Node} */node.parent.type === 'VariableDeclarator') {
860
924
  return true;
861
925
  }
862
926
  return false;
@@ -877,19 +941,19 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
877
941
 
878
942
  /**
879
943
  * Checks if a node has a return statement. Void return does not count.
880
- *
881
944
  * @param {ESTreeOrTypeScriptNode} node
882
945
  * @param {boolean} [checkYieldReturnValue]
883
946
  * @returns {boolean}
884
947
  */
885
948
  const hasYieldValue = (node, checkYieldReturnValue) => {
886
- return node.generator && (node.expression || hasNonFunctionYield(node.body, checkYieldReturnValue));
949
+ return (/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node.generator && ( /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node.expression || hasNonFunctionYield( /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */
950
+ node.body, checkYieldReturnValue))
951
+ );
887
952
  };
888
953
 
889
954
  /**
890
955
  * Checks if a node has a throws statement.
891
- *
892
- * @param {ESTreeOrTypeScriptNode} node
956
+ * @param {ESTreeOrTypeScriptNode|null|undefined} node
893
957
  * @param {boolean} [innerFunction]
894
958
  * @returns {boolean}
895
959
  */
@@ -965,9 +1029,8 @@ const isInlineTag = (tag) => {
965
1029
 
966
1030
  /**
967
1031
  * Parses GCC Generic/Template types
968
- *
969
- * @see {https://github.com/google/closure-compiler/wiki/Generic-Types}
970
- * @see {https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template}
1032
+ * @see {@link https://github.com/google/closure-compiler/wiki/Generic-Types}
1033
+ * @see {@link https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template}
971
1034
  * @param {import('comment-parser').Spec} tag
972
1035
  * @returns {string[]}
973
1036
  */
@@ -983,12 +1046,13 @@ const parseClosureTemplateTag = tag => {
983
1046
 
984
1047
  /**
985
1048
  * Checks user option for `contexts` array, defaulting to
986
- * contexts designated by the rule. Returns an array of
987
- * ESTree AST types, indicating allowable contexts.
988
- *
1049
+ * contexts designated by the rule. Returns an array of
1050
+ * ESTree AST types, indicating allowable contexts.
989
1051
  * @param {import('eslint').Rule.RuleContext} context
990
- * @param {DefaultContexts} defaultContexts
991
- * @param settings
1052
+ * @param {DefaultContexts|undefined} defaultContexts
1053
+ * @param {{
1054
+ * contexts?: import('./iterateJsdoc.js').Context[]
1055
+ * }} settings
992
1056
  * @returns {string[]}
993
1057
  */
994
1058
  const enforcedContexts = (context, defaultContexts, settings) => {
@@ -998,14 +1062,19 @@ const enforcedContexts = (context, defaultContexts, settings) => {
998
1062
  };
999
1063
 
1000
1064
  /**
1001
- * @param {string[]} contexts
1002
- * @param {Function} checkJsdoc
1003
- * @param {Function} handler
1065
+ * @param {import('./iterateJsdoc.js').Context[]} contexts
1066
+ * @param {import('./iterateJsdoc.js').CheckJsdoc} checkJsdoc
1067
+ * @param {import('@es-joy/jsdoccomment').CommentHandler} [handler]
1068
+ * @returns {import('eslint').Rule.RuleListener}
1004
1069
  */
1005
1070
  const getContextObject = (contexts, checkJsdoc, handler) => {
1071
+ /** @type {import('eslint').Rule.RuleListener} */
1006
1072
  const properties = {};
1007
1073
  for (const [idx, prop] of contexts.entries()) {
1074
+ /** @type {string} */
1008
1075
  let property;
1076
+
1077
+ /** @type {(node: import('eslint').Rule.Node) => void} */
1009
1078
  let value;
1010
1079
  if (typeof prop === 'object') {
1011
1080
  const selInfo = {
@@ -1013,13 +1082,18 @@ const getContextObject = (contexts, checkJsdoc, handler) => {
1013
1082
  selector: prop.context
1014
1083
  };
1015
1084
  if (prop.comment) {
1016
- property = prop.context;
1085
+ property = /** @type {string} */prop.context;
1017
1086
  value = checkJsdoc.bind(null, {
1018
1087
  ...selInfo,
1019
1088
  comment: prop.comment
1020
- }, handler.bind(null, prop.comment));
1089
+ },
1090
+ /**
1091
+ * @type {(jsdoc: import('@es-joy/jsdoccomment').JsdocBlockWithInline) => boolean}
1092
+ */
1093
+ /** @type {import('@es-joy/jsdoccomment').CommentHandler} */
1094
+ handler.bind(null, prop.comment));
1021
1095
  } else {
1022
- property = prop.context;
1096
+ property = /** @type {string} */prop.context;
1023
1097
  value = checkJsdoc.bind(null, selInfo, null);
1024
1098
  }
1025
1099
  } else {
@@ -1030,27 +1104,29 @@ const getContextObject = (contexts, checkJsdoc, handler) => {
1030
1104
  property = prop;
1031
1105
  value = checkJsdoc.bind(null, selInfo, null);
1032
1106
  }
1033
- const old = properties[property];
1034
- properties[property] = old ? function (...args) {
1035
- old(...args);
1036
- value(...args);
1107
+ const old =
1108
+ /**
1109
+ * @type {((node: import('eslint').Rule.Node) => void)}
1110
+ */
1111
+ properties[property];
1112
+ properties[property] = old ?
1113
+ /**
1114
+ * @type {((node: import('eslint').Rule.Node) => void)}
1115
+ */
1116
+ function (node) {
1117
+ old(node);
1118
+ value(node);
1037
1119
  } : value;
1038
1120
  }
1039
1121
  return properties;
1040
1122
  };
1041
- const filterTags = (tags, filter) => {
1042
- return tags.filter(tag => {
1043
- return filter(tag);
1044
- });
1045
- };
1046
1123
  const tagsWithNamesAndDescriptions = new Set(['param', 'arg', 'argument', 'property', 'prop', 'template',
1047
1124
  // These two are parsed by our custom parser as though having a `name`
1048
1125
  'returns', 'return']);
1049
1126
 
1050
- /* eslint-disable jsdoc/valid-types -- Old version */
1051
1127
  /**
1052
1128
  * @typedef {{
1053
- * [key: string]: false|
1129
+ * [key: string]: false|string|
1054
1130
  * {message: string, replacement?: string}
1055
1131
  * }} TagNamePreference
1056
1132
  */
@@ -1058,7 +1134,7 @@ const tagsWithNamesAndDescriptions = new Set(['param', 'arg', 'argument', 'prope
1058
1134
 
1059
1135
  /**
1060
1136
  * @param {import('eslint').Rule.RuleContext} context
1061
- * @param {ParserMode} mode
1137
+ * @param {ParserMode|undefined} mode
1062
1138
  * @param {import('comment-parser').Spec[]} tags
1063
1139
  * @param {TagNamePreference} tagPreference
1064
1140
  * @returns {{
@@ -1072,7 +1148,7 @@ const getTagsByType = (context, mode, tags, tagPreference) => {
1072
1148
  * @type {import('comment-parser').Spec[]}
1073
1149
  */
1074
1150
  const tagsWithoutNames = [];
1075
- const tagsWithNames = filterTags(tags, tag => {
1151
+ const tagsWithNames = tags.filter(tag => {
1076
1152
  const {
1077
1153
  tag: tagName
1078
1154
  } = tag;
@@ -1089,7 +1165,9 @@ const getTagsByType = (context, mode, tags, tagPreference) => {
1089
1165
  };
1090
1166
 
1091
1167
  /**
1092
- * @param {import('eslint').SourceCode} sourceCode
1168
+ * @param {import('eslint').SourceCode|{
1169
+ * text: string
1170
+ * }} sourceCode
1093
1171
  * @returns {string}
1094
1172
  */
1095
1173
  const getIndent = sourceCode => {
@@ -1098,64 +1176,87 @@ const getIndent = sourceCode => {
1098
1176
  };
1099
1177
 
1100
1178
  /**
1101
- * @param {ESTreeOrTypeScriptNode} node
1179
+ * @param {import('eslint').Rule.Node|null} node
1102
1180
  * @returns {boolean}
1103
1181
  */
1104
1182
  const isConstructor = node => {
1105
1183
  var _node$parent;
1106
- return (node === null || node === void 0 ? void 0 : node.type) === 'MethodDefinition' && node.kind === 'constructor' || (node === null || node === void 0 ? void 0 : (_node$parent = node.parent) === null || _node$parent === void 0 ? void 0 : _node$parent.kind) === 'constructor';
1184
+ return (node === null || node === void 0 ? void 0 : node.type) === 'MethodDefinition' && node.kind === 'constructor' || /** @type {import('@typescript-eslint/types').TSESTree.MethodDefinition} */(node === null || node === void 0 ? void 0 : (_node$parent = node.parent) === null || _node$parent === void 0 ? void 0 : _node$parent.kind) === 'constructor';
1107
1185
  };
1108
1186
 
1109
1187
  /**
1110
- * @param {ESTreeOrTypeScriptNode} node
1188
+ * @param {import('eslint').Rule.Node|null} node
1111
1189
  * @returns {boolean}
1112
1190
  */
1113
1191
  const isGetter = node => {
1114
1192
  var _node$parent2;
1115
- return node && ((_node$parent2 = node.parent) === null || _node$parent2 === void 0 ? void 0 : _node$parent2.kind) === 'get';
1193
+ return node !== null &&
1194
+ /**
1195
+ * @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
1196
+ * import('@typescript-eslint/types').TSESTree.Property}
1197
+ */
1198
+ ((_node$parent2 = node.parent) === null || _node$parent2 === void 0 ? void 0 : _node$parent2.kind) === 'get';
1116
1199
  };
1117
1200
 
1118
1201
  /**
1119
- * @param {ESTreeOrTypeScriptNode} node
1202
+ * @param {import('eslint').Rule.Node|null} node
1120
1203
  * @returns {boolean}
1121
1204
  */
1122
1205
  const isSetter = node => {
1123
1206
  var _node$parent3;
1124
- return node && ((_node$parent3 = node.parent) === null || _node$parent3 === void 0 ? void 0 : _node$parent3.kind) === 'set';
1207
+ return node !== null &&
1208
+ /**
1209
+ * @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
1210
+ * import('@typescript-eslint/types').TSESTree.Property}
1211
+ */
1212
+ ((_node$parent3 = node.parent) === null || _node$parent3 === void 0 ? void 0 : _node$parent3.kind) === 'set';
1125
1213
  };
1126
1214
 
1127
1215
  /**
1128
- * @param {ESTreeOrTypeScriptNode} node
1216
+ * @param {import('eslint').Rule.Node} node
1129
1217
  * @returns {boolean}
1130
1218
  */
1131
1219
  const hasAccessorPair = node => {
1132
1220
  const {
1133
1221
  type,
1134
1222
  kind: sourceKind,
1135
- key: {
1136
- name: sourceName
1137
- }
1138
- } = node;
1223
+ key
1224
+ } =
1225
+ /**
1226
+ * @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
1227
+ * import('@typescript-eslint/types').TSESTree.Property}
1228
+ */
1229
+ node;
1230
+ const sourceName = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */key.name;
1139
1231
  const oppositeKind = sourceKind === 'get' ? 'set' : 'get';
1140
- const children = type === 'MethodDefinition' ? 'body' : 'properties';
1141
- return node.parent[children].some(({
1142
- kind,
1143
- key: {
1144
- name
1145
- }
1146
- }) => {
1232
+ const sibling = type === 'MethodDefinition' ? /** @type {import('@typescript-eslint/types').TSESTree.ClassBody} */node.parent.body : /** @type {import('@typescript-eslint/types').TSESTree.ObjectExpression} */node.parent.properties;
1233
+ return sibling.some(child => {
1234
+ const {
1235
+ kind,
1236
+ key: ky
1237
+ } =
1238
+ /**
1239
+ * @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
1240
+ * import('@typescript-eslint/types').TSESTree.Property}
1241
+ */
1242
+ child;
1243
+ const name = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ky.name;
1147
1244
  return kind === oppositeKind && name === sourceName;
1148
1245
  });
1149
1246
  };
1150
1247
 
1151
1248
  /**
1152
- * @param {import('comment-parser').Block} jsdoc
1153
- * @param {ESTreeOrTypeScriptNode} node
1249
+ * @param {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc
1250
+ * @param {import('eslint').Rule.Node|null} node
1154
1251
  * @param {import('eslint').Rule.RuleContext} context
1155
- * @param {} schema
1252
+ * @param {import('json-schema').JSONSchema4} schema
1156
1253
  * @returns {boolean}
1157
1254
  */
1158
1255
  const exemptSpeciaMethods = (jsdoc, node, context, schema) => {
1256
+ /**
1257
+ * @param {"checkGetters"|"checkSetters"|"checkConstructors"} prop
1258
+ * @returns {boolean|"no-setter"|"no-getter"}
1259
+ */
1159
1260
  const hasSchemaOption = prop => {
1160
1261
  var _context$options$2;
1161
1262
  const schemaProperties = schema[0].properties;
@@ -1163,7 +1264,7 @@ const exemptSpeciaMethods = (jsdoc, node, context, schema) => {
1163
1264
  };
1164
1265
  const checkGetters = hasSchemaOption('checkGetters');
1165
1266
  const checkSetters = hasSchemaOption('checkSetters');
1166
- return !hasSchemaOption('checkConstructors') && (isConstructor(node) || hasATag(jsdoc, ['class', 'constructor'])) || isGetter(node) && (!checkGetters || checkGetters === 'no-setter' && hasAccessorPair(node.parent)) || isSetter(node) && (!checkSetters || checkSetters === 'no-getter' && hasAccessorPair(node.parent));
1267
+ return !hasSchemaOption('checkConstructors') && (isConstructor(node) || hasATag(jsdoc, ['class', 'constructor'])) || isGetter(node) && (!checkGetters || checkGetters === 'no-setter' && hasAccessorPair( /** @type {import('./iterateJsdoc.js').Node} */node.parent)) || isSetter(node) && (!checkSetters || checkSetters === 'no-getter' && hasAccessorPair( /** @type {import('./iterateJsdoc.js').Node} */node.parent));
1167
1268
  };
1168
1269
 
1169
1270
  /**
@@ -1171,17 +1272,16 @@ const exemptSpeciaMethods = (jsdoc, node, context, schema) => {
1171
1272
  * identifier or numeric literal) or single or double quoted, in either
1172
1273
  * the `@param` or in source, we need to strip the quotes to give a fair
1173
1274
  * comparison.
1174
- *
1175
1275
  * @param {string} str
1176
1276
  * @returns {string}
1177
1277
  */
1178
1278
  const dropPathSegmentQuotes = str => {
1179
- return str.replace(/\.(['"])(.*)\1/gu, '.$2');
1279
+ return str.replaceAll(/\.(['"])(.*)\1/gu, '.$2');
1180
1280
  };
1181
1281
 
1182
1282
  /**
1183
1283
  * @param {string} name
1184
- * @returns {(otherPathName: string) => void}
1284
+ * @returns {(otherPathName: string) => boolean}
1185
1285
  */
1186
1286
  const comparePaths = name => {
1187
1287
  return otherPathName => {
@@ -1190,17 +1290,20 @@ const comparePaths = name => {
1190
1290
  };
1191
1291
 
1192
1292
  /**
1293
+ * @callback PathDoesNotBeginWith
1193
1294
  * @param {string} name
1194
1295
  * @param {string} otherPathName
1195
1296
  * @returns {boolean}
1196
1297
  */
1298
+
1299
+ /** @type {PathDoesNotBeginWith} */
1197
1300
  const pathDoesNotBeginWith = (name, otherPathName) => {
1198
1301
  return !name.startsWith(otherPathName) && !dropPathSegmentQuotes(name).startsWith(dropPathSegmentQuotes(otherPathName));
1199
1302
  };
1200
1303
 
1201
1304
  /**
1202
1305
  * @param {string} regexString
1203
- * @param {string} requiredFlags
1306
+ * @param {string} [requiredFlags]
1204
1307
  * @returns {RegExp}
1205
1308
  */
1206
1309
  const getRegexFromString = (regexString, requiredFlags) => {
@@ -1222,7 +1325,6 @@ var _default = {
1222
1325
  dropPathSegmentQuotes,
1223
1326
  enforcedContexts,
1224
1327
  exemptSpeciaMethods,
1225
- filterTags,
1226
1328
  flattenRoots,
1227
1329
  getAllTags,
1228
1330
  getContextObject,