eslint-plugin-jsdoc 61.4.2 → 61.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,13 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
24
24
  mode
25
25
  } = settings;
26
26
  const usedNames = new Set();
27
- const templateTags = utils.getTags('template');
27
+ const tgName = /** @type {string} */utils.getPreferredTagName({
28
+ tagName: 'template'
29
+ });
30
+ if (!tgName) {
31
+ return;
32
+ }
33
+ const templateTags = utils.getTags(tgName);
28
34
  const templateNames = templateTags.flatMap(tag => {
29
35
  return utils.parseClosureTemplateTag(tag);
30
36
  });
@@ -32,7 +38,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
32
38
  for (const tag of templateTags) {
33
39
  const names = utils.parseClosureTemplateTag(tag);
34
40
  if (names.length > 1) {
35
- report(`Missing separate @template for ${names[1]}`, null, tag);
41
+ report(`Missing separate @${tgName} for ${names[1]}`, null, tag);
36
42
  }
37
43
  }
38
44
  }
@@ -61,7 +67,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
61
67
  }
62
68
  for (const usedName of usedNames) {
63
69
  if (!templateNames.includes(usedName)) {
64
- report(`Missing @template ${usedName}`);
70
+ report(`Missing @${tgName} ${usedName}`);
65
71
  }
66
72
  }
67
73
  };
@@ -144,7 +150,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
144
150
  // Could check against whitelist/blacklist
145
151
  for (const usedName of usedNames) {
146
152
  if (!templateNames.includes(usedName)) {
147
- report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));
153
+ report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));
148
154
  }
149
155
  }
150
156
  };
@@ -1 +1 @@
1
- {"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAA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EAC5C,IAAI,CAACyC,WAAW,CAACnC,MAAM,IAAImC,WAAW,CAACnC,MAAM,IAAI,CAAC,EAAE;IAClDS,WAAW,CAAC,CAAC;IACb;EACF;EAEA,MAAM2B,gBAAgB,GAAGD,WAAW,CAAC,CAAC,CAAC;EACvCpB,iBAAiB,CAACqB,gBAAgB,CAAC;EAEnCX,qBAAqB,CAAC,CACpB,UAAU,CACX,CAAC;AACJ,CAAC,EAAE;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,qEAAqE;MAClFC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVL,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXM,KAAK,EAAE;YACLnC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBoD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACX7B,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","tgName","getPreferredTagName","tagName","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","preferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n\n const tgName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'template',\n }));\n if (!tgName) {\n return;\n }\n\n const templateTags = utils.getTags(tgName);\n\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @${tgName} for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @${tgName} ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;EAEA,MAAM;IACJ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A,MAAMQ,WAAW,GAAGlD,KAAK,CAACW,OAAO,CAAC,SAAS,CAAC;EAC5C,IAAI,CAACuC,WAAW,CAACjC,MAAM,IAAIiC,WAAW,CAACjC,MAAM,IAAI,CAAC,EAAE;IAClDS,WAAW,CAAC,CAAC;IACb;EACF;EAEA,MAAMyB,gBAAgB,GAAGD,WAAW,CAAC,CAAC,CAAC;EACvClB,iBAAiB,CAACmB,gBAAgB,CAAC;EAEnCT,qBAAqB,CAAC,CACpB,UAAU,CACX,CAAC;AACJ,CAAC,EAAE;EACDU,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,qEAAqE;MAClFC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVL,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXM,KAAK,EAAE;YACLjC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACD1B,wBAAwB,EAAE;UACxBqD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACX3B,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAkC,MAAA,CAAApE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
package/dist/rules.d.ts CHANGED
@@ -1639,6 +1639,12 @@ export interface Rules {
1639
1639
  | []
1640
1640
  | [
1641
1641
  {
1642
+ /**
1643
+ * Normally, when `FunctionExpression` is checked, additional checks are
1644
+ * added to check the parent contexts where reporting is likely to be desired. If you really
1645
+ * want to check *all* function expressions, then set this to `true`.
1646
+ */
1647
+ checkAllFunctionExpressions?: boolean;
1642
1648
  /**
1643
1649
  * A value indicating whether `constructor`s should be checked. Defaults to
1644
1650
  * `true`. When `true`, `exemptEmptyConstructors` may still avoid reporting when
package/dist/tagNames.cjs CHANGED
@@ -112,8 +112,10 @@ const typeScriptTags = exports.typeScriptTags = {
112
112
  // https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#satisfies-support-in-jsdoc
113
113
  satisfies: [],
114
114
  // `@template` is also in TypeScript per:
115
- // https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#supported-jsdoc
116
- template: []
115
+ // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template
116
+ template: [
117
+ // Alias as per https://typedoc.org/documents/Tags._typeParam.html
118
+ 'typeParam']
117
119
  };
118
120
 
119
121
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tagNames.cjs","names":["jsdocTagsUndocumented","modifies","jsdocTags","exports","abstract","access","alias","async","augments","author","borrows","callback","class","classdesc","constant","constructs","copyright","default","deprecated","description","enum","event","example","external","file","fires","function","generator","global","hideconstructor","ignore","implements","inheritdoc","inheritDoc","inner","instance","interface","kind","lends","license","listens","member","memberof","mixes","mixin","module","name","namespace","override","package","param","private","property","protected","public","readonly","requires","returns","see","since","static","summary","this","throws","todo","tutorial","type","typedef","variation","version","yields","typeScriptTags","import","internal","overload","satisfies","template","undocumentedClosureTags","closurePrimitive","customElement","expose","hidden","idGenerator","meaning","mixinClass","mixinFunction","ngInject","owner","typeSummary","wizaction","typeScriptTagsInClosure","closureTags","define","dict","export","externs","final","implicitCast","noalias","nocollapse","nocompile","noinline","nosideeffects","polymer","polymerBehavior","preserve","record","return","struct","suppress","unrestricted"],"sources":["../src/tagNames.js"],"sourcesContent":["/**\n * @typedef {{\n * [key: string]: string[]\n * }} AliasedTags\n */\n\n/**\n * @type {AliasedTags}\n */\nconst jsdocTagsUndocumented = {\n // Undocumented but present; see\n // https://github.com/jsdoc/jsdoc/issues/1283#issuecomment-516816802\n // https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js#L594\n modifies: [],\n};\n\n/**\n * @type {AliasedTags}\n */\nconst jsdocTags = {\n ...jsdocTagsUndocumented,\n abstract: [\n 'virtual',\n ],\n access: [],\n alias: [],\n async: [],\n augments: [\n 'extends',\n ],\n author: [],\n borrows: [],\n callback: [],\n class: [\n 'constructor',\n ],\n classdesc: [],\n constant: [\n 'const',\n ],\n constructs: [],\n copyright: [],\n default: [\n 'defaultvalue',\n ],\n deprecated: [],\n description: [\n 'desc',\n ],\n enum: [],\n event: [],\n example: [],\n exports: [],\n external: [\n 'host',\n ],\n file: [\n 'fileoverview',\n 'overview',\n ],\n fires: [\n 'emits',\n ],\n function: [\n 'func',\n 'method',\n ],\n generator: [],\n global: [],\n hideconstructor: [],\n ignore: [],\n implements: [],\n inheritdoc: [],\n\n // Allowing casing distinct from jsdoc `definitions.js` (required in Closure)\n inheritDoc: [],\n\n inner: [],\n instance: [],\n interface: [],\n kind: [],\n lends: [],\n license: [],\n listens: [],\n member: [\n 'var',\n ],\n memberof: [],\n 'memberof!': [],\n mixes: [],\n mixin: [],\n\n module: [],\n name: [],\n namespace: [],\n override: [],\n package: [],\n param: [\n 'arg',\n 'argument',\n ],\n private: [],\n property: [\n 'prop',\n ],\n protected: [],\n public: [],\n readonly: [],\n requires: [],\n returns: [\n 'return',\n ],\n see: [],\n since: [],\n static: [],\n summary: [],\n\n this: [],\n throws: [\n 'exception',\n ],\n todo: [],\n tutorial: [],\n type: [],\n typedef: [],\n variation: [],\n version: [],\n yields: [\n 'yield',\n ],\n};\n\n/**\n * @type {AliasedTags}\n */\nconst typeScriptTags = {\n ...jsdocTags,\n\n // https://github.com/microsoft/TypeScript/issues/22160\n // https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag\n import: [],\n\n // https://www.typescriptlang.org/tsconfig/#stripInternal\n internal: [],\n\n // https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#overload-support-in-jsdoc\n overload: [],\n\n // https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#satisfies-support-in-jsdoc\n satisfies: [],\n\n // `@template` is also in TypeScript per:\n // https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#supported-jsdoc\n template: [],\n};\n\n/**\n * @type {AliasedTags}\n */\nconst undocumentedClosureTags = {\n // These are in Closure source but not in jsdoc source nor in the Closure\n // docs: https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/Annotation.java\n closurePrimitive: [],\n customElement: [],\n expose: [],\n hidden: [],\n idGenerator: [],\n meaning: [],\n mixinClass: [],\n mixinFunction: [],\n ngInject: [],\n owner: [],\n typeSummary: [],\n wizaction: [],\n};\n\nconst {\n /* eslint-disable no-unused-vars */\n inheritdoc,\n internal,\n overload,\n // Will be inverted to prefer `return`\n returns,\n\n satisfies,\n /* eslint-enable no-unused-vars */\n ...typeScriptTagsInClosure\n} = typeScriptTags;\n\n/**\n * @type {AliasedTags}\n */\nconst closureTags = {\n ...typeScriptTagsInClosure,\n ...undocumentedClosureTags,\n\n // From https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler\n // These are all recognized in https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js\n // except for the experimental `noinline` and the casing differences noted below\n\n // Defined as a synonym of `const` in jsdoc `definitions.js`\n define: [],\n\n dict: [],\n export: [],\n externs: [],\n final: [],\n\n // With casing distinct from jsdoc `definitions.js`\n implicitCast: [],\n\n noalias: [],\n nocollapse: [],\n nocompile: [],\n noinline: [],\n nosideeffects: [],\n polymer: [],\n polymerBehavior: [],\n preserve: [],\n\n // Defined as a synonym of `interface` in jsdoc `definitions.js`\n record: [],\n\n return: [\n 'returns',\n ],\n\n struct: [],\n suppress: [],\n\n unrestricted: [],\n};\n\nexport {\n closureTags,\n jsdocTags,\n typeScriptTags,\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG;EAC5B;EACA;EACA;EACAC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AE;EACXC,UAAU,EAAE,EAAE;EACdC,aAAa,EAAE,EAAE;EACjBC,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,EAAE;EACTC,WAAW,EAAE,EAAE;EACfC,SAAS,EAAE;AACb,CAAC;AAED,MAAM;EACJ;EACAzD,UAAU;EACVyC,QAAQ;EACRC,QAAQ;EACR;EACAjB,OAAO;EAEPkB,SAAS;EACT;EACA,GAAGe;AACL,CAAC,GAAGnB,cAAc;;AAElB;AACA;AACA;AACA,MAAMoB,WAAW,GAAAxF,OAAA,CAAAwF,WAAA,GAAG;EAClB,GAAGD,uBAAuB;EAC1B,GAAGb,uBAAuB;EAE1B;EACA;EACA;;EAEA;EACAe,MAAM,EAAE,EAAE;EAEVC,IAAI,EAAE,EAAE;EACRC,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE,EAAE;EACXC,KAAK,EAAE,EAAE;EAET;EACAC,YAAY,EAAE,EAAE;EAEhBC,OAAO,EAAE,EAAE;EACXC,UAAU,EAAE,EAAE;EACdC,SAAS,EAAE,EAAE;EACbC,QAAQ,EAAE,EAAE;EACZC,aAAa,EAAE,EAAE;EACjBC,OAAO,EAAE,EAAE;EACXC,eAAe,EAAE,EAAE;EACnBC,QAAQ,EAAE,EAAE;EAEZ;EACAC,MAAM,EAAE,EAAE;EAEVC,MAAM,EAAE,CACN,SAAS,CACV;EAEDC,MAAM,EAAE,EAAE;EACVC,QAAQ,EAAE,EAAE;EAEZC,YAAY,EAAE;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"tagNames.cjs","names":["jsdocTagsUndocumented","modifies","jsdocTags","exports","abstract","access","alias","async","augments","author","borrows","callback","class","classdesc","constant","constructs","copyright","default","deprecated","description","enum","event","example","external","file","fires","function","generator","global","hideconstructor","ignore","implements","inheritdoc","inheritDoc","inner","instance","interface","kind","lends","license","listens","member","memberof","mixes","mixin","module","name","namespace","override","package","param","private","property","protected","public","readonly","requires","returns","see","since","static","summary","this","throws","todo","tutorial","type","typedef","variation","version","yields","typeScriptTags","import","internal","overload","satisfies","template","undocumentedClosureTags","closurePrimitive","customElement","expose","hidden","idGenerator","meaning","mixinClass","mixinFunction","ngInject","owner","typeSummary","wizaction","typeScriptTagsInClosure","closureTags","define","dict","export","externs","final","implicitCast","noalias","nocollapse","nocompile","noinline","nosideeffects","polymer","polymerBehavior","preserve","record","return","struct","suppress","unrestricted"],"sources":["../src/tagNames.js"],"sourcesContent":["/**\n * @typedef {{\n * [key: string]: string[]\n * }} AliasedTags\n */\n\n/**\n * @type {AliasedTags}\n */\nconst jsdocTagsUndocumented = {\n // Undocumented but present; see\n // https://github.com/jsdoc/jsdoc/issues/1283#issuecomment-516816802\n // https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js#L594\n modifies: [],\n};\n\n/**\n * @type {AliasedTags}\n */\nconst jsdocTags = {\n ...jsdocTagsUndocumented,\n abstract: [\n 'virtual',\n ],\n access: [],\n alias: [],\n async: [],\n augments: [\n 'extends',\n ],\n author: [],\n borrows: [],\n callback: [],\n class: [\n 'constructor',\n ],\n classdesc: [],\n constant: [\n 'const',\n ],\n constructs: [],\n copyright: [],\n default: [\n 'defaultvalue',\n ],\n deprecated: [],\n description: [\n 'desc',\n ],\n enum: [],\n event: [],\n example: [],\n exports: [],\n external: [\n 'host',\n ],\n file: [\n 'fileoverview',\n 'overview',\n ],\n fires: [\n 'emits',\n ],\n function: [\n 'func',\n 'method',\n ],\n generator: [],\n global: [],\n hideconstructor: [],\n ignore: [],\n implements: [],\n inheritdoc: [],\n\n // Allowing casing distinct from jsdoc `definitions.js` (required in Closure)\n inheritDoc: [],\n\n inner: [],\n instance: [],\n interface: [],\n kind: [],\n lends: [],\n license: [],\n listens: [],\n member: [\n 'var',\n ],\n memberof: [],\n 'memberof!': [],\n mixes: [],\n mixin: [],\n\n module: [],\n name: [],\n namespace: [],\n override: [],\n package: [],\n param: [\n 'arg',\n 'argument',\n ],\n private: [],\n property: [\n 'prop',\n ],\n protected: [],\n public: [],\n readonly: [],\n requires: [],\n returns: [\n 'return',\n ],\n see: [],\n since: [],\n static: [],\n summary: [],\n\n this: [],\n throws: [\n 'exception',\n ],\n todo: [],\n tutorial: [],\n type: [],\n typedef: [],\n variation: [],\n version: [],\n yields: [\n 'yield',\n ],\n};\n\n/**\n * @type {AliasedTags}\n */\nconst typeScriptTags = {\n ...jsdocTags,\n\n // https://github.com/microsoft/TypeScript/issues/22160\n // https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag\n import: [],\n\n // https://www.typescriptlang.org/tsconfig/#stripInternal\n internal: [],\n\n // https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#overload-support-in-jsdoc\n overload: [],\n\n // https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#satisfies-support-in-jsdoc\n satisfies: [],\n\n // `@template` is also in TypeScript per:\n // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template\n template: [\n // Alias as per https://typedoc.org/documents/Tags._typeParam.html\n 'typeParam',\n ],\n};\n\n/**\n * @type {AliasedTags}\n */\nconst undocumentedClosureTags = {\n // These are in Closure source but not in jsdoc source nor in the Closure\n // docs: https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/Annotation.java\n closurePrimitive: [],\n customElement: [],\n expose: [],\n hidden: [],\n idGenerator: [],\n meaning: [],\n mixinClass: [],\n mixinFunction: [],\n ngInject: [],\n owner: [],\n typeSummary: [],\n wizaction: [],\n};\n\nconst {\n /* eslint-disable no-unused-vars */\n inheritdoc,\n internal,\n overload,\n // Will be inverted to prefer `return`\n returns,\n\n satisfies,\n /* eslint-enable no-unused-vars */\n ...typeScriptTagsInClosure\n} = typeScriptTags;\n\n/**\n * @type {AliasedTags}\n */\nconst closureTags = {\n ...typeScriptTagsInClosure,\n ...undocumentedClosureTags,\n\n // From https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler\n // These are all recognized in https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js\n // except for the experimental `noinline` and the casing differences noted below\n\n // Defined as a synonym of `const` in jsdoc `definitions.js`\n define: [],\n\n dict: [],\n export: [],\n externs: [],\n final: [],\n\n // With casing distinct from jsdoc `definitions.js`\n implicitCast: [],\n\n noalias: [],\n nocollapse: [],\n nocompile: [],\n noinline: [],\n nosideeffects: [],\n polymer: [],\n polymerBehavior: [],\n preserve: [],\n\n // Defined as a synonym of `interface` in jsdoc `definitions.js`\n record: [],\n\n return: [\n 'returns',\n ],\n\n struct: [],\n suppress: [],\n\n unrestricted: [],\n};\n\nexport {\n closureTags,\n jsdocTags,\n typeScriptTags,\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG;EAC5B;EACA;EACA;EACAC,QAAQ,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EAChB,GAAGF,qBAAqB;EACxBI,QAAQ,EAAE,CACR,SAAS,CACV;EACDC,MAAM,EAAE,EAAE;EACVC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,CACR,SAAS,CACV;EACDC,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE,EAAE;EACXC,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,CACL,aAAa,CACd;EACDC,SAAS,EAAE,EAAE;EACbC,QAAQ,EAAE,CACR,OAAO,CACR;EACDC,UAAU,EAAE,EAAE;EACdC,SAAS,EAAE,EAAE;EACbC,OAAO,EAAE,CACP,cAAc,CACf;EACDC,UAAU,EAAE,EAAE;EACdC,WAAW,EAAE,CACX,MAAM,CACP;EACDC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,EAAE;EACTC,OAAO,EAAE,EAAE;EACXnB,OAAO,EAAE,EAAE;EACXoB,QAAQ,EAAE,CAC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AE,EAAE;EACZC,aAAa,EAAE,EAAE;EACjBC,OAAO,EAAE,EAAE;EACXC,eAAe,EAAE,EAAE;EACnBC,QAAQ,EAAE,EAAE;EAEZ;EACAC,MAAM,EAAE,EAAE;EAEVC,MAAM,EAAE,CACN,SAAS,CACV;EAEDC,MAAM,EAAE,EAAE;EACVC,QAAQ,EAAE,EAAE;EAEZC,YAAY,EAAE;AAChB,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -5,14 +5,14 @@
5
5
  "url": "http://gajus.com"
6
6
  },
7
7
  "dependencies": {
8
- "@es-joy/jsdoccomment": "~0.76.0",
8
+ "@es-joy/jsdoccomment": "~0.78.0",
9
9
  "@es-joy/resolve.exports": "1.2.0",
10
10
  "are-docs-informative": "^0.0.2",
11
11
  "comment-parser": "1.4.1",
12
12
  "debug": "^4.4.3",
13
13
  "escape-string-regexp": "^4.0.0",
14
- "espree": "^10.4.0",
15
- "esquery": "^1.6.0",
14
+ "espree": "^11.0.0",
15
+ "esquery": "^1.7.0",
16
16
  "html-entities": "^2.6.0",
17
17
  "object-deep-merge": "^2.0.0",
18
18
  "parse-imports-exports": "^0.2.4",
@@ -30,13 +30,13 @@
30
30
  "@babel/plugin-transform-flow-strip-types": "^7.27.1",
31
31
  "@babel/preset-env": "^7.28.5",
32
32
  "@es-joy/escodegen": "^4.2.0",
33
- "@es-joy/jsdoc-eslint-parser": "^0.25.0",
34
- "@eslint/core": "^0.17.0",
33
+ "@es-joy/jsdoc-eslint-parser": "^0.27.0",
34
+ "@eslint/core": "^1.0.0",
35
35
  "@hkdobrev/run-if-changed": "^0.6.3",
36
36
  "@rollup/plugin-node-resolve": "^16.0.3",
37
37
  "@semantic-release/commit-analyzer": "^13.0.1",
38
- "@semantic-release/github": "^12.0.1",
39
- "@semantic-release/npm": "^13.1.1",
38
+ "@semantic-release/github": "^12.0.2",
39
+ "@semantic-release/npm": "^13.1.3",
40
40
  "@types/chai": "^5.2.3",
41
41
  "@types/debug": "^4.1.12",
42
42
  "@types/espree": "^10.1.0",
@@ -44,38 +44,38 @@
44
44
  "@types/estree": "^1.0.8",
45
45
  "@types/json-schema": "^7.0.15",
46
46
  "@types/mocha": "^10.0.10",
47
- "@types/node": "^24.10.0",
47
+ "@types/node": "^25.0.3",
48
48
  "@types/semver": "^7.7.1",
49
49
  "@types/spdx-expression-parse": "^3.0.5",
50
- "@typescript-eslint/types": "^8.46.2",
50
+ "@typescript-eslint/types": "^8.52.0",
51
51
  "babel-plugin-add-module-exports": "^1.0.4",
52
52
  "babel-plugin-istanbul": "^7.0.1",
53
53
  "babel-plugin-transform-import-meta": "^2.3.3",
54
54
  "c8": "^10.1.3",
55
- "camelcase": "^8.0.0",
56
- "chai": "^6.2.0",
55
+ "camelcase": "^9.0.0",
56
+ "chai": "^6.2.2",
57
57
  "decamelize": "^6.0.1",
58
- "eslint": "9.39.0",
59
- "eslint-config-canonical": "^45.0.1",
58
+ "eslint": "9.39.2",
59
+ "eslint-config-canonical": "^47.3.7",
60
60
  "gitdown": "^4.1.1",
61
- "glob": "^11.0.3",
62
- "globals": "^16.5.0",
61
+ "glob": "^13.0.0",
62
+ "globals": "^17.0.0",
63
63
  "husky": "^9.1.7",
64
- "jsdoc-type-pratt-parser": "^6.11.0",
64
+ "jsdoc-type-pratt-parser": "^7.0.0",
65
65
  "json-schema": "^0.4.0",
66
66
  "json-schema-to-typescript": "^15.0.4",
67
- "lint-staged": "^16.2.6",
68
- "mocha": "^11.7.4",
69
- "open-editor": "^5.1.0",
70
- "playwright": "^1.56.1",
67
+ "lint-staged": "^16.2.7",
68
+ "mocha": "^11.7.5",
69
+ "open-editor": "^6.0.0",
70
+ "playwright": "^1.57.0",
71
71
  "replace": "^1.2.2",
72
- "rimraf": "^6.1.0",
73
- "rollup": "^4.52.5",
74
- "semantic-release": "^25.0.1",
75
- "sinon": "^21.0.0",
76
- "ts-api-utils": "^2.1.0",
72
+ "rimraf": "^6.1.2",
73
+ "rollup": "^4.55.1",
74
+ "semantic-release": "^25.0.2",
75
+ "sinon": "^21.0.1",
76
+ "ts-api-utils": "^2.4.0",
77
77
  "typescript": "5.9.3",
78
- "typescript-eslint": "^8.46.2"
78
+ "typescript-eslint": "^8.52.0"
79
79
  },
80
80
  "engines": {
81
81
  "node": ">=20.11.0"
@@ -192,5 +192,5 @@
192
192
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
193
193
  "test-index": "pnpm run test-no-cov test/rules/index.js"
194
194
  },
195
- "version": "61.4.2"
195
+ "version": "61.7.1"
196
196
  }
@@ -1681,7 +1681,6 @@ const getUtils = (
1681
1681
 
1682
1682
  /** @type {GetClassNode} */
1683
1683
  utils.getClassNode = () => {
1684
- // eslint-disable-next-line canonical/no-use-extend-native -- Not extending
1685
1684
  return [
1686
1685
  ...ancestors, node,
1687
1686
  ].toReversed().find((parent) => {
@@ -12,34 +12,50 @@ const validatePropertyNames = (
12
12
  enableFixer,
13
13
  jsdoc, utils,
14
14
  ) => {
15
- const propertyTags = Object.entries(jsdoc.tags).filter(([
16
- , tag,
17
- ]) => {
18
- return tag.tag === targetTagName;
19
- });
15
+ const jsdocTypedefs = utils.getJsdocTagsDeep('typedef');
16
+ let propertyTagGroups;
17
+ if (jsdocTypedefs && jsdocTypedefs.length > 1) {
18
+ propertyTagGroups = jsdocTypedefs.map(({
19
+ idx,
20
+ }, index) => {
21
+ return Object.entries(jsdoc.tags).slice(idx, jsdocTypedefs[index + 1]?.idx);
22
+ });
23
+ } else {
24
+ propertyTagGroups = [
25
+ Object.entries(jsdoc.tags),
26
+ ];
27
+ }
20
28
 
21
- return propertyTags.some(([
22
- , tag,
23
- ], index) => {
24
- /** @type {import('../iterateJsdoc.js').Integer} */
25
- let tagsIndex;
26
- const dupeTagInfo = propertyTags.find(([
27
- tgsIndex,
28
- tg,
29
- ], idx) => {
30
- tagsIndex = Number(tgsIndex);
31
-
32
- return tg.name === tag.name && idx !== index;
29
+ return propertyTagGroups.some((propertyTagGroup) => {
30
+ const propertyTags = propertyTagGroup.filter(([
31
+ , tag,
32
+ ]) => {
33
+ return tag.tag === targetTagName;
33
34
  });
34
- if (dupeTagInfo) {
35
- utils.reportJSDoc(`Duplicate @${targetTagName} "${tag.name}"`, dupeTagInfo[1], enableFixer ? () => {
36
- utils.removeTag(tagsIndex);
37
- } : null);
38
35
 
39
- return true;
40
- }
36
+ return propertyTags.some(([
37
+ , tag,
38
+ ], index) => {
39
+ /** @type {import('../iterateJsdoc.js').Integer} */
40
+ let tagsIndex;
41
+ const dupeTagInfo = propertyTags.find(([
42
+ tgsIndex,
43
+ tg,
44
+ ], idx) => {
45
+ tagsIndex = Number(tgsIndex);
46
+
47
+ return tg.name === tag.name && idx !== index;
48
+ });
49
+ if (dupeTagInfo) {
50
+ utils.reportJSDoc(`Duplicate @${targetTagName} "${tag.name}"`, dupeTagInfo[1], enableFixer ? () => {
51
+ utils.removeTag(tagsIndex);
52
+ } : null);
41
53
 
42
- return false;
54
+ return true;
55
+ }
56
+
57
+ return false;
58
+ });
43
59
  });
44
60
  };
45
61
 
@@ -23,7 +23,14 @@ export default iterateJsdoc(({
23
23
  mode,
24
24
  } = settings;
25
25
 
26
- const templateTags = utils.getTags('template');
26
+ const tgName = /** @type {string} */ (utils.getPreferredTagName({
27
+ tagName: 'template',
28
+ }));
29
+ if (!tgName) {
30
+ return;
31
+ }
32
+
33
+ const templateTags = utils.getTags(tgName);
27
34
 
28
35
  const usedNames = new Set();
29
36
  /**
@@ -73,7 +80,7 @@ export default iterateJsdoc(({
73
80
  const names = utils.parseClosureTemplateTag(tag);
74
81
  for (const nme of names) {
75
82
  if (!usedNames.has(nme)) {
76
- report(`@template ${nme} not in use`, null, tag);
83
+ report(`@${tgName} ${nme} not in use`, null, tag);
77
84
  }
78
85
  }
79
86
  }
@@ -111,7 +111,6 @@ export default {
111
111
 
112
112
  const decorator = getDecorator(
113
113
  /** @type {import('eslint').Rule.Node} */
114
- // @ts-expect-error Bug?
115
114
  (baseNode),
116
115
  );
117
116
  if (decorator) {
@@ -204,7 +203,6 @@ export default {
204
203
  reportingNonJsdoc = true;
205
204
 
206
205
  /** @type {AddComment} */
207
- // eslint-disable-next-line unicorn/consistent-function-scoping -- Avoid conflicts
208
206
  const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
209
207
  const insertion = (
210
208
  inlineCommentBlock || enforceJsdocLineStyle === 'single' ?
@@ -36,6 +36,13 @@ const OPTIONS_SCHEMA = {
36
36
  additionalProperties: false,
37
37
  description: 'Has the following optional keys.\n',
38
38
  properties: {
39
+ checkAllFunctionExpressions: {
40
+ default: false,
41
+ description: `Normally, when \`FunctionExpression\` is checked, additional checks are
42
+ added to check the parent contexts where reporting is likely to be desired. If you really
43
+ want to check *all* function expressions, then set this to \`true\`.`,
44
+ type: 'boolean',
45
+ },
39
46
  checkConstructors: {
40
47
  default: true,
41
48
  description: `A value indicating whether \`constructor\`s should be checked. Defaults to
@@ -378,6 +385,7 @@ const getOption = (context, baseObject, option, key) => {
378
385
  * @param {import('eslint').Rule.RuleContext} context
379
386
  * @param {import('../iterateJsdoc.js').Settings} settings
380
387
  * @returns {{
388
+ * checkAllFunctionExpressions: boolean,
381
389
  * contexts: (string|{
382
390
  * context: string,
383
391
  * inlineCommentBlock: boolean,
@@ -396,6 +404,7 @@ const getOption = (context, baseObject, option, key) => {
396
404
  */
397
405
  const getOptions = (context, settings) => {
398
406
  const {
407
+ checkAllFunctionExpressions = false,
399
408
  contexts = settings.contexts || [],
400
409
  enableFixer = true,
401
410
  exemptEmptyConstructors = true,
@@ -408,6 +417,7 @@ const getOptions = (context, settings) => {
408
417
  } = context.options[0] || {};
409
418
 
410
419
  return {
420
+ checkAllFunctionExpressions,
411
421
  contexts,
412
422
  enableFixer,
413
423
  exemptEmptyConstructors,
@@ -503,7 +513,7 @@ const isFunctionWithOverload = (node) => {
503
513
  return false;
504
514
  }
505
515
 
506
- const functionName = node.id.name;
516
+ const functionName = node.id?.name;
507
517
 
508
518
  const idx = parent.body.indexOf(child);
509
519
  const prevSibling = parent.body[idx - 1];
@@ -536,6 +546,7 @@ export default {
536
546
  const opts = getOptions(context, settings);
537
547
 
538
548
  const {
549
+ checkAllFunctionExpressions,
539
550
  contexts,
540
551
  enableFixer,
541
552
  exemptEmptyConstructors,
@@ -670,7 +681,6 @@ export default {
670
681
 
671
682
  const decorator = getDecorator(
672
683
  /** @type {import('eslint').Rule.Node} */
673
- // @ts-expect-error Bug?
674
684
  (baseNode),
675
685
  );
676
686
  if (decorator) {
@@ -831,7 +841,7 @@ export default {
831
841
  return;
832
842
  }
833
843
 
834
- if (
844
+ if (checkAllFunctionExpressions ||
835
845
  [
836
846
  'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',
837
847
  ].includes(node.parent.type) ||
@@ -25,7 +25,16 @@ export default iterateJsdoc(({
25
25
  } = settings;
26
26
 
27
27
  const usedNames = new Set();
28
- const templateTags = utils.getTags('template');
28
+
29
+ const tgName = /** @type {string} */ (utils.getPreferredTagName({
30
+ tagName: 'template',
31
+ }));
32
+ if (!tgName) {
33
+ return;
34
+ }
35
+
36
+ const templateTags = utils.getTags(tgName);
37
+
29
38
  const templateNames = templateTags.flatMap((tag) => {
30
39
  return utils.parseClosureTemplateTag(tag);
31
40
  });
@@ -34,7 +43,7 @@ export default iterateJsdoc(({
34
43
  for (const tag of templateTags) {
35
44
  const names = utils.parseClosureTemplateTag(tag);
36
45
  if (names.length > 1) {
37
- report(`Missing separate @template for ${names[1]}`, null, tag);
46
+ report(`Missing separate @${tgName} for ${names[1]}`, null, tag);
38
47
  }
39
48
  }
40
49
  }
@@ -64,7 +73,7 @@ export default iterateJsdoc(({
64
73
 
65
74
  for (const usedName of usedNames) {
66
75
  if (!templateNames.includes(usedName)) {
67
- report(`Missing @template ${usedName}`);
76
+ report(`Missing @${tgName} ${usedName}`);
68
77
  }
69
78
  }
70
79
  };
@@ -156,7 +165,7 @@ export default iterateJsdoc(({
156
165
  // Could check against whitelist/blacklist
157
166
  for (const usedName of usedNames) {
158
167
  if (!templateNames.includes(usedName)) {
159
- report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));
168
+ report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));
160
169
  }
161
170
  }
162
171
  };
package/src/rules.d.ts CHANGED
@@ -1639,6 +1639,12 @@ export interface Rules {
1639
1639
  | []
1640
1640
  | [
1641
1641
  {
1642
+ /**
1643
+ * Normally, when `FunctionExpression` is checked, additional checks are
1644
+ * added to check the parent contexts where reporting is likely to be desired. If you really
1645
+ * want to check *all* function expressions, then set this to `true`.
1646
+ */
1647
+ checkAllFunctionExpressions?: boolean;
1642
1648
  /**
1643
1649
  * A value indicating whether `constructor`s should be checked. Defaults to
1644
1650
  * `true`. When `true`, `exemptEmptyConstructors` may still avoid reporting when
package/src/tagNames.js CHANGED
@@ -150,8 +150,11 @@ const typeScriptTags = {
150
150
  satisfies: [],
151
151
 
152
152
  // `@template` is also in TypeScript per:
153
- // https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#supported-jsdoc
154
- template: [],
153
+ // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template
154
+ template: [
155
+ // Alias as per https://typedoc.org/documents/Tags._typeParam.html
156
+ 'typeParam',
157
+ ],
155
158
  };
156
159
 
157
160
  /**