UNPKG

eslint-plugin-jsdoc

Version:
1 lines 29.9 kB
{"version":3,"file":"checkParamNames.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","validateParameterNames","targetTagName","allowExtraTrailingParamDocs","checkDestructured","checkRestProperty","checkTypesRegex","disableExtraPropertyReporting","disableMissingParamChecks","enableFixer","functionParameterNames","jsdoc","utils","report","paramTags","Object","entries","tags","filter","tag","paramTagsNonNested","name","includes","dotted","thisOffset","some","index","tagsIndex","dupeTagInfo","find","tgsIndex","tg","idx","Number","reportJSDoc","removeTag","functionParameterName","trim","Array","isArray","actualName","expectedName","type","search","parameterName","annotationParamName","hasPropertyRest","names","properties","rests","undefined","tagName","expectedNames","map","actualNames","paramTag","actualTypes","missingProperties","notCheckingNames","notCheckingName","startsWith","actualNameIdx","findIndex","comparePaths","missingIndex","pathDoesNotBeginWith","line","source","number","length","push","tagPlacement","hasMissing","missingProperty","extraProperties","match","prop","split","extraProperty","funcParamName","item","usedExpectedNames","a","toString","usedInOrder","every","restElement","join","validateParameterNamesDeep","_allowExtraTrailingParamDocs","jsdocParameterNames","lastRealParameter","jsdocParameterName","isPropertyPath","pathRootNodeName","slice","indexOf","endsWith","allowedNodes","_default","exports","iterateJsdoc","context","node","checkTypesPattern","useDefaultObjectProperties","options","getRegexFromString","jsdocParameterNamesDeep","getJsdocTagsDeep","getFunctionParameterNames","getPreferredTagName","isError","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","module"],"sources":["../../src/rules/checkParamNames.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} targetTagName\n * @param {boolean} allowExtraTrailingParamDocs\n * @param {boolean} checkDestructured\n * @param {boolean} checkRestProperty\n * @param {RegExp} checkTypesRegex\n * @param {boolean} disableExtraPropertyReporting\n * @param {boolean} disableMissingParamChecks\n * @param {boolean} enableFixer\n * @param {import('../jsdocUtils.js').ParamNameInfo[]} functionParameterNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @returns {boolean}\n */\nconst validateParameterNames = (\n targetTagName,\n allowExtraTrailingParamDocs,\n checkDestructured,\n checkRestProperty,\n checkTypesRegex,\n disableExtraPropertyReporting,\n disableMissingParamChecks,\n enableFixer,\n functionParameterNames, jsdoc, utils, report,\n) => {\n const paramTags = Object.entries(jsdoc.tags).filter(([\n , tag,\n ]) => {\n return tag.tag === targetTagName;\n });\n const paramTagsNonNested = paramTags.filter(([\n , tag,\n ]) => {\n return !tag.name.includes('.');\n });\n\n let dotted = 0;\n let thisOffset = 0;\n\n return paramTags.some(([\n , tag,\n // eslint-disable-next-line complexity\n ], index) => {\n /** @type {import('../iterateJsdoc.js').Integer} */\n let tagsIndex;\n const dupeTagInfo = paramTags.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 if (tag.name.includes('.')) {\n dotted++;\n\n return false;\n }\n\n let functionParameterName = functionParameterNames[index - dotted + thisOffset];\n if (functionParameterName === 'this' && tag.name.trim() !== 'this') {\n ++thisOffset;\n functionParameterName = functionParameterNames[index - dotted + thisOffset];\n }\n\n if (!functionParameterName) {\n if (allowExtraTrailingParamDocs) {\n return false;\n }\n\n report(\n `@${targetTagName} \"${tag.name}\" does not match an existing function parameter.`,\n null,\n tag,\n );\n\n return true;\n }\n\n if (\n typeof functionParameterName === 'object' &&\n 'name' in functionParameterName &&\n Array.isArray(functionParameterName.name)\n ) {\n const actualName = tag.name.trim();\n const expectedName = functionParameterName.name[index];\n if (actualName === expectedName) {\n thisOffset--;\n return false;\n }\n\n report(\n `Expected @${targetTagName} name to be \"${expectedName}\". Got \"${actualName}\".`,\n null,\n tag,\n );\n return true;\n }\n\n if (Array.isArray(functionParameterName)) {\n if (!checkDestructured) {\n return false;\n }\n\n if (tag.type && tag.type.search(checkTypesRegex) === -1) {\n return false;\n }\n\n const [\n parameterName,\n {\n annotationParamName,\n hasPropertyRest,\n names: properties,\n rests,\n },\n ] =\n /**\n * @type {[string | undefined, import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n }]} */ (functionParameterName);\n if (annotationParamName !== undefined) {\n const name = tag.name.trim();\n if (name !== annotationParamName) {\n report(`@${targetTagName} \"${name}\" does not match parameter name \"${annotationParamName}\"`, null, tag);\n }\n }\n\n const tagName = parameterName === undefined ? tag.name.trim() : parameterName;\n const expectedNames = properties.map((name) => {\n return `${tagName}.${name}`;\n });\n const actualNames = paramTags.map(([\n , paramTag,\n ]) => {\n return paramTag.name.trim();\n });\n const actualTypes = paramTags.map(([\n , paramTag,\n ]) => {\n return paramTag.type;\n });\n\n const missingProperties = [];\n\n /** @type {string[]} */\n const notCheckingNames = [];\n\n for (const [\n idx,\n name,\n ] of expectedNames.entries()) {\n if (notCheckingNames.some((notCheckingName) => {\n return name.startsWith(notCheckingName);\n })) {\n continue;\n }\n\n const actualNameIdx = actualNames.findIndex((actualName) => {\n return utils.comparePaths(name)(actualName);\n });\n if (actualNameIdx === -1) {\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const missingIndex = actualNames.findIndex((actualName) => {\n return utils.pathDoesNotBeginWith(name, actualName);\n });\n const line = tag.source[0].number - 1 + (missingIndex > -1 ? missingIndex : actualNames.length);\n missingProperties.push({\n name,\n tagPlacement: {\n line: line === 0 ? 1 : line,\n },\n });\n } else if (actualTypes[actualNameIdx].search(checkTypesRegex) === -1 && actualTypes[actualNameIdx] !== '') {\n notCheckingNames.push(name);\n }\n }\n\n const hasMissing = missingProperties.length;\n if (hasMissing) {\n for (const {\n name: missingProperty,\n tagPlacement,\n } of missingProperties) {\n report(`Missing @${targetTagName} \"${missingProperty}\"`, null, tagPlacement);\n }\n }\n\n if (!hasPropertyRest || checkRestProperty) {\n /** @type {[string, import('comment-parser').Spec][]} */\n const extraProperties = [];\n for (const [\n idx,\n name,\n ] of actualNames.entries()) {\n const match = name.startsWith(tag.name.trim() + '.');\n if (\n match && !expectedNames.some(\n utils.comparePaths(name),\n ) && !utils.comparePaths(name)(tag.name) &&\n (!disableExtraPropertyReporting || properties.some((prop) => {\n return prop.split('.').length >= name.split('.').length - 1;\n }))\n ) {\n extraProperties.push([\n name, paramTags[idx][1],\n ]);\n }\n }\n\n if (extraProperties.length) {\n for (const [\n extraProperty,\n tg,\n ] of extraProperties) {\n report(`@${targetTagName} \"${extraProperty}\" does not exist on ${tag.name}`, null, tg);\n }\n\n return true;\n }\n }\n\n return hasMissing;\n }\n\n let funcParamName;\n if (typeof functionParameterName === 'object') {\n const {\n name,\n } = functionParameterName;\n funcParamName = name;\n } else {\n funcParamName = functionParameterName;\n }\n\n if (funcParamName !== tag.name.trim()) {\n // Todo: Improve for array or object child items\n const actualNames = paramTagsNonNested.map(([\n , {\n name,\n },\n ]) => {\n return name.trim();\n });\n\n const expectedNames = functionParameterNames.map((item, idx) => {\n if (/**\n * @type {[string|undefined, (import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string,\n })]} */ (item)?.[1]?.names) {\n return actualNames[idx];\n }\n\n return item;\n }).filter((item) => {\n return item !== 'this';\n });\n\n // When disableMissingParamChecks is true tag names can be omitted.\n // Report when the tag names do not match the expected names or they are used out of order.\n if (disableMissingParamChecks) {\n const usedExpectedNames = expectedNames.map((a) => {\n return a?.toString();\n }).filter((expectedName) => {\n return expectedName && actualNames.includes(expectedName);\n });\n const usedInOrder = actualNames.every((actualName, idx) => {\n return actualName === usedExpectedNames[idx];\n });\n if (usedInOrder) {\n return false;\n }\n }\n\n report(\n `Expected @${targetTagName} names to be \"${\n expectedNames.map((expectedName) => {\n return typeof expectedName === 'object' &&\n 'name' in expectedName &&\n expectedName.restElement ?\n '...' + expectedName.name :\n expectedName;\n }).join(', ')\n }\". Got \"${actualNames.join(', ')}\".`,\n null,\n tag,\n );\n\n return true;\n }\n\n return false;\n });\n};\n\n/**\n * @param {string} targetTagName\n * @param {boolean} _allowExtraTrailingParamDocs\n * @param {{\n * name: string,\n * idx: import('../iterateJsdoc.js').Integer\n * }[]} jsdocParameterNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Report} report\n * @returns {boolean}\n */\nconst validateParameterNamesDeep = (\n targetTagName, _allowExtraTrailingParamDocs,\n jsdocParameterNames, jsdoc, report,\n) => {\n /** @type {string} */\n let lastRealParameter;\n\n return jsdocParameterNames.some(({\n idx,\n name: jsdocParameterName,\n }) => {\n const isPropertyPath = jsdocParameterName.includes('.');\n\n if (isPropertyPath) {\n if (!lastRealParameter) {\n report(`@${targetTagName} path declaration (\"${jsdocParameterName}\") appears before any real parameter.`, null, jsdoc.tags[idx]);\n\n return true;\n }\n\n let pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));\n\n if (pathRootNodeName.endsWith('[]')) {\n pathRootNodeName = pathRootNodeName.slice(0, -2);\n }\n\n if (pathRootNodeName !== lastRealParameter) {\n report(\n `@${targetTagName} path declaration (\"${jsdocParameterName}\") root node name (\"${pathRootNodeName}\") ` +\n `does not match previous real parameter name (\"${lastRealParameter}\").`,\n null,\n jsdoc.tags[idx],\n );\n\n return true;\n }\n } else {\n lastRealParameter = jsdocParameterName;\n }\n\n return false;\n });\n};\n\nconst allowedNodes = [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature',\n];\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const {\n allowExtraTrailingParamDocs,\n checkDestructured = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n disableExtraPropertyReporting = false,\n disableMissingParamChecks = false,\n enableFixer = false,\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n // Although we might just remove global settings contexts from applying to\n // this rule (as they can cause problems with `getFunctionParameterNames`\n // checks if they are not functions but say variables), the user may\n // instead wish to narrow contexts in those settings, so this check\n // is still useful\n if (!allowedNodes.includes(/** @type {import('estree').Node} */ (node).type)) {\n return;\n }\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n const jsdocParameterNamesDeep = utils.getJsdocTagsDeep('param');\n if (!jsdocParameterNamesDeep || !jsdocParameterNamesDeep.length) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);\n\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n const isError = validateParameterNames(\n targetTagName,\n allowExtraTrailingParamDocs,\n checkDestructured,\n checkRestProperty,\n checkTypesRegex,\n disableExtraPropertyReporting,\n disableMissingParamChecks,\n enableFixer,\n functionParameterNames,\n jsdoc,\n utils,\n report,\n );\n\n if (isError || !checkDestructured) {\n return;\n }\n\n validateParameterNamesDeep(\n targetTagName, allowExtraTrailingParamDocs, jsdocParameterNamesDeep, jsdoc, report,\n );\n}, {\n contextDefaults: allowedNodes,\n meta: {\n docs: {\n description: 'Checks for dupe `@param` names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-param-names.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowExtraTrailingParamDocs: {\n description: `If set to \\`true\\`, this option will allow extra \\`@param\\` definitions (e.g.,\nrepresenting future expected or virtual params) to be present without needing\ntheir presence within the function signature. Other inconsistencies between\n\\`@param\\`'s and present function parameters will still be reported.`,\n type: 'boolean',\n },\n checkDestructured: {\n description: 'Whether to check destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkRestProperty: {\n description: `If set to \\`true\\`, will require that rest properties are documented and\nthat any extraneous properties (which may have been within the rest property)\nare documented. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `Defines a regular expression pattern to indicate which types should be\nchecked for destructured content (and that those not matched should not\nbe checked).\n\nWhen one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n disableExtraPropertyReporting: {\n description: `Whether to check for extra destructured properties. Defaults to \\`false\\`. Change\nto \\`true\\` if you want to be able to document properties which are not actually\ndestructured. Keep as \\`false\\` if you expect properties to be documented in\ntheir own types. Note that extra properties will always be reported if another\nitem at the same level is destructured as destructuring will prevent other\naccess and this option is only intended to permit documenting extra properties\nthat are available and actually used in the function.`,\n type: 'boolean',\n },\n disableMissingParamChecks: {\n description: 'Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.',\n type: 'boolean',\n },\n enableFixer: {\n description: `Set to \\`true\\` to auto-remove \\`@param\\` duplicates (based on identical\nnames).\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 param will\nbe removed even if it has a different type or description).`,\n type: 'boolean',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to avoid reporting of child property documentation\nwhere instead of destructuring, a whole plain object is supplied as default\nvalue but you wish its keys to be considered as signalling that the properties\nare present and can therefore be documented. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,sBAAsB,GAAGA,CAC7BC,aAAa,EACbC,2BAA2B,EAC3BC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,6BAA6B,EAC7BC,yBAAyB,EACzBC,WAAW,EACXC,sBAAsB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,KACzC;EACH,MAAMC,SAAS,GAAGC,MAAM,CAACC,OAAO,CAACL,KAAK,CAACM,IAAI,CAAC,CAACC,MAAM,CAAC,CAAC,GACjDC,GAAG,CACN,KAAK;IACJ,OAAOA,GAAG,CAACA,GAAG,KAAKjB,aAAa;EAClC,CAAC,CAAC;EACF,MAAMkB,kBAAkB,GAAGN,SAAS,CAACI,MAAM,CAAC,CAAC,GACzCC,GAAG,CACN,KAAK;IACJ,OAAO,CAACA,GAAG,CAACE,IAAI,CAACC,QAAQ,CAAC,GAAG,CAAC;EAChC,CAAC,CAAC;EAEF,IAAIC,MAAM,GAAG,CAAC;EACd,IAAIC,UAAU,GAAG,CAAC;EAElB,OAAOV,SAAS,CAACW,IAAI,CAAC,CAAC,GACnBN;EACJ;EAAA,CACC,EAAEO,KAA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