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.
- package/README.md +1 -2
- package/dist/generateDocs.cjs +1 -1
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/iterateJsdoc.cjs +0 -1
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +29 -16
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +8 -2
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +0 -2
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +13 -3
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +10 -4
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules.d.ts +6 -0
- package/dist/tagNames.cjs +4 -2
- package/dist/tagNames.cjs.map +1 -1
- package/package.json +27 -27
- package/src/iterateJsdoc.js +0 -1
- package/src/rules/checkPropertyNames.js +40 -24
- package/src/rules/checkTemplateNames.js +9 -2
- package/src/rules/convertToJsdocComments.js +0 -2
- package/src/rules/requireJsdoc.js +13 -3
- package/src/rules/requireTemplate.js +13 -4
- package/src/rules.d.ts +6 -0
- package/src/tagNames.js +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPropertyNames.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","validatePropertyNames","targetTagName","enableFixer","jsdoc","utils","
|
|
1
|
+
{"version":3,"file":"checkPropertyNames.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","validatePropertyNames","targetTagName","enableFixer","jsdoc","utils","jsdocTypedefs","getJsdocTagsDeep","propertyTagGroups","length","map","idx","index","Object","entries","tags","slice","some","propertyTagGroup","propertyTags","filter","tag","tagsIndex","dupeTagInfo","find","tgsIndex","tg","Number","name","reportJSDoc","removeTag","validatePropertyNamesDeep","jsdocPropertyNames","report","lastRealProperty","jsdocPropertyName","isPropertyPath","includes","pathRootNodeName","indexOf","endsWith","_default","exports","iterateJsdoc","context","options","jsdocPropertyNamesDeep","getPreferredTagName","tagName","isError","iterateAllJsdocs","meta","docs","description","url","fixable","schema","additionalProperties","properties","type","module"],"sources":["../../src/rules/checkPropertyNames.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} targetTagName\n * @param {boolean} enableFixer\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @returns {boolean}\n */\nconst validatePropertyNames = (\n targetTagName,\n enableFixer,\n jsdoc, utils,\n) => {\n const jsdocTypedefs = utils.getJsdocTagsDeep('typedef');\n let propertyTagGroups;\n if (jsdocTypedefs && jsdocTypedefs.length > 1) {\n propertyTagGroups = jsdocTypedefs.map(({\n idx,\n }, index) => {\n return Object.entries(jsdoc.tags).slice(idx, jsdocTypedefs[index + 1]?.idx);\n });\n } else {\n propertyTagGroups = [\n Object.entries(jsdoc.tags),\n ];\n }\n\n return propertyTagGroups.some((propertyTagGroup) => {\n const propertyTags = propertyTagGroup.filter(([\n , tag,\n ]) => {\n return tag.tag === targetTagName;\n });\n\n return propertyTags.some(([\n , tag,\n ], index) => {\n /** @type {import('../iterateJsdoc.js').Integer} */\n let tagsIndex;\n const dupeTagInfo = propertyTags.find(([\n tgsIndex,\n tg,\n ], idx) => {\n tagsIndex = Number(tgsIndex);\n\n return tg.name === tag.name && idx !== index;\n });\n if (dupeTagInfo) {\n utils.reportJSDoc(`Duplicate @${targetTagName} \"${tag.name}\"`, dupeTagInfo[1], enableFixer ? () => {\n utils.removeTag(tagsIndex);\n } : null);\n\n return true;\n }\n\n return false;\n });\n });\n};\n\n/**\n * @param {string} targetTagName\n * @param {{\n * idx: number;\n * name: string;\n * type: string;\n * }[]} jsdocPropertyNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Report} report\n */\nconst validatePropertyNamesDeep = (\n targetTagName,\n jsdocPropertyNames, jsdoc, report,\n) => {\n /** @type {string} */\n let lastRealProperty;\n\n return jsdocPropertyNames.some(({\n idx,\n name: jsdocPropertyName,\n }) => {\n const isPropertyPath = jsdocPropertyName.includes('.');\n\n if (isPropertyPath) {\n if (!lastRealProperty) {\n report(`@${targetTagName} path declaration (\"${jsdocPropertyName}\") appears before any real property.`, null, jsdoc.tags[idx]);\n\n return true;\n }\n\n let pathRootNodeName = jsdocPropertyName.slice(0, jsdocPropertyName.indexOf('.'));\n\n if (pathRootNodeName.endsWith('[]')) {\n pathRootNodeName = pathRootNodeName.slice(0, -2);\n }\n\n if (pathRootNodeName !== lastRealProperty) {\n report(\n `@${targetTagName} path declaration (\"${jsdocPropertyName}\") root node name (\"${pathRootNodeName}\") ` +\n `does not match previous real property name (\"${lastRealProperty}\").`,\n null,\n jsdoc.tags[idx],\n );\n\n return true;\n }\n } else {\n lastRealProperty = jsdocPropertyName;\n }\n\n return false;\n });\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n enableFixer = false,\n } = context.options[0] || {};\n const jsdocPropertyNamesDeep = utils.getJsdocTagsDeep('property');\n if (!jsdocPropertyNamesDeep || !jsdocPropertyNamesDeep.length) {\n return;\n }\n\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'property',\n }));\n const isError = validatePropertyNames(\n targetTagName,\n enableFixer,\n jsdoc,\n utils,\n );\n\n if (isError) {\n return;\n }\n\n validatePropertyNamesDeep(\n targetTagName, jsdocPropertyNamesDeep, jsdoc, report,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Ensures that property names in JSDoc are not duplicated on the same block and that nested properties have defined roots.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-property-names.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n description: `Set to \\`true\\` to auto-remove \\`@property\\` duplicates (based on\nidentical names).\n\nNote that this option will remove duplicates of the same name even if\nthe definitions do not match in other ways (e.g., the second property will\nbe removed even if it has a different type or description).`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,qBAAqB,GAAGA,CAC5BC,aAAa,EACbC,WAAW,EACXC,KAAK,EAAEC,KAAK,KACT;EACH,MAAMC,aAAa,GAAGD,KAAK,CAACE,gBAAgB,CAAC,SAAS,CAAC;EACvD,IAAIC,iBAAiB;EACrB,IAAIF,aAAa,IAAIA,aAAa,CAACG,MAAM,GAAG,CAAC,EAAE;IAC7CD,iBAAiB,GAAGF,aAAa,CAACI,GAAG,CAAC,CAAC;MACrCC;IACF,CAAC,EAAEC,KAAK,KAAK;MACX,OAAOC,MAAM,CAACC,OAAO,CAACV,KAAK,CAACW,IAAI,CAAC,CAACC,KAAK,CAACL,GAAG,EAAEL,aAAa,CAACM,KAAK,GAAG,CAAC,CAAC,EAAED,GAAG,CAAC;IAC7E,CAAC,CAAC;EACJ,CAAC,MAAM;IACLH,iBAAiB,GAAG,CAClBK,MAAM,CAACC,OAAO,CAACV,KAAK,CAACW,IAAI,CAAC,CAC3B;EACH;EAEA,OAAOP,iBAAiB,CAACS,IAAI,CAAEC,gBAAgB,IAAK;IAClD,MAAMC,YAAY,GAAGD,gBAAgB,CAACE,MAAM,CAAC,CAAC,GAC1CC,GAAG,CACN,KAAK;MACJ,OAAOA,GAAG,CAACA,GAAG,KAAKnB,aAAa;IAClC,CAAC,CAAC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B,CACvB7B,aAAa,EAAE4C,sBAAsB,EAAE1C,KAAK,EAAE6B,MAChD,CAAC;AACH,CAAC,EAAE;EACDiB,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,0HAA0H;MACvIC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVvD,WAAW,EAAE;UACXkD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,4DAA4D;UAChDM,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAAlB,OAAA,GAAAA,OAAA,CAAA1C,OAAA","ignoreList":[]}
|
|
@@ -19,7 +19,13 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
19
19
|
const {
|
|
20
20
|
mode
|
|
21
21
|
} = settings;
|
|
22
|
-
const
|
|
22
|
+
const tgName = /** @type {string} */utils.getPreferredTagName({
|
|
23
|
+
tagName: 'template'
|
|
24
|
+
});
|
|
25
|
+
if (!tgName) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const templateTags = utils.getTags(tgName);
|
|
23
29
|
const usedNames = new Set();
|
|
24
30
|
/**
|
|
25
31
|
* @param {string} potentialType
|
|
@@ -62,7 +68,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
62
68
|
const names = utils.parseClosureTemplateTag(tag);
|
|
63
69
|
for (const nme of names) {
|
|
64
70
|
if (!usedNames.has(nme)) {
|
|
65
|
-
report(
|
|
71
|
+
report(`@${tgName} ${nme} not in use`, null, tag);
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkTemplateNames.cjs","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdocUtils","_jsdoccomment","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","iterateJsdoc","jsdoc","node","report","settings","sourceCode","utils","mode","templateTags","getTags","usedNames","Set","checkForUsedTypes","potentialType","parsedType","tryParseType","parseType","traverse","nde","type","value","add","checkParamsAndReturnsTags","jsdc","paramName","getPreferredTagName","tagName","paramTags","paramTag","returnsName","returnsTags","returnsTag","checkTemplateTags","tag","names","parseClosureTemplateTag","nme","checkParameters","aliasDeclaration","checkParamsAndReturns","params","typeParameters","name","body","commentNode","getJSDocComment","innerJsdoc","parseComment","typeName","typeTags","typeTag","handleTypeAliases","declaration","callbackTags","functionTags","length","typedefTags","potentialTypedefType","propertyName","propertyTags","propertyTag","iterateAllJsdocs","meta","docs","description","url","schema","module"],"sources":["../../src/rules/checkTemplateNames.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n getTags,\n} from '../jsdocUtils.js';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n jsdoc,\n node,\n report,\n settings,\n sourceCode,\n utils,\n}) => {\n const {\n mode,\n } = settings;\n\n const templateTags = utils.getTags('template');\n\n const usedNames = new Set();\n /**\n * @param {string} potentialType\n */\n const checkForUsedTypes = (potentialType) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), 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') {\n usedNames.add(value);\n }\n });\n };\n\n const checkParamsAndReturnsTags = (jsdc = jsdoc) => {\n const paramName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n const paramTags = getTags(jsdc, paramName);\n for (const paramTag of paramTags) {\n checkForUsedTypes(paramTag.type);\n }\n\n const returnsName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n const returnsTags = getTags(jsdc, returnsName);\n for (const returnsTag of returnsTags) {\n checkForUsedTypes(returnsTag.type);\n }\n };\n\n const checkTemplateTags = () => {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n for (const nme of names) {\n if (!usedNames.has(nme)) {\n report(`@template ${nme} not in use`, null, tag);\n }\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.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n * @param {boolean} [checkParamsAndReturns]\n */\n const checkParameters = (aliasDeclaration, checkParamsAndReturns) => {\n /* c8 ignore next -- Guard */\n const {\n params,\n } = aliasDeclaration.typeParameters ?? {\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n if (checkParamsAndReturns) {\n checkParamsAndReturnsTags();\n } else if (aliasDeclaration.type === 'ClassDeclaration') {\n /* c8 ignore next -- TS */\n for (const nde of aliasDeclaration?.body?.body ?? []) {\n // @ts-expect-error Should be ok\n const commentNode = getJSDocComment(sourceCode, nde, settings);\n if (!commentNode) {\n continue;\n }\n\n const innerJsdoc = parseComment(commentNode, '');\n checkParamsAndReturnsTags(innerJsdoc);\n\n const typeName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'type',\n }));\n const typeTags = getTags(innerJsdoc, typeName);\n for (const typeTag of typeTags) {\n checkForUsedTypes(typeTag.type);\n }\n }\n }\n\n checkTemplateTags();\n };\n\n const handleTypeAliases = () => {\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 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkParameters(nde);\n break;\n case 'ExportDefaultDeclaration':\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkParameters(nde.declaration);\n break;\n case 'FunctionDeclaration':\n checkParameters(nde.declaration, true);\n break;\n }\n\n break;\n case 'FunctionDeclaration':\n checkParameters(nde, true);\n break;\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkParamsAndReturnsTags();\n checkTemplateTags();\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypeAliases();\n return;\n }\n\n const potentialTypedefType = typedefTags[0].type;\n checkForUsedTypes(potentialTypedefType);\n\n const propertyName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'property',\n }));\n const propertyTags = utils.getTags(propertyName);\n for (const propertyTag of propertyTags) {\n checkForUsedTypes(propertyTag.type);\n }\n\n checkTemplateTags();\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks that any `@template` names are actually used in the connected `@typedef` or type alias.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-template-names.md#repos-sticky-header',\n },\n schema: [],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AAK8B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CA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mBAAmB,CAAC;IACpEC,OAAO,EAAE;EACX,CAAC,CAAE;EACH,MAAMiC,YAAY,GAAGrD,KAAK,CAACG,OAAO,CAACiD,YAAY,CAAC;EAChD,KAAK,MAAME,WAAW,IAAID,YAAY,EAAE;IACtC/C,iBAAiB,CAACgD,WAAW,CAACzC,IAAI,CAAC;EACrC;EAEAa,iBAAiB,CAAC,CAAC;AACrB,CAAC,EAAE;EACD6B,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,gGAAgG;MAC7GC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,EAAE;IACV/C,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAgD,MAAA,CAAApE,OAAA,GAAAA,OAAA,CAAAV,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"checkTemplateNames.cjs","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdocUtils","_jsdoccomment","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","iterateJsdoc","jsdoc","node","report","settings","sourceCode","utils","mode","tgName","getPreferredTagName","tagName","templateTags","getTags","usedNames","Set","checkForUsedTypes","potentialType","parsedType","tryParseType","parseType","traverse","nde","type","value","add","checkParamsAndReturnsTags","jsdc","paramName","paramTags","paramTag","returnsName","returnsTags","returnsTag","checkTemplateTags","tag","names","parseClosureTemplateTag","nme","checkParameters","aliasDeclaration","checkParamsAndReturns","params","typeParameters","name","body","commentNode","getJSDocComment","innerJsdoc","parseComment","typeName","typeTags","typeTag","handleTypeAliases","declaration","callbackTags","functionTags","length","typedefTags","potentialTypedefType","propertyName","propertyTags","propertyTag","iterateAllJsdocs","meta","docs","description","url","schema","module"],"sources":["../../src/rules/checkTemplateNames.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n getTags,\n} from '../jsdocUtils.js';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n jsdoc,\n node,\n report,\n settings,\n sourceCode,\n utils,\n}) => {\n const {\n mode,\n } = settings;\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 usedNames = new Set();\n /**\n * @param {string} potentialType\n */\n const checkForUsedTypes = (potentialType) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), 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') {\n usedNames.add(value);\n }\n });\n };\n\n const checkParamsAndReturnsTags = (jsdc = jsdoc) => {\n const paramName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n const paramTags = getTags(jsdc, paramName);\n for (const paramTag of paramTags) {\n checkForUsedTypes(paramTag.type);\n }\n\n const returnsName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n const returnsTags = getTags(jsdc, returnsName);\n for (const returnsTag of returnsTags) {\n checkForUsedTypes(returnsTag.type);\n }\n };\n\n const checkTemplateTags = () => {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n for (const nme of names) {\n if (!usedNames.has(nme)) {\n report(`@${tgName} ${nme} not in use`, null, tag);\n }\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.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n * @param {boolean} [checkParamsAndReturns]\n */\n const checkParameters = (aliasDeclaration, checkParamsAndReturns) => {\n /* c8 ignore next -- Guard */\n const {\n params,\n } = aliasDeclaration.typeParameters ?? {\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n if (checkParamsAndReturns) {\n checkParamsAndReturnsTags();\n } else if (aliasDeclaration.type === 'ClassDeclaration') {\n /* c8 ignore next -- TS */\n for (const nde of aliasDeclaration?.body?.body ?? []) {\n // @ts-expect-error Should be ok\n const commentNode = getJSDocComment(sourceCode, nde, settings);\n if (!commentNode) {\n continue;\n }\n\n const innerJsdoc = parseComment(commentNode, '');\n checkParamsAndReturnsTags(innerJsdoc);\n\n const typeName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'type',\n }));\n const typeTags = getTags(innerJsdoc, typeName);\n for (const typeTag of typeTags) {\n checkForUsedTypes(typeTag.type);\n }\n }\n }\n\n checkTemplateTags();\n };\n\n const handleTypeAliases = () => {\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 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkParameters(nde);\n break;\n case 'ExportDefaultDeclaration':\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkParameters(nde.declaration);\n break;\n case 'FunctionDeclaration':\n checkParameters(nde.declaration, true);\n break;\n }\n\n break;\n case 'FunctionDeclaration':\n checkParameters(nde, true);\n break;\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkParamsAndReturnsTags();\n checkTemplateTags();\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypeAliases();\n return;\n }\n\n const potentialTypedefType = typedefTags[0].type;\n checkForUsedTypes(potentialTypedefType);\n\n const propertyName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'property',\n }));\n const propertyTags = utils.getTags(propertyName);\n for (const propertyTag of propertyTags) {\n checkForUsedTypes(propertyTag.type);\n }\n\n checkTemplateTags();\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks that any `@template` names are actually used in the connected `@typedef` or type alias.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-template-names.md#repos-sticky-header',\n },\n schema: [],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AAK8B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAA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F,CAAC,CAAC;AAAA8C,MAAA,CAAArE,OAAA,GAAAA,OAAA,CAAAV,OAAA","ignoreList":[]}
|
|
@@ -95,7 +95,6 @@ var _default = exports.default = {
|
|
|
95
95
|
*/
|
|
96
96
|
(0, _jsdoccomment.getReducedASTNode)(node, sourceCode);
|
|
97
97
|
const decorator = (0, _jsdoccomment.getDecorator)(/** @type {import('eslint').Rule.Node} */
|
|
98
|
-
// @ts-expect-error Bug?
|
|
99
98
|
baseNode);
|
|
100
99
|
if (decorator) {
|
|
101
100
|
baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */
|
|
@@ -169,7 +168,6 @@ var _default = exports.default = {
|
|
|
169
168
|
reportingNonJsdoc = true;
|
|
170
169
|
|
|
171
170
|
/** @type {AddComment} */
|
|
172
|
-
// eslint-disable-next-line unicorn/consistent-function-scoping -- Avoid conflicts
|
|
173
171
|
const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
|
|
174
172
|
const insertion = (inlineCommentBlock || enforceJsdocLineStyle === 'single' ? `/** ${commentToAdd.value.trim()} ` : `/**\n${indent}*${commentToAdd.value.trimEnd()}\n${indent}`) + `*/${'\n'.repeat((lines || 1) - 1)}`;
|
|
175
173
|
return fixer.replaceText(/** @type {import('eslint').AST.Token} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertToJsdocComments.cjs","names":["_iterateJsdoc","require","_jsdocUtils","_jsdoccomment","_default","exports","default","create","context","sourceCode","getSourceCode","settings","getSettings","allowedPrefixes","contexts","contextsAfter","contextsBeforeAndAfter","enableFixer","enforceJsdocLineStyle","lineOrBlockStyle","options","reportingNonJsdoc","report","messageId","comment","node","fixer","loc","end","column","line","start","fix","getFixer","addComment","ctxts","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","getText","inlineCommentBlock","find","contxt","ctxt","type","reportings","checkNonJsdoc","_info","_handler","getNonJsdocComment","some","prefix","value","trimStart","startsWith","commentToAdd","insertion","trim","trimEnd","repeat","replaceText","checkNonJsdocAfter","getFollowingComment","slice","remove","insertTextBefore","parent","getContextObject","enforcedContexts","meta","docs","description","url","fixable","messages","blockCommentsJsdocStyle","lineCommentsJsdocStyle","schema","additionalProperties","properties","items","anyOf","enum","module"],"sources":["../../src/rules/convertToJsdocComments.js"],"sourcesContent":["import {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n getContextObject,\n getIndent,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getFollowingComment,\n getNonJsdocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /**\n * @typedef {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} Token\n */\n\n /**\n * @callback AddComment\n * @param {boolean|undefined} inlineCommentBlock\n * @param {Token} comment\n * @param {string} indent\n * @param {number} lines\n * @param {import('eslint').Rule.RuleFixer} fixer\n */\n\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const {\n allowedPrefixes = [\n '@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',\n ],\n contexts = settings.contexts || [],\n contextsAfter = /** @type {string[]} */ ([]),\n contextsBeforeAndAfter = [\n 'VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition',\n ],\n enableFixer = true,\n enforceJsdocLineStyle = 'multi',\n lineOrBlockStyle = 'both',\n } = context.options[0] ?? {};\n\n let reportingNonJsdoc = false;\n\n /**\n * @param {string} messageId\n * @param {import('estree').Comment|Token} comment\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').Rule.ReportFixer} fixer\n */\n const report = (messageId, comment, node, fixer) => {\n const loc = {\n end: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n start: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n };\n\n context.report({\n fix: enableFixer ? fixer : null,\n loc,\n messageId,\n node,\n });\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const getFixer = (node, comment, addComment, ctxts) => {\n return /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n let baseNode =\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}\n */ (\n getReducedASTNode(node, sourceCode)\n );\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n // @ts-expect-error Bug?\n (baseNode),\n );\n if (decorator) {\n baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */ (\n decorator\n );\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }[]}\n */ (ctxts).find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n }) || {};\n\n return addComment(inlineCommentBlock, comment, indent, lines, fixer);\n };\n };\n\n /**\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {import('eslint').Rule.Node} node\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const reportings = (comment, node, addComment, ctxts) => {\n const fixer = getFixer(node, comment, addComment, ctxts);\n\n if (comment.type === 'Block') {\n if (lineOrBlockStyle === 'line') {\n return;\n }\n\n report('blockCommentsJsdocStyle', comment, node, fixer);\n return;\n }\n\n if (comment.type === 'Line') {\n if (lineOrBlockStyle === 'block') {\n return;\n }\n\n report('lineCommentsJsdocStyle', comment, node, fixer);\n }\n };\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkNonJsdoc = (_info, _handler, node) => {\n const comment = getNonJsdocComment(sourceCode, node, settings);\n\n if (\n !comment ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n reportingNonJsdoc = true;\n\n /** @type {AddComment} */\n // eslint-disable-next-line unicorn/consistent-function-scoping -- Avoid conflicts\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}`;\n\n return fixer.replaceText(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n insertion,\n );\n };\n\n reportings(comment, node, addComment, contexts);\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const checkNonJsdocAfter = (node, ctxts) => {\n const comment = getFollowingComment(sourceCode, node);\n\n if (\n !comment ||\n comment.value.startsWith('*') ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}${lines ? `\\n${indent.slice(1)}` : ' '}`;\n\n return [\n fixer.remove(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n ), fixer.insertTextBefore(\n node.type === 'VariableDeclarator' ? node.parent : node,\n insertion,\n ),\n ];\n };\n\n reportings(comment, node, addComment, ctxts);\n };\n\n // Todo: add contexts to check after (and handle if want both before and after)\n return {\n ...getContextObject(\n enforcedContexts(context, true, settings),\n checkNonJsdoc,\n ),\n ...getContextObject(\n contextsAfter,\n (_info, _handler, node) => {\n checkNonJsdocAfter(node, contextsAfter);\n },\n ),\n ...getContextObject(\n contextsBeforeAndAfter,\n (_info, _handler, node) => {\n checkNonJsdoc({}, null, node);\n if (!reportingNonJsdoc) {\n checkNonJsdocAfter(node, contextsBeforeAndAfter);\n }\n },\n ),\n };\n },\n meta: {\n docs: {\n description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',\n lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedPrefixes: {\n description: `An array of prefixes to allow at the beginning of a comment.\n\nDefaults to \\`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\\`.\n\nSupplying your own value overrides the defaults.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n contexts: {\n description: `The contexts array which will be checked for preceding content.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`, \\`TSDeclareFunction\\`.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsAfter: {\n description: `The contexts array which will be checked for content on the same line after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to an empty array.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsBeforeAndAfter: {\n description: `The contexts array which will be checked for content before and on the same\nline after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`VariableDeclarator\\`, \\`TSPropertySignature\\`, \\`PropertyDefinition\\`.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Set to `false` to disable fixing.',\n type: 'boolean',\n },\n enforceJsdocLineStyle: {\n description: `What policy to enforce on the conversion of non-JSDoc comments without\nline breaks. (Non-JSDoc (mulitline) comments with line breaks will always\nbe converted to \\`multi\\` style JSDoc comments.)\n\n- \\`multi\\` - Convert to multi-line style\n\\`\\`\\`js\n/**\n * Some text\n */\n\\`\\`\\`\n- \\`single\\` - Convert to single-line style\n\\`\\`\\`js\n/** Some text */\n\\`\\`\\`\n\nDefaults to \\`multi\\`.`,\n enum: [\n 'multi', 'single',\n ],\n type: 'string',\n },\n lineOrBlockStyle: {\n description: `What style of comments to which to apply JSDoc conversion.\n\n- \\`block\\` - Applies to block-style comments (\\`/* ... */\\`)\n- \\`line\\` - Applies to line-style comments (\\`// ...\\`)\n- \\`both\\` - Applies to both block and line-style comments\n\nDefaults to \\`both\\`.`,\n enum: [\n 'block', 'line', 'both',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,aAAA,GAAAF,OAAA;AAOA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe;EACbC,MAAMA,CAAEC,OAAO,EAAE;IACf;AACJ;AACA;AACA;AACA;AACA;AACA;;IAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;IAEI;IACA,MAAM;MACJC,UAAU,GAAGD,OAAO,CAACE,aAAa,CAAC;IACrC,CAAC,GAAGF,OAAO;IACX,MAAMG,QAAQ,GAAG,IAAAC,yBAAW,EAACJ,OAAO,CAAC;IACrC,IAAI,CAACG,QAAQ,EAAE;MACb,OAAO,CAAC,CAAC;IACX;IAEA,MAAM;MACJE,eAAe,GAAG,CAChB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CACzD;MACDC,QAAQ,GAAGH,QAAQ,CAACG,QAAQ,IAAI,EAAE;MAClCC,aAAa,IAAG,uBAAyB,EAAE,CAAC;MAC5CC,sBAAsB,GAAG,CACvB,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,CAClE;MACDC,WAAW,GAAG,IAAI;MAClBC,qBAAqB,GAAG,OAAO;MAC/BC,gBAAgB,GAAG;IACrB,CAAC,GAAGX,OAAO,CAACY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAIC,iBAAiB,GAAG,KAAK;;IAE7B;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AI,EAAE;gBACR,CAAC;gBACDJ,kBAAkB,EAAE;kBAClBI,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDnC,sBAAsB,EAAE;UACtB8D,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,qFAAqF;UACzES,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACErC,IAAI,EAAE;YACR,CAAC,EACD;cACEkC,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACV9E,OAAO,EAAE;kBACP2C,IAAI,EAAE;gBACR,CAAC;gBACDJ,kBAAkB,EAAE;kBAClBI,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDlC,WAAW,EAAE;UACX6D,WAAW,EAAE,mCAAmC;UAChD3B,IAAI,EAAE;QACR,CAAC;QACDjC,qBAAqB,EAAE;UACrB4D,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACXW,IAAI,EAAE,CACJ,OAAO,EAAE,QAAQ,CAClB;UACDtC,IAAI,EAAE;QACR,CAAC;QACDhC,gBAAgB,EAAE;UAChB2D,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVW,IAAI,EAAE,CACJ,OAAO,EAAE,MAAM,EAAE,MAAM,CACxB;UACDtC,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC;AAAAuC,MAAA,CAAArF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertToJsdocComments.cjs","names":["_iterateJsdoc","require","_jsdocUtils","_jsdoccomment","_default","exports","default","create","context","sourceCode","getSourceCode","settings","getSettings","allowedPrefixes","contexts","contextsAfter","contextsBeforeAndAfter","enableFixer","enforceJsdocLineStyle","lineOrBlockStyle","options","reportingNonJsdoc","report","messageId","comment","node","fixer","loc","end","column","line","start","fix","getFixer","addComment","ctxts","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","getText","inlineCommentBlock","find","contxt","ctxt","type","reportings","checkNonJsdoc","_info","_handler","getNonJsdocComment","some","prefix","value","trimStart","startsWith","commentToAdd","insertion","trim","trimEnd","repeat","replaceText","checkNonJsdocAfter","getFollowingComment","slice","remove","insertTextBefore","parent","getContextObject","enforcedContexts","meta","docs","description","url","fixable","messages","blockCommentsJsdocStyle","lineCommentsJsdocStyle","schema","additionalProperties","properties","items","anyOf","enum","module"],"sources":["../../src/rules/convertToJsdocComments.js"],"sourcesContent":["import {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n getContextObject,\n getIndent,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getFollowingComment,\n getNonJsdocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /**\n * @typedef {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} Token\n */\n\n /**\n * @callback AddComment\n * @param {boolean|undefined} inlineCommentBlock\n * @param {Token} comment\n * @param {string} indent\n * @param {number} lines\n * @param {import('eslint').Rule.RuleFixer} fixer\n */\n\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const {\n allowedPrefixes = [\n '@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',\n ],\n contexts = settings.contexts || [],\n contextsAfter = /** @type {string[]} */ ([]),\n contextsBeforeAndAfter = [\n 'VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition',\n ],\n enableFixer = true,\n enforceJsdocLineStyle = 'multi',\n lineOrBlockStyle = 'both',\n } = context.options[0] ?? {};\n\n let reportingNonJsdoc = false;\n\n /**\n * @param {string} messageId\n * @param {import('estree').Comment|Token} comment\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').Rule.ReportFixer} fixer\n */\n const report = (messageId, comment, node, fixer) => {\n const loc = {\n end: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n start: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n };\n\n context.report({\n fix: enableFixer ? fixer : null,\n loc,\n messageId,\n node,\n });\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const getFixer = (node, comment, addComment, ctxts) => {\n return /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n let baseNode =\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}\n */ (\n getReducedASTNode(node, sourceCode)\n );\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */ (\n decorator\n );\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }[]}\n */ (ctxts).find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n }) || {};\n\n return addComment(inlineCommentBlock, comment, indent, lines, fixer);\n };\n };\n\n /**\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {import('eslint').Rule.Node} node\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const reportings = (comment, node, addComment, ctxts) => {\n const fixer = getFixer(node, comment, addComment, ctxts);\n\n if (comment.type === 'Block') {\n if (lineOrBlockStyle === 'line') {\n return;\n }\n\n report('blockCommentsJsdocStyle', comment, node, fixer);\n return;\n }\n\n if (comment.type === 'Line') {\n if (lineOrBlockStyle === 'block') {\n return;\n }\n\n report('lineCommentsJsdocStyle', comment, node, fixer);\n }\n };\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkNonJsdoc = (_info, _handler, node) => {\n const comment = getNonJsdocComment(sourceCode, node, settings);\n\n if (\n !comment ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n reportingNonJsdoc = true;\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}`;\n\n return fixer.replaceText(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n insertion,\n );\n };\n\n reportings(comment, node, addComment, contexts);\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const checkNonJsdocAfter = (node, ctxts) => {\n const comment = getFollowingComment(sourceCode, node);\n\n if (\n !comment ||\n comment.value.startsWith('*') ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}${lines ? `\\n${indent.slice(1)}` : ' '}`;\n\n return [\n fixer.remove(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n ), fixer.insertTextBefore(\n node.type === 'VariableDeclarator' ? node.parent : node,\n insertion,\n ),\n ];\n };\n\n reportings(comment, node, addComment, ctxts);\n };\n\n // Todo: add contexts to check after (and handle if want both before and after)\n return {\n ...getContextObject(\n enforcedContexts(context, true, settings),\n checkNonJsdoc,\n ),\n ...getContextObject(\n contextsAfter,\n (_info, _handler, node) => {\n checkNonJsdocAfter(node, contextsAfter);\n },\n ),\n ...getContextObject(\n contextsBeforeAndAfter,\n (_info, _handler, node) => {\n checkNonJsdoc({}, null, node);\n if (!reportingNonJsdoc) {\n checkNonJsdocAfter(node, contextsBeforeAndAfter);\n }\n },\n ),\n };\n },\n meta: {\n docs: {\n description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',\n lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedPrefixes: {\n description: `An array of prefixes to allow at the beginning of a comment.\n\nDefaults to \\`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\\`.\n\nSupplying your own value overrides the defaults.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n contexts: {\n description: `The contexts array which will be checked for preceding content.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`, \\`TSDeclareFunction\\`.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsAfter: {\n description: `The contexts array which will be checked for content on the same line after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to an empty array.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsBeforeAndAfter: {\n description: `The contexts array which will be checked for content before and on the same\nline after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`VariableDeclarator\\`, \\`TSPropertySignature\\`, \\`PropertyDefinition\\`.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Set to `false` to disable fixing.',\n type: 'boolean',\n },\n enforceJsdocLineStyle: {\n description: `What policy to enforce on the conversion of non-JSDoc comments without\nline breaks. (Non-JSDoc (mulitline) comments with line breaks will always\nbe converted to \\`multi\\` style JSDoc comments.)\n\n- \\`multi\\` - Convert to multi-line style\n\\`\\`\\`js\n/**\n * Some text\n */\n\\`\\`\\`\n- \\`single\\` - Convert to single-line style\n\\`\\`\\`js\n/** Some text */\n\\`\\`\\`\n\nDefaults to \\`multi\\`.`,\n enum: [\n 'multi', 'single',\n ],\n type: 'string',\n },\n lineOrBlockStyle: {\n description: `What style of comments to which to apply JSDoc conversion.\n\n- \\`block\\` - Applies to block-style comments (\\`/* ... */\\`)\n- \\`line\\` - Applies to line-style comments (\\`// ...\\`)\n- \\`both\\` - Applies to both block and line-style comments\n\nDefaults to \\`both\\`.`,\n enum: [\n 'block', 'line', 'both',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,aAAA,GAAAF,OAAA;AAOA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe;EACbC,MAAMA,CAAEC,OAAO,EAAE;IACf;AACJ;AACA;AACA;AACA;AACA;AACA;;IAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;IAEI;IACA,MAAM;MACJC,UAAU,GAAGD,OAAO,CAACE,aAAa,CAAC;IACrC,CAAC,GAAGF,OAAO;IACX,MAAMG,QAAQ,GAAG,IAAAC,yBAAW,EAACJ,OAAO,CAAC;IACrC,IAAI,CAACG,QAAQ,EAAE;MACb,OAAO,CAAC,CAAC;IACX;IAEA,MAAM;MACJE,eAAe,GAAG,CAChB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CACzD;MACDC,QAAQ,GAAGH,QAAQ,CAACG,QAAQ,IAAI,EAAE;MAClCC,aAAa,IAAG,uBAAyB,EAAE,CAAC;MAC5CC,sBAAsB,GA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AAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC;AAAAuC,MAAA,CAAArF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -28,6 +28,13 @@ const OPTIONS_SCHEMA = {
|
|
|
28
28
|
additionalProperties: false,
|
|
29
29
|
description: 'Has the following optional keys.\n',
|
|
30
30
|
properties: {
|
|
31
|
+
checkAllFunctionExpressions: {
|
|
32
|
+
default: false,
|
|
33
|
+
description: `Normally, when \`FunctionExpression\` is checked, additional checks are
|
|
34
|
+
added to check the parent contexts where reporting is likely to be desired. If you really
|
|
35
|
+
want to check *all* function expressions, then set this to \`true\`.`,
|
|
36
|
+
type: 'boolean'
|
|
37
|
+
},
|
|
31
38
|
checkConstructors: {
|
|
32
39
|
default: true,
|
|
33
40
|
description: `A value indicating whether \`constructor\`s should be checked. Defaults to
|
|
@@ -325,6 +332,7 @@ const getOption = (context, baseObject, option, key) => {
|
|
|
325
332
|
* @param {import('eslint').Rule.RuleContext} context
|
|
326
333
|
* @param {import('../iterateJsdoc.js').Settings} settings
|
|
327
334
|
* @returns {{
|
|
335
|
+
* checkAllFunctionExpressions: boolean,
|
|
328
336
|
* contexts: (string|{
|
|
329
337
|
* context: string,
|
|
330
338
|
* inlineCommentBlock: boolean,
|
|
@@ -343,6 +351,7 @@ const getOption = (context, baseObject, option, key) => {
|
|
|
343
351
|
*/
|
|
344
352
|
const getOptions = (context, settings) => {
|
|
345
353
|
const {
|
|
354
|
+
checkAllFunctionExpressions = false,
|
|
346
355
|
contexts = settings.contexts || [],
|
|
347
356
|
enableFixer = true,
|
|
348
357
|
exemptEmptyConstructors = true,
|
|
@@ -354,6 +363,7 @@ const getOptions = (context, settings) => {
|
|
|
354
363
|
skipInterveningOverloadedDeclarations = true
|
|
355
364
|
} = context.options[0] || {};
|
|
356
365
|
return {
|
|
366
|
+
checkAllFunctionExpressions,
|
|
357
367
|
contexts,
|
|
358
368
|
enableFixer,
|
|
359
369
|
exemptEmptyConstructors,
|
|
@@ -413,7 +423,7 @@ const isFunctionWithOverload = node => {
|
|
|
413
423
|
if (!child || !parent) {
|
|
414
424
|
return false;
|
|
415
425
|
}
|
|
416
|
-
const functionName = node.id
|
|
426
|
+
const functionName = node.id?.name;
|
|
417
427
|
const idx = parent.body.indexOf(child);
|
|
418
428
|
const prevSibling = parent.body[idx - 1];
|
|
419
429
|
return (
|
|
@@ -441,6 +451,7 @@ var _default = exports.default = {
|
|
|
441
451
|
}
|
|
442
452
|
const opts = getOptions(context, settings);
|
|
443
453
|
const {
|
|
454
|
+
checkAllFunctionExpressions,
|
|
444
455
|
contexts,
|
|
445
456
|
enableFixer,
|
|
446
457
|
exemptEmptyConstructors,
|
|
@@ -548,7 +559,6 @@ var _default = exports.default = {
|
|
|
548
559
|
/** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */
|
|
549
560
|
let baseNode = (0, _jsdoccomment.getReducedASTNode)(node, sourceCode);
|
|
550
561
|
const decorator = (0, _jsdoccomment.getDecorator)(/** @type {import('eslint').Rule.Node} */
|
|
551
|
-
// @ts-expect-error Bug?
|
|
552
562
|
baseNode);
|
|
553
563
|
if (decorator) {
|
|
554
564
|
baseNode = decorator;
|
|
@@ -670,7 +680,7 @@ var _default = exports.default = {
|
|
|
670
680
|
if (!hasOption('FunctionExpression')) {
|
|
671
681
|
return;
|
|
672
682
|
}
|
|
673
|
-
if (['AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator'].includes(node.parent.type) || ['ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition'].includes(node.parent.type) && node ===
|
|
683
|
+
if (checkAllFunctionExpressions || ['AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator'].includes(node.parent.type) || ['ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition'].includes(node.parent.type) && node ===
|
|
674
684
|
/**
|
|
675
685
|
* @type {import('@typescript-eslint/types').TSESTree.Property|
|
|
676
686
|
* import('@typescript-eslint/types').TSESTree.PropertyDefinition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireJsdoc.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","_jsdocUtils","_jsdoccomment","e","__esModule","default","OPTIONS_SCHEMA","additionalProperties","description","properties","checkConstructors","type","checkGetters","anyOf","enum","checkSetters","contexts","items","context","inlineCommentBlock","minLineCount","enableFixer","exemptEmptyConstructors","exemptEmptyFunctions","exemptOverloadedImplementations","fixerMessage","publicOnly","oneOf","ancestorsOnly","cjs","esm","window","ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","MethodDefinition","skipInterveningOverloadedDeclarations","getMethodOnInterface","interfaceName","methodName","scope","scp","identifiers","name","variables","identifier","interfaceDeclaration","parent","bodyItem","body","methodSig","key","upper","isExemptedImplementer","node","sourceCode","settings","implments","implements","impl","expression","interfaceMethodNode","getScope","comment","getJSDocComment","getOption","baseObject","option","options","getOptions","undefined","baseObj","prop","Object","keys","opt","isFunctionWithOverload","child","functionName","id","idx","indexOf","prevSibling","declaration","_default","exports","create","getSourceCode","getSettings","opts","requireOption","checkJsDoc","info","_handler","some","ctxt","count","underMinLine","getText","match","length","contextMinLineCount","find","ctx","selector","jsDocNode","checkOverloads","exemptSpeciaMethods","inlineTags","problems","source","tags","isFunctionContext","isConstructor","functionParameterNames","getFunctionParameterNames","hasReturnValue","fix","fixer","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","loc","start","column","contxt","insertion","repeat","slice","insertTextBefore","report","end","line","messageId","Boolean","initModuleExports","initWindow","exported","exportParser","isUncommentedExport","hasOption","getContextObject","enforcedContexts","includes","value","meta","docs","category","recommended","url","fixable","messages","missingJsDoc","schema","module"],"sources":["../../src/rules/requireJsdoc.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n exemptSpeciaMethods,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n hasReturnValue,\n isConstructor,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getJSDocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/**\n * @typedef {{\n * ancestorsOnly: boolean,\n * esm: boolean,\n * initModuleExports: boolean,\n * initWindow: boolean\n * }} RequireJsdocOpts\n */\n\n/**\n * @typedef {import('eslint').Rule.Node|\n * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode\n */\n\n/** @type {import('json-schema').JSONSchema4} */\nconst OPTIONS_SCHEMA = {\n additionalProperties: false,\n description: 'Has the following optional keys.\\n',\n properties: {\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked. Defaults to\n\\`true\\`. When \\`true\\`, \\`exemptEmptyConstructors\\` may still avoid reporting when\nno parameters or return values are found.`,\n type: 'boolean',\n },\n checkGetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-setter',\n ],\n type: 'string',\n },\n ],\n default: true,\n description: `A value indicating whether getters should be checked. Besides setting as a\nboolean, this option can be set to the string \\`\"no-setter\"\\` to indicate that\ngetters should be checked but only when there is no setter. This may be useful\nif one only wishes documentation on one of the two accessors. Defaults to\n\\`false\\`.`,\n },\n checkSetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-getter',\n ],\n type: 'string',\n },\n ],\n default: true,\n description: `A value indicating whether setters should be checked. Besides setting as a\nboolean, this option can be set to the string \\`\"no-getter\"\\` to indicate that\nsetters should be checked but only when there is no getter. This may be useful\nif one only wishes documentation on one of the two accessors. Defaults to\n\\`false\\`.`,\n },\n contexts: {\n description: `Set this to an array of strings or objects representing the additional AST\ncontexts where you wish the rule to be applied (e.g., \\`Property\\` for\nproperties). If specified as an object, it should have a \\`context\\` property\nand can have an \\`inlineCommentBlock\\` property which, if set to \\`true\\`, will\nadd an inline \\`/** */\\` instead of the regular, multi-line, indented jsdoc\nblock which will otherwise be added. Defaults to an empty array. Contexts\nmay also have their own \\`minLineCount\\` property which is an integer\nindicating a minimum number of lines expected for a node in order\nfor it to require documentation.\n\nNote that you may need to disable \\`require\\` items (e.g., \\`MethodDefinition\\`)\nif you are specifying a more precise form in \\`contexts\\` (e.g., \\`MethodDefinition:not([accessibility=\"private\"] > FunctionExpression\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n minLineCount: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n default: true,\n description: `A boolean on whether to enable the fixer (which adds an empty JSDoc block).\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n exemptEmptyConstructors: {\n default: false,\n description: `When \\`true\\`, the rule will not report missing JSDoc blocks above constructors\nwith no parameters or return values (this is enabled by default as the class\nname or description should be seen as sufficient to convey intent).\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n exemptEmptyFunctions: {\n default: false,\n description: `When \\`true\\`, the rule will not report missing JSDoc blocks above\nfunctions/methods with no parameters or return values (intended where\nfunction/method names are sufficient for themselves as documentation).\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n exemptOverloadedImplementations: {\n default: false,\n description: `If set to \\`true\\` will avoid checking an overloaded function's implementation.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n fixerMessage: {\n default: '',\n description: `An optional message to add to the inserted JSDoc block. Defaults to the\nempty string.`,\n type: 'string',\n },\n minLineCount: {\n description: `An integer to indicate a minimum number of lines expected for a node in order\nfor it to require documentation. Defaults to \\`undefined\\`. This option will\napply to any context; see \\`contexts\\` for line counts specific to a context.`,\n type: 'integer',\n },\n publicOnly: {\n description: `This option will insist that missing JSDoc blocks are only reported for\nfunction bodies / class declarations that are exported from the module.\nMay be a boolean or object. If set to \\`true\\`, the defaults below will be\nused. If unset, JSDoc block reporting will not be limited to exports.\n\nThis object supports the following optional boolean keys (\\`false\\` unless\notherwise noted):\n\n- \\`ancestorsOnly\\` - Optimization to only check node ancestors to check if node is exported\n- \\`esm\\` - ESM exports are checked for JSDoc comments (Defaults to \\`true\\`)\n- \\`cjs\\` - CommonJS exports are checked for JSDoc comments (Defaults to \\`true\\`)\n- \\`window\\` - Window global exports are checked for JSDoc comments`,\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n require: {\n additionalProperties: false,\n default: {},\n description: `An object with the following optional boolean keys which all default to\n\\`false\\` except for \\`FunctionDeclaration\\` which defaults to \\`true\\`.`,\n properties: {\n ArrowFunctionExpression: {\n default: false,\n description: 'Whether to check arrow functions like `() => {}`',\n type: 'boolean',\n },\n ClassDeclaration: {\n default: false,\n description: 'Whether to check declarations like `class A {}`',\n type: 'boolean',\n },\n ClassExpression: {\n default: false,\n description: 'Whether to check class expressions like `const myClass = class {}`',\n type: 'boolean',\n },\n FunctionDeclaration: {\n default: true,\n description: 'Whether to check function declarations like `function a {}`',\n type: 'boolean',\n },\n FunctionExpression: {\n default: false,\n description: 'Whether to check function expressions like `const a = function {}`',\n type: 'boolean',\n },\n MethodDefinition: {\n default: false,\n description: 'Whether to check method definitions like `class A { someMethodDefinition () {} }`',\n type: 'boolean',\n },\n },\n type: 'object',\n },\n skipInterveningOverloadedDeclarations: {\n default: true,\n description: `If \\`true\\`, will skip above uncommented overloaded functions to check\nfor a comment block (e.g., at the top of a set of overloaded functions).\n\nIf \\`false\\`, will force each overloaded function to be checked for a\ncomment block.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n};\n\n/**\n * @param {string} interfaceName\n * @param {string} methodName\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}\n */\nconst getMethodOnInterface = (interfaceName, methodName, scope) => {\n let scp = scope;\n while (scp) {\n for (const {\n identifiers,\n name,\n } of scp.variables) {\n if (interfaceName !== name) {\n continue;\n }\n\n for (const identifier of identifiers) {\n const interfaceDeclaration = /** @type {import('@typescript-eslint/types').TSESTree.Identifier & {parent: import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration}} */ (\n identifier\n ).parent;\n /* c8 ignore next 3 -- TS */\n if (interfaceDeclaration.type !== 'TSInterfaceDeclaration') {\n continue;\n }\n\n for (const bodyItem of interfaceDeclaration.body.body) {\n const methodSig = /** @type {import('@typescript-eslint/types').TSESTree.TSMethodSignature} */ (\n bodyItem\n );\n if (methodName === /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n methodSig.key\n ).name) {\n return methodSig;\n }\n }\n }\n }\n\n scp = scp.upper;\n }\n\n return null;\n};\n\n/**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').SourceCode} sourceCode\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n */\nconst isExemptedImplementer = (node, sourceCode, context, settings) => {\n if (node.type === 'FunctionExpression' &&\n node.parent.type === 'MethodDefinition' &&\n node.parent.parent.type === 'ClassBody' &&\n node.parent.parent.parent.type === 'ClassDeclaration' &&\n 'implements' in node.parent.parent.parent\n ) {\n const implments = /** @type {import('@typescript-eslint/types').TSESTree.TSClassImplements[]} */ (\n node.parent.parent.parent.implements\n );\n\n const {\n name: methodName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n node.parent.key\n );\n\n for (const impl of implments) {\n const {\n name: interfaceName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n impl.expression\n );\n\n const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n ));\n if (interfaceMethodNode) {\n // @ts-expect-error Ok\n const comment = getJSDocComment(sourceCode, interfaceMethodNode, settings);\n if (comment) {\n return true;\n }\n }\n }\n }\n\n return false;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('json-schema').JSONSchema4Object} baseObject\n * @param {string} option\n * @param {string} key\n * @returns {boolean|undefined}\n */\nconst getOption = (context, baseObject, option, key) => {\n if (context.options[0] && option in context.options[0] &&\n // Todo: boolean shouldn't be returning property, but\n // tests currently require\n (typeof context.options[0][option] === 'boolean' ||\n key in context.options[0][option])\n ) {\n return context.options[0][option][key];\n }\n\n return /** @type {{[key: string]: {default?: boolean|undefined}}} */ (\n baseObject.properties\n )[key].default;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {{\n * contexts: (string|{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * })[],\n * enableFixer: boolean,\n * exemptEmptyConstructors: boolean,\n * exemptEmptyFunctions: boolean,\n * skipInterveningOverloadedDeclarations: boolean,\n * exemptOverloadedImplementations: boolean,\n * fixerMessage: string,\n * minLineCount: undefined|import('../iterateJsdoc.js').Integer,\n * publicOnly: boolean|{[key: string]: boolean|undefined}\n * require: {[key: string]: boolean|undefined}\n * }}\n */\nconst getOptions = (context, settings) => {\n const {\n contexts = settings.contexts || [],\n enableFixer = true,\n exemptEmptyConstructors = true,\n exemptEmptyFunctions = false,\n exemptOverloadedImplementations = false,\n fixerMessage = '',\n minLineCount = undefined,\n publicOnly,\n skipInterveningOverloadedDeclarations = true,\n } = context.options[0] || {};\n\n return {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n exemptOverloadedImplementations,\n fixerMessage,\n minLineCount,\n publicOnly: ((baseObj) => {\n if (!publicOnly) {\n return false;\n }\n\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */ (baseObj),\n 'publicOnly',\n prop,\n );\n\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n OPTIONS_SCHEMA.properties\n ).publicOnly\n ).oneOf\n )[1],\n ),\n require: ((baseObj) => {\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */\n (baseObj),\n 'require',\n prop,\n );\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (OPTIONS_SCHEMA.properties).require,\n ),\n skipInterveningOverloadedDeclarations,\n };\n};\n\n/**\n * @param {ESLintOrTSNode} node\n */\nconst isFunctionWithOverload = (node) => {\n if (node.type !== 'FunctionDeclaration') {\n return false;\n }\n\n let parent;\n let child;\n\n if (node.parent?.type === 'Program') {\n parent = node.parent;\n child = node;\n } else if (node.parent?.type === 'ExportNamedDeclaration' &&\n node.parent?.parent.type === 'Program') {\n parent = node.parent?.parent;\n child = node.parent;\n }\n\n if (!child || !parent) {\n return false;\n }\n\n const functionName = node.id.name;\n\n const idx = parent.body.indexOf(child);\n const prevSibling = parent.body[idx - 1];\n\n return (\n // @ts-expect-error Should be ok\n (prevSibling?.type === 'TSDeclareFunction' &&\n // @ts-expect-error Should be ok\n functionName === prevSibling.id.name) ||\n (prevSibling?.type === 'ExportNamedDeclaration' &&\n // @ts-expect-error Should be ok\n prevSibling.declaration?.type === 'TSDeclareFunction' &&\n // @ts-expect-error Should be ok\n prevSibling.declaration?.id?.name === functionName)\n );\n};\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const opts = getOptions(context, settings);\n\n const {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n exemptOverloadedImplementations,\n fixerMessage,\n minLineCount,\n require: requireOption,\n skipInterveningOverloadedDeclarations,\n } = opts;\n\n const publicOnly =\n\n /**\n * @type {{\n * [key: string]: boolean | undefined;\n * }}\n */ (\n opts.publicOnly\n );\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkJsDoc = (info, _handler, node) => {\n if (\n // Optimize\n minLineCount !== undefined || contexts.some((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n minLineCount: count,\n } = ctxt;\n return count !== undefined;\n })\n ) {\n /**\n * @param {undefined|import('../iterateJsdoc.js').Integer} count\n */\n const underMinLine = (count) => {\n return count !== undefined && count >\n (sourceCode.getText(node).match(/\\n/gv)?.length ?? 0) + 1;\n };\n\n if (underMinLine(minLineCount)) {\n return;\n }\n\n const {\n minLineCount: contextMinLineCount,\n } =\n /**\n * @type {{\n * context: string;\n * inlineCommentBlock: boolean;\n * minLineCount: number;\n * }}\n */ (contexts.find((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n context: ctx,\n } = ctxt;\n return ctx === (info.selector || node.type);\n })) || {};\n if (underMinLine(contextMinLineCount)) {\n return;\n }\n }\n\n if (exemptOverloadedImplementations && isFunctionWithOverload(node)) {\n return;\n }\n\n const jsDocNode = getJSDocComment(\n sourceCode, node, settings, {\n checkOverloads: skipInterveningOverloadedDeclarations,\n },\n );\n\n if (jsDocNode) {\n return;\n }\n\n // For those who have options configured against ANY constructors (or\n // setters or getters) being reported\n if (exemptSpeciaMethods(\n {\n description: '',\n inlineTags: [],\n problems: [],\n source: [],\n tags: [],\n },\n node,\n context,\n [\n OPTIONS_SCHEMA,\n ],\n )) {\n return;\n }\n\n if (\n // Avoid reporting param-less, return-less functions (when\n // `exemptEmptyFunctions` option is set)\n exemptEmptyFunctions && info.isFunctionContext ||\n\n // Avoid reporting param-less, return-less constructor methods (when\n // `exemptEmptyConstructors` option is set)\n exemptEmptyConstructors && isConstructor(node)\n ) {\n const functionParameterNames = getFunctionParameterNames(node);\n if (!functionParameterNames.length && !hasReturnValue(node)) {\n return;\n }\n }\n\n if (isExemptedImplementer(node, sourceCode, context, settings)) {\n return;\n }\n\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */\n let baseNode = getReducedASTNode(node, sourceCode);\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n // @ts-expect-error Bug?\n (baseNode),\n );\n if (decorator) {\n baseNode = decorator;\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }}\n */ (contexts.find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n })) || {};\n const insertion = (inlineCommentBlock ?\n `/** ${fixerMessage}` :\n `/**\\n${indent}*${fixerMessage}\\n${indent}`) +\n `*/${'\\n'.repeat(lines)}${indent.slice(0, -1)}`;\n\n return fixer.insertTextBefore(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n insertion,\n );\n };\n\n const report = () => {\n const {\n start,\n } = /** @type {import('eslint').AST.SourceLocation} */ (node.loc);\n const loc = {\n end: {\n column: 0,\n line: start.line + 1,\n },\n start,\n };\n context.report({\n fix: enableFixer ? fix : null,\n loc,\n messageId: 'missingJsDoc',\n node,\n });\n };\n\n if (publicOnly) {\n /** @type {RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n const exported = exportParser.isUncommentedExport(node, sourceCode, opt, settings);\n\n if (exported) {\n report();\n }\n } else {\n report();\n }\n };\n\n /**\n * @param {string} prop\n * @returns {boolean}\n */\n const hasOption = (prop) => {\n return requireOption[prop] || contexts.some((ctxt) => {\n return typeof ctxt === 'object' ? ctxt.context === prop : ctxt === prop;\n });\n };\n\n return {\n ...getContextObject(\n enforcedContexts(context, [], settings),\n checkJsDoc,\n ),\n ArrowFunctionExpression (node) {\n if (!hasOption('ArrowFunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n ClassDeclaration (node) {\n if (!hasOption('ClassDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n ClassExpression (node) {\n if (!hasOption('ClassExpression')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n FunctionDeclaration (node) {\n if (!hasOption('FunctionDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n },\n\n FunctionExpression (node) {\n if (!hasOption('FunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n MethodDefinition (node) {\n if (!hasOption('MethodDefinition')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n selector: 'MethodDefinition',\n }, null, /** @type {import('eslint').Rule.Node} */ (node.value));\n },\n };\n },\n meta: {\n docs: {\n category: 'Stylistic Issues',\n description: 'Checks for presence of JSDoc comments, on functions and potentially other contexts (optionally limited to exports).',\n recommended: true,\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n missingJsDoc: 'Missing JSDoc comment.',\n },\n\n schema: [\n OPTIONS_SCHEMA,\n ],\n\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,aAAA,GAAAH,OAAA;AAI8B,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;A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
|
1
|
+
{"version":3,"file":"requireJsdoc.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","_jsdocUtils","_jsdoccomment","e","__esModule","default","OPTIONS_SCHEMA","additionalProperties","description","properties","checkAllFunctionExpressions","type","checkConstructors","checkGetters","anyOf","enum","checkSetters","contexts","items","context","inlineCommentBlock","minLineCount","enableFixer","exemptEmptyConstructors","exemptEmptyFunctions","exemptOverloadedImplementations","fixerMessage","publicOnly","oneOf","ancestorsOnly","cjs","esm","window","ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","MethodDefinition","skipInterveningOverloadedDeclarations","getMethodOnInterface","interfaceName","methodName","scope","scp","identifiers","name","variables","identifier","interfaceDeclaration","parent","bodyItem","body","methodSig","key","upper","isExemptedImplementer","node","sourceCode","settings","implments","implements","impl","expression","interfaceMethodNode","getScope","comment","getJSDocComment","getOption","baseObject","option","options","getOptions","undefined","baseObj","prop","Object","keys","opt","isFunctionWithOverload","child","functionName","id","idx","indexOf","prevSibling","declaration","_default","exports","create","getSourceCode","getSettings","opts","requireOption","checkJsDoc","info","_handler","some","ctxt","count","underMinLine","getText","match","length","contextMinLineCount","find","ctx","selector","jsDocNode","checkOverloads","exemptSpeciaMethods","inlineTags","problems","source","tags","isFunctionContext","isConstructor","functionParameterNames","getFunctionParameterNames","hasReturnValue","fix","fixer","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","loc","start","column","contxt","insertion","repeat","slice","insertTextBefore","report","end","line","messageId","Boolean","initModuleExports","initWindow","exported","exportParser","isUncommentedExport","hasOption","getContextObject","enforcedContexts","includes","value","meta","docs","category","recommended","url","fixable","messages","missingJsDoc","schema","module"],"sources":["../../src/rules/requireJsdoc.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n exemptSpeciaMethods,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n hasReturnValue,\n isConstructor,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getJSDocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/**\n * @typedef {{\n * ancestorsOnly: boolean,\n * esm: boolean,\n * initModuleExports: boolean,\n * initWindow: boolean\n * }} RequireJsdocOpts\n */\n\n/**\n * @typedef {import('eslint').Rule.Node|\n * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode\n */\n\n/** @type {import('json-schema').JSONSchema4} */\nconst OPTIONS_SCHEMA = {\n additionalProperties: false,\n description: 'Has the following optional keys.\\n',\n properties: {\n checkAllFunctionExpressions: {\n default: false,\n description: `Normally, when \\`FunctionExpression\\` is checked, additional checks are\nadded to check the parent contexts where reporting is likely to be desired. If you really\nwant to check *all* function expressions, then set this to \\`true\\`.`,\n type: 'boolean',\n },\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked. Defaults to\n\\`true\\`. When \\`true\\`, \\`exemptEmptyConstructors\\` may still avoid reporting when\nno parameters or return values are found.`,\n type: 'boolean',\n },\n checkGetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-setter',\n ],\n type: 'string',\n },\n ],\n default: true,\n description: `A value indicating whether getters should be checked. Besides setting as a\nboolean, this option can be set to the string \\`\"no-setter\"\\` to indicate that\ngetters should be checked but only when there is no setter. This may be useful\nif one only wishes documentation on one of the two accessors. Defaults to\n\\`false\\`.`,\n },\n checkSetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-getter',\n ],\n type: 'string',\n },\n ],\n default: true,\n description: `A value indicating whether setters should be checked. Besides setting as a\nboolean, this option can be set to the string \\`\"no-getter\"\\` to indicate that\nsetters should be checked but only when there is no getter. This may be useful\nif one only wishes documentation on one of the two accessors. Defaults to\n\\`false\\`.`,\n },\n contexts: {\n description: `Set this to an array of strings or objects representing the additional AST\ncontexts where you wish the rule to be applied (e.g., \\`Property\\` for\nproperties). If specified as an object, it should have a \\`context\\` property\nand can have an \\`inlineCommentBlock\\` property which, if set to \\`true\\`, will\nadd an inline \\`/** */\\` instead of the regular, multi-line, indented jsdoc\nblock which will otherwise be added. Defaults to an empty array. Contexts\nmay also have their own \\`minLineCount\\` property which is an integer\nindicating a minimum number of lines expected for a node in order\nfor it to require documentation.\n\nNote that you may need to disable \\`require\\` items (e.g., \\`MethodDefinition\\`)\nif you are specifying a more precise form in \\`contexts\\` (e.g., \\`MethodDefinition:not([accessibility=\"private\"] > FunctionExpression\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n minLineCount: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n default: true,\n description: `A boolean on whether to enable the fixer (which adds an empty JSDoc block).\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n exemptEmptyConstructors: {\n default: false,\n description: `When \\`true\\`, the rule will not report missing JSDoc blocks above constructors\nwith no parameters or return values (this is enabled by default as the class\nname or description should be seen as sufficient to convey intent).\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n exemptEmptyFunctions: {\n default: false,\n description: `When \\`true\\`, the rule will not report missing JSDoc blocks above\nfunctions/methods with no parameters or return values (intended where\nfunction/method names are sufficient for themselves as documentation).\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n exemptOverloadedImplementations: {\n default: false,\n description: `If set to \\`true\\` will avoid checking an overloaded function's implementation.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n fixerMessage: {\n default: '',\n description: `An optional message to add to the inserted JSDoc block. Defaults to the\nempty string.`,\n type: 'string',\n },\n minLineCount: {\n description: `An integer to indicate a minimum number of lines expected for a node in order\nfor it to require documentation. Defaults to \\`undefined\\`. This option will\napply to any context; see \\`contexts\\` for line counts specific to a context.`,\n type: 'integer',\n },\n publicOnly: {\n description: `This option will insist that missing JSDoc blocks are only reported for\nfunction bodies / class declarations that are exported from the module.\nMay be a boolean or object. If set to \\`true\\`, the defaults below will be\nused. If unset, JSDoc block reporting will not be limited to exports.\n\nThis object supports the following optional boolean keys (\\`false\\` unless\notherwise noted):\n\n- \\`ancestorsOnly\\` - Optimization to only check node ancestors to check if node is exported\n- \\`esm\\` - ESM exports are checked for JSDoc comments (Defaults to \\`true\\`)\n- \\`cjs\\` - CommonJS exports are checked for JSDoc comments (Defaults to \\`true\\`)\n- \\`window\\` - Window global exports are checked for JSDoc comments`,\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n require: {\n additionalProperties: false,\n default: {},\n description: `An object with the following optional boolean keys which all default to\n\\`false\\` except for \\`FunctionDeclaration\\` which defaults to \\`true\\`.`,\n properties: {\n ArrowFunctionExpression: {\n default: false,\n description: 'Whether to check arrow functions like `() => {}`',\n type: 'boolean',\n },\n ClassDeclaration: {\n default: false,\n description: 'Whether to check declarations like `class A {}`',\n type: 'boolean',\n },\n ClassExpression: {\n default: false,\n description: 'Whether to check class expressions like `const myClass = class {}`',\n type: 'boolean',\n },\n FunctionDeclaration: {\n default: true,\n description: 'Whether to check function declarations like `function a {}`',\n type: 'boolean',\n },\n FunctionExpression: {\n default: false,\n description: 'Whether to check function expressions like `const a = function {}`',\n type: 'boolean',\n },\n MethodDefinition: {\n default: false,\n description: 'Whether to check method definitions like `class A { someMethodDefinition () {} }`',\n type: 'boolean',\n },\n },\n type: 'object',\n },\n skipInterveningOverloadedDeclarations: {\n default: true,\n description: `If \\`true\\`, will skip above uncommented overloaded functions to check\nfor a comment block (e.g., at the top of a set of overloaded functions).\n\nIf \\`false\\`, will force each overloaded function to be checked for a\ncomment block.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n};\n\n/**\n * @param {string} interfaceName\n * @param {string} methodName\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}\n */\nconst getMethodOnInterface = (interfaceName, methodName, scope) => {\n let scp = scope;\n while (scp) {\n for (const {\n identifiers,\n name,\n } of scp.variables) {\n if (interfaceName !== name) {\n continue;\n }\n\n for (const identifier of identifiers) {\n const interfaceDeclaration = /** @type {import('@typescript-eslint/types').TSESTree.Identifier & {parent: import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration}} */ (\n identifier\n ).parent;\n /* c8 ignore next 3 -- TS */\n if (interfaceDeclaration.type !== 'TSInterfaceDeclaration') {\n continue;\n }\n\n for (const bodyItem of interfaceDeclaration.body.body) {\n const methodSig = /** @type {import('@typescript-eslint/types').TSESTree.TSMethodSignature} */ (\n bodyItem\n );\n if (methodName === /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n methodSig.key\n ).name) {\n return methodSig;\n }\n }\n }\n }\n\n scp = scp.upper;\n }\n\n return null;\n};\n\n/**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').SourceCode} sourceCode\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n */\nconst isExemptedImplementer = (node, sourceCode, context, settings) => {\n if (node.type === 'FunctionExpression' &&\n node.parent.type === 'MethodDefinition' &&\n node.parent.parent.type === 'ClassBody' &&\n node.parent.parent.parent.type === 'ClassDeclaration' &&\n 'implements' in node.parent.parent.parent\n ) {\n const implments = /** @type {import('@typescript-eslint/types').TSESTree.TSClassImplements[]} */ (\n node.parent.parent.parent.implements\n );\n\n const {\n name: methodName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n node.parent.key\n );\n\n for (const impl of implments) {\n const {\n name: interfaceName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n impl.expression\n );\n\n const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n ));\n if (interfaceMethodNode) {\n // @ts-expect-error Ok\n const comment = getJSDocComment(sourceCode, interfaceMethodNode, settings);\n if (comment) {\n return true;\n }\n }\n }\n }\n\n return false;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('json-schema').JSONSchema4Object} baseObject\n * @param {string} option\n * @param {string} key\n * @returns {boolean|undefined}\n */\nconst getOption = (context, baseObject, option, key) => {\n if (context.options[0] && option in context.options[0] &&\n // Todo: boolean shouldn't be returning property, but\n // tests currently require\n (typeof context.options[0][option] === 'boolean' ||\n key in context.options[0][option])\n ) {\n return context.options[0][option][key];\n }\n\n return /** @type {{[key: string]: {default?: boolean|undefined}}} */ (\n baseObject.properties\n )[key].default;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {{\n * checkAllFunctionExpressions: boolean,\n * contexts: (string|{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * })[],\n * enableFixer: boolean,\n * exemptEmptyConstructors: boolean,\n * exemptEmptyFunctions: boolean,\n * skipInterveningOverloadedDeclarations: boolean,\n * exemptOverloadedImplementations: boolean,\n * fixerMessage: string,\n * minLineCount: undefined|import('../iterateJsdoc.js').Integer,\n * publicOnly: boolean|{[key: string]: boolean|undefined}\n * require: {[key: string]: boolean|undefined}\n * }}\n */\nconst getOptions = (context, settings) => {\n const {\n checkAllFunctionExpressions = false,\n contexts = settings.contexts || [],\n enableFixer = true,\n exemptEmptyConstructors = true,\n exemptEmptyFunctions = false,\n exemptOverloadedImplementations = false,\n fixerMessage = '',\n minLineCount = undefined,\n publicOnly,\n skipInterveningOverloadedDeclarations = true,\n } = context.options[0] || {};\n\n return {\n checkAllFunctionExpressions,\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n exemptOverloadedImplementations,\n fixerMessage,\n minLineCount,\n publicOnly: ((baseObj) => {\n if (!publicOnly) {\n return false;\n }\n\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */ (baseObj),\n 'publicOnly',\n prop,\n );\n\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n OPTIONS_SCHEMA.properties\n ).publicOnly\n ).oneOf\n )[1],\n ),\n require: ((baseObj) => {\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */\n (baseObj),\n 'require',\n prop,\n );\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (OPTIONS_SCHEMA.properties).require,\n ),\n skipInterveningOverloadedDeclarations,\n };\n};\n\n/**\n * @param {ESLintOrTSNode} node\n */\nconst isFunctionWithOverload = (node) => {\n if (node.type !== 'FunctionDeclaration') {\n return false;\n }\n\n let parent;\n let child;\n\n if (node.parent?.type === 'Program') {\n parent = node.parent;\n child = node;\n } else if (node.parent?.type === 'ExportNamedDeclaration' &&\n node.parent?.parent.type === 'Program') {\n parent = node.parent?.parent;\n child = node.parent;\n }\n\n if (!child || !parent) {\n return false;\n }\n\n const functionName = node.id?.name;\n\n const idx = parent.body.indexOf(child);\n const prevSibling = parent.body[idx - 1];\n\n return (\n // @ts-expect-error Should be ok\n (prevSibling?.type === 'TSDeclareFunction' &&\n // @ts-expect-error Should be ok\n functionName === prevSibling.id.name) ||\n (prevSibling?.type === 'ExportNamedDeclaration' &&\n // @ts-expect-error Should be ok\n prevSibling.declaration?.type === 'TSDeclareFunction' &&\n // @ts-expect-error Should be ok\n prevSibling.declaration?.id?.name === functionName)\n );\n};\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const opts = getOptions(context, settings);\n\n const {\n checkAllFunctionExpressions,\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n exemptOverloadedImplementations,\n fixerMessage,\n minLineCount,\n require: requireOption,\n skipInterveningOverloadedDeclarations,\n } = opts;\n\n const publicOnly =\n\n /**\n * @type {{\n * [key: string]: boolean | undefined;\n * }}\n */ (\n opts.publicOnly\n );\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkJsDoc = (info, _handler, node) => {\n if (\n // Optimize\n minLineCount !== undefined || contexts.some((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n minLineCount: count,\n } = ctxt;\n return count !== undefined;\n })\n ) {\n /**\n * @param {undefined|import('../iterateJsdoc.js').Integer} count\n */\n const underMinLine = (count) => {\n return count !== undefined && count >\n (sourceCode.getText(node).match(/\\n/gv)?.length ?? 0) + 1;\n };\n\n if (underMinLine(minLineCount)) {\n return;\n }\n\n const {\n minLineCount: contextMinLineCount,\n } =\n /**\n * @type {{\n * context: string;\n * inlineCommentBlock: boolean;\n * minLineCount: number;\n * }}\n */ (contexts.find((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n context: ctx,\n } = ctxt;\n return ctx === (info.selector || node.type);\n })) || {};\n if (underMinLine(contextMinLineCount)) {\n return;\n }\n }\n\n if (exemptOverloadedImplementations && isFunctionWithOverload(node)) {\n return;\n }\n\n const jsDocNode = getJSDocComment(\n sourceCode, node, settings, {\n checkOverloads: skipInterveningOverloadedDeclarations,\n },\n );\n\n if (jsDocNode) {\n return;\n }\n\n // For those who have options configured against ANY constructors (or\n // setters or getters) being reported\n if (exemptSpeciaMethods(\n {\n description: '',\n inlineTags: [],\n problems: [],\n source: [],\n tags: [],\n },\n node,\n context,\n [\n OPTIONS_SCHEMA,\n ],\n )) {\n return;\n }\n\n if (\n // Avoid reporting param-less, return-less functions (when\n // `exemptEmptyFunctions` option is set)\n exemptEmptyFunctions && info.isFunctionContext ||\n\n // Avoid reporting param-less, return-less constructor methods (when\n // `exemptEmptyConstructors` option is set)\n exemptEmptyConstructors && isConstructor(node)\n ) {\n const functionParameterNames = getFunctionParameterNames(node);\n if (!functionParameterNames.length && !hasReturnValue(node)) {\n return;\n }\n }\n\n if (isExemptedImplementer(node, sourceCode, context, settings)) {\n return;\n }\n\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */\n let baseNode = getReducedASTNode(node, sourceCode);\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = decorator;\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }}\n */ (contexts.find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n })) || {};\n const insertion = (inlineCommentBlock ?\n `/** ${fixerMessage}` :\n `/**\\n${indent}*${fixerMessage}\\n${indent}`) +\n `*/${'\\n'.repeat(lines)}${indent.slice(0, -1)}`;\n\n return fixer.insertTextBefore(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n insertion,\n );\n };\n\n const report = () => {\n const {\n start,\n } = /** @type {import('eslint').AST.SourceLocation} */ (node.loc);\n const loc = {\n end: {\n column: 0,\n line: start.line + 1,\n },\n start,\n };\n context.report({\n fix: enableFixer ? fix : null,\n loc,\n messageId: 'missingJsDoc',\n node,\n });\n };\n\n if (publicOnly) {\n /** @type {RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n const exported = exportParser.isUncommentedExport(node, sourceCode, opt, settings);\n\n if (exported) {\n report();\n }\n } else {\n report();\n }\n };\n\n /**\n * @param {string} prop\n * @returns {boolean}\n */\n const hasOption = (prop) => {\n return requireOption[prop] || contexts.some((ctxt) => {\n return typeof ctxt === 'object' ? ctxt.context === prop : ctxt === prop;\n });\n };\n\n return {\n ...getContextObject(\n enforcedContexts(context, [], settings),\n checkJsDoc,\n ),\n ArrowFunctionExpression (node) {\n if (!hasOption('ArrowFunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n ClassDeclaration (node) {\n if (!hasOption('ClassDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n ClassExpression (node) {\n if (!hasOption('ClassExpression')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n FunctionDeclaration (node) {\n if (!hasOption('FunctionDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n },\n\n FunctionExpression (node) {\n if (!hasOption('FunctionExpression')) {\n return;\n }\n\n if (checkAllFunctionExpressions ||\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n MethodDefinition (node) {\n if (!hasOption('MethodDefinition')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n selector: 'MethodDefinition',\n }, null, /** @type {import('eslint').Rule.Node} */ (node.value));\n },\n };\n },\n meta: {\n docs: {\n category: 'Stylistic Issues',\n description: 'Checks for presence of JSDoc comments, on functions and potentially other contexts (optionally limited to exports).',\n recommended: true,\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n missingJsDoc: 'Missing JSDoc comment.',\n },\n\n schema: [\n OPTIONS_SCHEMA,\n ],\n\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OA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