1 |
- {"version":3,"sources":["../src/jsdocUtils.js"],"names":["tagStructure","setTagStructure","mode","flattenRoots","params","root","hasRestElement","hasPropertyRest","rests","names","reduce","acc","cur","Array","isArray","nms","flattened","inner","filter","Boolean","push","concat","isRestProperty","restElement","name","getPropertiesFromPropertySignature","propSignature","type","undefined","typeAnnotation","key","members","map","member","getFunctionParameterNames","functionNode","checkDefaultObjects","getParamName","param","isProperty","_","has","left","propertyNames","annotationParamName","properties","roots","prop","value","elements","idx","right","raw","includes","argument","parameter","Error","hasParams","length","getJsdocTagsDeep","jsdoc","targetTagName","ret","tags","forEach","tag","modeWarnSettings","getTagNamesForMode","context","jsdocTags","typeScriptTags","closureTags","hasBeenWarned","report","loc","start","column","line","message","markSettingAsWarned","getPreferredTagName","tagPreference","prefValues","Object","values","some","prefVal","replacement","tagPreferenceFixed","mapKeys","_value","replace","tagNames","preferredTagName","entries","find","aliases","isValidTag","definedTags","validTagNames","keys","flat","additionalTags","allTags","hasTag","targetTagLower","toLowerCase","doc","hasATag","targetTagNames","hasDefinedTypeTag","tagType","trim","ensureMap","set","Map","get","overrideTagStructure","structuredTags","tagMap","required","tagStruct","requiredName","requiredType","typeOrNameRequired","getTagStructureForMode","isNamepathDefiningTag","tagMustHaveTypePosition","tagMightHaveTypePosition","namepathTypes","Set","tagMightHaveNamePosition","tagMightHaveNamepath","tagMustHaveNamePosition","tagMightHaveEitherTypeOrNamePosition","tagMustHaveEitherTypeOrNamePosition","tagMissingRequiredTypeOrNamepath","mustHaveTypePosition","mightHaveTypePosition","hasTypePosition","hasNameOrNamepathPosition","mustHaveEither","hasEither","isNewPromiseExpression","node","callee","hasReturnValue","promFilter","returnType","expression","body","bodyNode","consequent","alternate","block","handler","finalizer","cases","someCase","nde","hasNonEmptyResolverCall","resolverName","arguments","test","element","expressions","subExpression","property","decorators","decorator","computed","declarations","id","init","quasi","object","source","hasValueOrExecutorHasNonEmptyResolveValue","anyPromiseAsReturn","prom","hasNonFunctionYield","checkYieldReturnValue","parent","hasYieldValue","generator","hasThrowValue","innerFunction","async","parseClosureTemplateTag","split","enforcedContexts","defaultContexts","contexts","options","getContextObject","checkJsdoc","selInfo","lastIndex","selector","comment","bind","filterTags","tagsWithNamesAndDescriptions","getTagsByType","descName","tagsWithoutNames","tagsWithNames","tagName","tagWithName","getIndent","sourceCode","text","match","isConstructor","kind","isGetter","isSetter","hasAccessorPair","sourceKind","sourceName","oppositeKind","children","exemptSpeciaMethods","schema","hasSchemaOption","schemaProperties","default","checkGetters","checkSetters","dropPathSegmentQuotes","str","comparePaths","otherPathName","pathDoesNotBeginWith","startsWith","getRegexFromString","regexString","requiredFlags","flags","regex","uniqueFlags","join","RegExp"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAMA,IAAIA,YAAJ;;AAEA,MAAMC,eAAe,GAAIC,IAAD,IAAU;AAChCF,EAAAA,YAAY,GAAG,4CAA8BE,IAA9B,CAAf;AACD,CAFD,C,CAIA;AACA;;;AACA,MAAMC,YAAY,GAAG,CAACC,MAAD,EAASC,IAAI,GAAG,EAAhB,KAAuB;AAC1C,MAAIC,cAAc,GAAG,KAArB;AACA,MAAIC,eAAe,GAAG,KAAtB;AACA,QAAMC,KAAK,GAAG,EAAd;AAEA,QAAMC,KAAK,GAAGL,MAAM,CAACM,MAAP,CAAc,CAACC,GAAD,EAAMC,GAAN,KAAc;AACxC,QAAIC,KAAK,CAACC,OAAN,CAAcF,GAAd,CAAJ,EAAwB;AACtB,UAAIG,GAAJ;;AACA,UAAIF,KAAK,CAACC,OAAN,CAAcF,GAAG,CAAC,CAAD,CAAjB,CAAJ,EAA2B;AACzBG,QAAAA,GAAG,GAAGH,GAAG,CAAC,CAAD,CAAT;AACD,OAFD,MAEO;AACL,YAAIA,GAAG,CAAC,CAAD,CAAH,CAAON,cAAX,EAA2B;AACzBA,UAAAA,cAAc,GAAG,IAAjB;AACD;;AACD,YAAIM,GAAG,CAAC,CAAD,CAAH,CAAOL,eAAX,EAA4B;AAC1BA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AME,WAAW,GAAG,CAAC,GAAG,IAAI9G,GAAJ,CAAQ4G,KAAK,IAAID,aAAa,IAAI,EAArB,CAAb,CAAJ,CAApB;AACAC,EAAAA,KAAK,GAAGE,WAAW,CAACC,IAAZ,CAAiB,EAAjB,CAAR;AAEA,SAAO,IAAIC,MAAJ,CAAWH,KAAX,EAAkBD,KAAlB,CAAP;AACD,CAfD;;eAiBe;AACbP,EAAAA,YADa;AAEbF,EAAAA,qBAFa;AAGbvC,EAAAA,gBAHa;AAIbgC,EAAAA,mBAJa;AAKbrB,EAAAA,UALa;AAMbtM,EAAAA,YANa;AAOb+L,EAAAA,gBAPa;AAQbhK,EAAAA,yBARa;AASb+K,EAAAA,SATa;AAUbtJ,EAAAA,gBAVa;AAWbqB,EAAAA,mBAXa;AAYb2J,EAAAA,kBAZa;AAabhC,EAAAA,aAba;AAcb9E,EAAAA,sBAda;AAebjB,EAAAA,OAfa;AAgBbE,EAAAA,iBAhBa;AAiBbrD,EAAAA,SAjBa;AAkBbyF,EAAAA,cAlBa;AAmBb1C,EAAAA,MAnBa;AAoBbiF,EAAAA,aApBa;AAqBbR,EAAAA,yCArBa;AAsBbM,EAAAA,aAtBa;AAuBb8B,EAAAA,aAvBa;AAwBbE,EAAAA,QAxBa;AAyBbzF,EAAAA,qBAzBa;AA0Bb0F,EAAAA,QA1Ba;AA2BbvH,EAAAA,UA3Ba;AA4BboB,EAAAA,oBA5Ba;AA6BbuE,EAAAA,uBA7Ba;AA8Bb6C,EAAAA,oBA9Ba;AA+BbxO,EAAAA,eA/Ba;AAgCbmI,EAAAA,oBAhCa;AAiCbD,EAAAA,wBAjCa;AAkCbH,EAAAA,wBAlCa;AAmCbQ,EAAAA,gCAnCa;AAoCbH,EAAAA,uBApCa;AAqCbN,EAAAA;AArCa,C","sourcesContent":["import _ from 'lodash';\nimport WarnSettings from './WarnSettings';\nimport getDefaultTagStructureForMode from './getDefaultTagStructureForMode';\nimport {\n jsdocTags, closureTags, typeScriptTags,\n} from './tagNames';\n\ntype ParserMode = \"jsdoc\"|\"typescript\"|\"closure\";\n\nlet tagStructure;\n\nconst setTagStructure = (mode) => {\n tagStructure = getDefaultTagStructureForMode(mode);\n};\n\n// Given a nested array of property names, reduce them to a single array,\n// appending the name of the root element along the way if present.\nconst flattenRoots = (params, root = '') => {\n let hasRestElement = false;\n let hasPropertyRest = false;\n const rests = [];\n\n const names = params.reduce((acc, cur) => {\n if (Array.isArray(cur)) {\n let nms;\n if (Array.isArray(cur[1])) {\n nms = cur[1];\n } else {\n if (cur[1].hasRestElement) {\n hasRestElement = true;\n }\n if (cur[1].hasPropertyRest) {\n hasPropertyRest = true;\n }\n nms = cur[1].names;\n }\n\n const flattened = flattenRoots(nms, root ? `${root}.${cur[0]}` : cur[0]);\n if (flattened.hasRestElement) {\n hasRestElement = true;\n }\n if (flattened.hasPropertyRest) {\n hasPropertyRest = true;\n }\n const inner = [\n root ? `${root}.${cur[0]}` : cur[0],\n ...flattened.names,\n ].filter(Boolean);\n rests.push(false, ...flattened.rests);\n\n return acc.concat(inner);\n }\n if (typeof cur === 'object') {\n if (cur.isRestProperty) {\n hasPropertyRest = true;\n rests.push(true);\n } else {\n rests.push(false);\n }\n if (cur.restElement) {\n hasRestElement = true;\n }\n acc.push(root ? `${root}.${cur.name}` : cur.name);\n } else if (typeof cur !== 'undefined') {\n rests.push(false);\n acc.push(root ? `${root}.${cur}` : cur);\n }\n\n return acc;\n }, []);\n\n return {\n hasPropertyRest,\n hasRestElement,\n names,\n rests,\n };\n};\n\ntype T = string | [?string, T];\nconst getPropertiesFromPropertySignature = (propSignature): T => {\n if (\n propSignature.type === 'TSIndexSignature' ||\n propSignature.type === 'TSConstructSignatureDeclaration' ||\n propSignature.type === 'TSCallSignatureDeclaration'\n ) {\n return undefined;\n }\n if (propSignature.typeAnnotation && propSignature.typeAnnotation.typeAnnotation.type === 'TSTypeLiteral') {\n return [propSignature.key.name, propSignature.typeAnnotation.typeAnnotation.members.map((member) => {\n return getPropertiesFromPropertySignature(member);\n })];\n }\n\n return propSignature.key.name;\n};\n\nconst getFunctionParameterNames = (\n functionNode : Object, checkDefaultObjects: Boolean,\n) : Array<T> => {\n // eslint-disable-next-line complexity\n const getParamName = (param, isProperty) => {\n if (_.has(param, 'typeAnnotation') || _.has(param, 'left.typeAnnotation')) {\n const typeAnnotation = _.has(param, 'left.typeAnnotation') ? param.left.typeAnnotation : param.typeAnnotation;\n if (typeAnnotation.typeAnnotation.type === 'TSTypeLiteral') {\n const propertyNames = typeAnnotation.typeAnnotation.members.map((member) => {\n return getPropertiesFromPropertySignature(member);\n });\n const flattened = {\n ...flattenRoots(propertyNames),\n annotationParamName: param.name,\n };\n if (_.has(param, 'name') || _.has(param, 'left.name')) {\n return [_.has(param, 'left.name') ? param.left.name : param.name, flattened];\n }\n\n return [undefined, flattened];\n }\n }\n\n if (_.has(param, 'name')) {\n return param.name;\n }\n\n if (_.has(param, 'left.name')) {\n return param.left.name;\n }\n\n if (param.type === 'ObjectPattern' || param.left?.type === 'ObjectPattern') {\n const properties = param.properties || param.left?.properties;\n const roots = properties.map((prop) => {\n return getParamName(prop, true);\n });\n\n return [undefined, flattenRoots(roots)];\n }\n\n if (param.type === 'Property') {\n switch (param.value.type) {\n case 'ArrayPattern':\n return [param.key.name, param.value.elements.map((prop, idx) => {\n return {\n name: idx,\n restElement: prop.type === 'RestElement',\n };\n })];\n case 'ObjectPattern':\n return [param.key.name, param.value.properties.map((prop) => {\n return getParamName(prop, isProperty);\n })];\n case 'AssignmentPattern': {\n switch (param.value.left.type) {\n case 'Identifier':\n // Default parameter\n if (checkDefaultObjects && param.value.right.type === 'ObjectExpression') {\n return [param.key.name, param.value.right.properties.map((prop) => {\n return getParamName(prop, isProperty);\n })];\n }\n break;\n case 'ObjectPattern':\n return [param.key.name, param.value.left.properties.map((prop) => {\n return getParamName(prop, isProperty);\n })];\n case 'ArrayPattern':\n return [param.key.name, param.value.left.elements.map((prop, idx) => {\n return {\n name: idx,\n restElement: prop.type === 'RestElement',\n };\n })];\n }\n }\n }\n\n switch (param.key.type) {\n case 'Identifier':\n return param.key.name;\n\n // The key of an object could also be a string or number\n case 'Literal':\n return param.key.raw ||\n // istanbul ignore next -- `raw` may not be present in all parsers\n param.key.value;\n\n // case 'MemberExpression':\n default:\n // Todo: We should really create a structure (and a corresponding\n // option analogous to `checkRestProperty`) which allows for\n // (and optionally requires) dynamic properties to have a single\n // line of documentation\n return undefined;\n }\n }\n\n if (param.type === 'ArrayPattern' || param.left?.type === 'ArrayPattern') {\n const elements = param.elements || param.left?.elements;\n const roots = elements.map((prop, idx) => {\n return {\n name: `\"${idx}\"`,\n restElement: prop?.type === 'RestElement',\n };\n });\n\n return [undefined, flattenRoots(roots)];\n }\n\n if (['RestElement', 'ExperimentalRestProperty'].includes(param.type)) {\n return {\n isRestProperty: isProperty,\n name: param.argument.name,\n restElement: true,\n };\n }\n\n if (param.type === 'TSParameterProperty') {\n return getParamName(param.parameter, true);\n }\n\n throw new Error(`Unsupported function signature format: \\`${param.type}\\`.`);\n };\n\n return (functionNode.params || functionNode.value.params).map((param) => {\n return getParamName(param);\n });\n};\n\nconst hasParams = (functionNode) => {\n // Should also check `functionNode.value.params` if supporting `MethodDefinition`\n return functionNode.params.length;\n};\n\n/**\n * Gets all names of the target type, including those that refer to a path, e.g.\n * \"@param foo; @param foo.bar\".\n */\nconst getJsdocTagsDeep = (jsdoc : Object, targetTagName : string) : Array<Object> => {\n const ret = [];\n jsdoc.tags.forEach(({name, tag, type}, idx) => {\n if (tag !== targetTagName) {\n return;\n }\n ret.push({\n idx,\n name,\n type,\n });\n });\n\n return ret;\n};\n\nconst modeWarnSettings = WarnSettings();\n\nconst getTagNamesForMode = (mode, context) => {\n switch (mode) {\n case 'jsdoc':\n return jsdocTags;\n case 'typescript':\n return typeScriptTags;\n case 'closure': case 'permissive':\n return closureTags;\n default:\n if (!modeWarnSettings.hasBeenWarned(context, 'mode')) {\n context.report({\n loc: {\n start: {\n column: 1,\n line: 1,\n },\n },\n message: `Unrecognized value \\`${mode}\\` for \\`settings.jsdoc.mode\\`.`,\n });\n modeWarnSettings.markSettingAsWarned(context, 'mode');\n }\n\n // We'll avoid breaking too many other rules\n return jsdocTags;\n }\n};\n\nconst getPreferredTagName = (\n context,\n mode : ParserMode,\n name : string,\n tagPreference : Object = {},\n) : string|Object => {\n const prefValues = Object.values(tagPreference);\n if (prefValues.includes(name) || prefValues.some((prefVal) => {\n return prefVal && typeof prefVal === 'object' && prefVal.replacement === name;\n })) {\n return name;\n }\n\n // Allow keys to have a 'tag ' prefix to avoid upstream bug in ESLint\n // that disallows keys that conflict with Object.prototype,\n // e.g. 'tag constructor' for 'constructor':\n // https://github.com/eslint/eslint/issues/13289\n // https://github.com/gajus/eslint-plugin-jsdoc/issues/537\n const tagPreferenceFixed = _.mapKeys(tagPreference, (_value, key) => {\n return key.replace('tag ', '');\n });\n\n if (_.has(tagPreferenceFixed, name)) {\n return tagPreferenceFixed[name];\n }\n\n const tagNames = getTagNamesForMode(mode, context);\n\n const preferredTagName = Object.entries(tagNames).find(([, aliases]) => {\n return aliases.includes(name);\n })?.[0];\n if (preferredTagName) {\n return preferredTagName;\n }\n\n return name;\n};\n\nconst isValidTag = (\n context,\n mode : ParserMode,\n name : string,\n definedTags : Array,\n) : boolean => {\n const tagNames = getTagNamesForMode(mode, context);\n\n const validTagNames = Object.keys(tagNames).concat(Object.values(tagNames).flat());\n const additionalTags = definedTags;\n const allTags = validTagNames.concat(additionalTags);\n\n return allTags.includes(name);\n};\n\nconst hasTag = (jsdoc : Object, targetTagName : string) : boolean => {\n const targetTagLower = targetTagName.toLowerCase();\n\n return _.some(jsdoc.tags, (doc : Object) => {\n return doc.tag.toLowerCase() === targetTagLower;\n });\n};\n\nconst hasATag = (jsdoc : Object, targetTagNames : Array) : boolean => {\n return targetTagNames.some((targetTagName) => {\n return hasTag(jsdoc, targetTagName);\n });\n};\n\n/**\n * Checks if the JSDoc comment declares a defined type.\n *\n * @param {JsDocTag} tag\n * the tag which should be checked.\n * @returns {boolean}\n * true in case a defined type is declared; otherwise false.\n */\nconst hasDefinedTypeTag = (tag) => {\n // The function should not continue in the event the type is not defined...\n if (typeof tag === 'undefined' || tag === null) {\n return false;\n }\n\n // .. same applies if it declares an `{undefined}` or `{void}` type\n const tagType = tag.type.trim();\n if (tagType === 'undefined' || tagType === 'void') {\n return false;\n }\n\n // In any other case, a type is present\n return true;\n};\n\nconst ensureMap = (map, tag) => {\n if (!map.has(tag)) {\n map.set(tag, new Map());\n }\n\n return map.get(tag);\n};\n\nconst overrideTagStructure = (structuredTags, tagMap = tagStructure) => {\n Object.entries(structuredTags).forEach(([tag, {\n name, type, required = [],\n }]) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n tagStruct.set('nameContents', name);\n tagStruct.set('typeAllowed', type);\n\n const requiredName = required.includes('name');\n if (requiredName && name === false) {\n throw new Error('Cannot add \"name\" to `require` with the tag\\'s `name` set to `false`');\n }\n tagStruct.set('nameRequired', requiredName);\n\n const requiredType = required.includes('type');\n if (requiredType && type === false) {\n throw new Error('Cannot add \"type\" to `require` with the tag\\'s `type` set to `false`');\n }\n tagStruct.set('typeRequired', requiredType);\n\n const typeOrNameRequired = required.includes('typeOrNameRequired');\n if (typeOrNameRequired && name === false) {\n throw new Error('Cannot add \"typeOrNameRequired\" to `require` with the tag\\'s `name` set to `false`');\n }\n if (typeOrNameRequired && type === false) {\n throw new Error('Cannot add \"typeOrNameRequired\" to `require` with the tag\\'s `type` set to `false`');\n }\n tagStruct.set('typeOrNameRequired', typeOrNameRequired);\n });\n};\n\nconst getTagStructureForMode = (mode, structuredTags) => {\n const tagStruct = getDefaultTagStructureForMode(mode);\n\n try {\n overrideTagStructure(structuredTags, tagStruct);\n } catch {\n //\n }\n\n return tagStruct;\n};\n\nconst isNamepathDefiningTag = (tag, tagMap = tagStructure) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n return tagStruct.get('nameContents') === 'namepath-defining';\n};\n\nconst tagMustHaveTypePosition = (tag, tagMap = tagStructure) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n return tagStruct.get('typeRequired');\n};\n\nconst tagMightHaveTypePosition = (tag, tagMap = tagStructure) => {\n if (tagMustHaveTypePosition(tag, tagMap)) {\n return true;\n }\n\n const tagStruct = ensureMap(tagMap, tag);\n\n const ret = tagStruct.get('typeAllowed');\n\n return ret === undefined ? true : ret;\n};\n\nconst namepathTypes = new Set([\n 'namepath-defining', 'namepath-referencing',\n]);\n\nconst tagMightHaveNamePosition = (tag, tagMap = tagStructure) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n const ret = tagStruct.get('nameContents');\n\n return ret === undefined ? true : Boolean(ret);\n};\n\nconst tagMightHaveNamepath = (tag, tagMap = tagStructure) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n return namepathTypes.has(tagStruct.get('nameContents'));\n};\n\nconst tagMustHaveNamePosition = (tag, tagMap = tagStructure) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n return tagStruct.get('nameRequired');\n};\n\nconst tagMightHaveEitherTypeOrNamePosition = (tag, tagMap) => {\n return tagMightHaveTypePosition(tag, tagMap) || tagMightHaveNamepath(tag, tagMap);\n};\n\nconst tagMustHaveEitherTypeOrNamePosition = (tag, tagMap) => {\n const tagStruct = ensureMap(tagMap, tag);\n\n return tagStruct.get('typeOrNameRequired');\n};\n\nconst tagMissingRequiredTypeOrNamepath = (tag, tagMap = tagStructure) => {\n const mustHaveTypePosition = tagMustHaveTypePosition(tag.tag, tagMap);\n const mightHaveTypePosition = tagMightHaveTypePosition(tag.tag, tagMap);\n const hasTypePosition = mightHaveTypePosition && Boolean(tag.type);\n const hasNameOrNamepathPosition = (\n tagMustHaveNamePosition(tag.tag, tagMap) ||\n tagMightHaveNamepath(tag.tag, tagMap)\n ) && Boolean(tag.name);\n const mustHaveEither = tagMustHaveEitherTypeOrNamePosition(tag.tag, tagMap);\n const hasEither = tagMightHaveEitherTypeOrNamePosition(tag.tag, tagMap) &&\n (hasTypePosition || hasNameOrNamepathPosition);\n\n return mustHaveEither && !hasEither && !mustHaveTypePosition;\n};\n\n/**\n * Checks if a node is a promise but has no resolve value or an empty value.\n * An `undefined` resolve does not count.\n *\n * @param {object} node\n * @returns {boolean}\n */\nconst isNewPromiseExpression = (node) => {\n return node.type === 'NewExpression' && node.callee.type === 'Identifier' &&\n node.callee.name === 'Promise';\n};\n\n/**\n * @callback PromiseFilter\n * @param {object} node\n * @returns {boolean}\n */\n\n/**\n * Checks if a node has a return statement. Void return does not count.\n *\n * @param {object} node\n * @param {PromiseFilter} promFilter\n * @returns {boolean|Node}\n */\n// eslint-disable-next-line complexity\nconst hasReturnValue = (node, promFilter) => {\n if (!node) {\n return false;\n }\n\n switch (node.type) {\n case 'TSFunctionType':\n case 'TSMethodSignature':\n return ![\n 'TSVoidKeyword',\n 'TSUndefinedKeyword',\n ].includes(node?.returnType?.typeAnnotation?.type);\n case 'MethodDefinition':\n return hasReturnValue(node.value, promFilter);\n case 'FunctionExpression':\n case 'FunctionDeclaration':\n case 'ArrowFunctionExpression': {\n return node.expression || hasReturnValue(node.body, promFilter);\n }\n case 'BlockStatement': {\n return node.body.some((bodyNode) => {\n return bodyNode.type !== 'FunctionDeclaration' && hasReturnValue(bodyNode, promFilter);\n });\n }\n case 'LabeledStatement':\n case 'WhileStatement':\n case 'DoWhileStatement':\n case 'ForStatement':\n case 'ForInStatement':\n case 'ForOfStatement':\n case 'WithStatement': {\n return hasReturnValue(node.body, promFilter);\n }\n case 'IfStatement': {\n return hasReturnValue(node.consequent, promFilter) || hasReturnValue(node.alternate, promFilter);\n }\n case 'TryStatement': {\n return hasReturnValue(node.block, promFilter) ||\n hasReturnValue(node.handler && node.handler.body, promFilter) ||\n hasReturnValue(node.finalizer, promFilter);\n }\n case 'SwitchStatement': {\n return node.cases.some(\n (someCase) => {\n return someCase.consequent.some((nde) => {\n return hasReturnValue(nde, promFilter);\n });\n },\n );\n }\n case 'ReturnStatement': {\n // void return does not count.\n if (node.argument === null) {\n return false;\n }\n\n if (promFilter && isNewPromiseExpression(node.argument)) {\n // Let caller decide how to filter, but this is, at the least,\n // a return of sorts and truthy\n return promFilter(node.argument);\n }\n\n return true;\n }\n default: {\n return false;\n }\n }\n};\n\n/**\n * Avoids further checking child nodes if a nested function shadows the\n * resolver, but otherwise, if name is used (by call or passed in as an\n * argument to another function), will be considered as non-empty.\n *\n * This could check for redeclaration of the resolver, but as such is\n * unlikely, we avoid the performance cost of checking everywhere for\n * (re)declarations or assignments.\n *\n * @param {AST} node\n * @param {string} resolverName\n * @returns {boolean}\n */\n// eslint-disable-next-line complexity\nconst hasNonEmptyResolverCall = (node, resolverName) => {\n if (!node) {\n return false;\n }\n\n // Arrow function without block\n switch (node.type) {\n // istanbul ignore next -- In Babel?\n case 'OptionalCallExpression':\n case 'CallExpression':\n return node.callee.name === resolverName && (\n\n // Implicit or expliit undefined\n node.arguments.length > 1 || node.arguments[0] !== undefined\n ) ||\n node.arguments.some((nde) => {\n // Being passed in to another function (which might invoke it)\n return nde.type === 'Identifier' && nde.name === resolverName ||\n\n // Handle nested items\n hasNonEmptyResolverCall(nde, resolverName);\n });\n case 'ChainExpression':\n case 'Decorator':\n case 'ExpressionStatement':\n return hasNonEmptyResolverCall(node.expression, resolverName);\n case 'ClassBody':\n case 'BlockStatement':\n return node.body.some((bodyNode) => {\n return hasNonEmptyResolverCall(bodyNode, resolverName);\n });\n case 'FunctionExpression':\n case 'FunctionDeclaration':\n case 'ArrowFunctionExpression': {\n // Shadowing\n if (node.params[0]?.name === resolverName) {\n return false;\n }\n\n return hasNonEmptyResolverCall(node.body, resolverName);\n }\n\n case 'LabeledStatement':\n case 'WhileStatement':\n case 'DoWhileStatement':\n case 'ForStatement':\n case 'ForInStatement':\n case 'ForOfStatement':\n case 'WithStatement': {\n return hasNonEmptyResolverCall(node.body, resolverName);\n }\n case 'ConditionalExpression':\n case 'IfStatement': {\n return hasNonEmptyResolverCall(node.test, resolverName) ||\n hasNonEmptyResolverCall(node.consequent, resolverName) ||\n hasNonEmptyResolverCall(node.alternate, resolverName);\n }\n case 'TryStatement': {\n return hasNonEmptyResolverCall(node.block, resolverName) ||\n hasNonEmptyResolverCall(node.handler && node.handler.body, resolverName) ||\n hasNonEmptyResolverCall(node.finalizer, resolverName);\n }\n case 'SwitchStatement': {\n return node.cases.some(\n (someCase) => {\n return someCase.consequent.some((nde) => {\n return hasNonEmptyResolverCall(nde, resolverName);\n });\n },\n );\n }\n\n case 'ArrayPattern':\n case 'ArrayExpression':\n return node.elements.some((element) => {\n return hasNonEmptyResolverCall(element, resolverName);\n });\n\n case 'AssignmentPattern':\n return hasNonEmptyResolverCall(node.right, resolverName);\n\n case 'AssignmentExpression':\n case 'BinaryExpression':\n case 'LogicalExpression': {\n return hasNonEmptyResolverCall(node.left, resolverName) ||\n hasNonEmptyResolverCall(node.right, resolverName);\n }\n\n // Comma\n case 'SequenceExpression':\n case 'TemplateLiteral':\n return node.expressions.some((subExpression) => {\n return hasNonEmptyResolverCall(subExpression, resolverName);\n });\n\n case 'ObjectPattern':\n case 'ObjectExpression':\n return node.properties.some((property) => {\n return hasNonEmptyResolverCall(property, resolverName);\n });\n // istanbul ignore next -- In Babel?\n case 'ClassMethod':\n case 'MethodDefinition':\n return node.decorators && node.decorators.some((decorator) => {\n return hasNonEmptyResolverCall(decorator, resolverName);\n }) ||\n node.computed && hasNonEmptyResolverCall(node.key, resolverName) ||\n hasNonEmptyResolverCall(node.value, resolverName);\n\n // istanbul ignore next -- In Babel?\n case 'ObjectProperty':\n /* eslint-disable no-fallthrough */\n // istanbul ignore next -- In Babel?\n case 'ClassProperty':\n /* eslint-enable no-fallthrough */\n case 'Property':\n return node.computed && hasNonEmptyResolverCall(node.key, resolverName) ||\n hasNonEmptyResolverCall(node.value, resolverName);\n // istanbul ignore next -- In Babel?\n case 'ObjectMethod':\n // istanbul ignore next -- In Babel?\n return node.computed && hasNonEmptyResolverCall(node.key, resolverName) ||\n node.arguments.some((nde) => {\n return hasNonEmptyResolverCall(nde, resolverName);\n });\n\n case 'ClassExpression':\n case 'ClassDeclaration':\n return hasNonEmptyResolverCall(node.body, resolverName);\n\n case 'AwaitExpression':\n case 'SpreadElement':\n case 'UnaryExpression':\n case 'YieldExpression':\n return hasNonEmptyResolverCall(node.argument, resolverName);\n\n case 'VariableDeclaration': {\n return node.declarations.some((nde) => {\n return hasNonEmptyResolverCall(nde, resolverName);\n });\n }\n case 'VariableDeclarator': {\n return hasNonEmptyResolverCall(node.id, resolverName) ||\n hasNonEmptyResolverCall(node.init, resolverName);\n }\n\n case 'TaggedTemplateExpression':\n return hasNonEmptyResolverCall(node.quasi, resolverName);\n\n // ?.\n // istanbul ignore next -- In Babel?\n case 'OptionalMemberExpression':\n case 'MemberExpression':\n return hasNonEmptyResolverCall(node.object, resolverName) ||\n hasNonEmptyResolverCall(node.property, resolverName);\n\n // istanbul ignore next -- In Babel?\n case 'Import':\n case 'ImportExpression':\n return hasNonEmptyResolverCall(node.source, resolverName);\n\n case 'ReturnStatement': {\n if (node.argument === null) {\n return false;\n }\n\n return hasNonEmptyResolverCall(node.argument, resolverName);\n }\n\n /*\n // Shouldn't need to parse literals/literal components, etc.\n\n case 'Identifier':\n case 'TemplateElement':\n case 'Super':\n // Exports not relevant in this context\n */\n default:\n return false;\n }\n};\n\n/**\n * Checks if a Promise executor has no resolve value or an empty value.\n * An `undefined` resolve does not count.\n *\n * @param {object} node\n * @param {boolean} anyPromiseAsReturn\n * @returns {boolean}\n */\nconst hasValueOrExecutorHasNonEmptyResolveValue = (node, anyPromiseAsReturn) => {\n return hasReturnValue(node, (prom) => {\n if (anyPromiseAsReturn) {\n return true;\n }\n\n const [{params, body} = {}] = prom.arguments;\n\n if (!params?.length) {\n return false;\n }\n\n const [{name: resolverName}] = params;\n\n return hasNonEmptyResolverCall(body, resolverName);\n });\n};\n\n// eslint-disable-next-line complexity\nconst hasNonFunctionYield = (node, checkYieldReturnValue) => {\n if (!node) {\n return false;\n }\n switch (node.type) {\n case 'BlockStatement': {\n return node.body.some((bodyNode) => {\n return ![\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n 'FunctionExpression',\n ].includes(bodyNode.type) && hasNonFunctionYield(\n bodyNode, checkYieldReturnValue,\n );\n });\n }\n // istanbul ignore next -- In Babel?\n case 'OptionalCallExpression':\n case 'CallExpression':\n return node.arguments.some((element) => {\n return hasNonFunctionYield(element, checkYieldReturnValue);\n });\n case 'ChainExpression':\n case 'ExpressionStatement': {\n return hasNonFunctionYield(node.expression, checkYieldReturnValue);\n }\n case 'LabeledStatement':\n case 'WhileStatement':\n case 'DoWhileStatement':\n case 'ForStatement':\n case 'ForInStatement':\n case 'ForOfStatement':\n case 'WithStatement': {\n return hasNonFunctionYield(node.body, checkYieldReturnValue);\n }\n case 'ConditionalExpression':\n case 'IfStatement': {\n return hasNonFunctionYield(node.test, checkYieldReturnValue) ||\n hasNonFunctionYield(node.consequent, checkYieldReturnValue) ||\n hasNonFunctionYield(node.alternate, checkYieldReturnValue);\n }\n case 'TryStatement': {\n return hasNonFunctionYield(node.block, checkYieldReturnValue) ||\n hasNonFunctionYield(node.handler && node.handler.body, checkYieldReturnValue) ||\n hasNonFunctionYield(node.finalizer, checkYieldReturnValue);\n }\n case 'SwitchStatement': {\n return node.cases.some(\n (someCase) => {\n return someCase.consequent.some((nde) => {\n return hasNonFunctionYield(nde, checkYieldReturnValue);\n });\n },\n );\n }\n case 'ArrayPattern':\n case 'ArrayExpression':\n return node.elements.some((element) => {\n return hasNonFunctionYield(element, checkYieldReturnValue);\n });\n case 'AssignmentPattern':\n return hasNonFunctionYield(node.right, checkYieldReturnValue);\n\n case 'VariableDeclaration': {\n return node.declarations.some((nde) => {\n return hasNonFunctionYield(nde, checkYieldReturnValue);\n });\n }\n case 'VariableDeclarator': {\n return hasNonFunctionYield(node.id, checkYieldReturnValue) ||\n hasNonFunctionYield(node.init, checkYieldReturnValue);\n }\n\n case 'AssignmentExpression':\n case 'BinaryExpression':\n case 'LogicalExpression': {\n return hasNonFunctionYield(node.left, checkYieldReturnValue) ||\n hasNonFunctionYield(node.right, checkYieldReturnValue);\n }\n\n // Comma\n case 'SequenceExpression':\n case 'TemplateLiteral':\n return node.expressions.some((subExpression) => {\n return hasNonFunctionYield(subExpression, checkYieldReturnValue);\n });\n\n case 'ObjectPattern':\n case 'ObjectExpression':\n return node.properties.some((property) => {\n return hasNonFunctionYield(property, checkYieldReturnValue);\n });\n\n // istanbul ignore next -- In Babel?\n case 'ObjectProperty':\n /* eslint-disable no-fallthrough */\n // istanbul ignore next -- In Babel?\n case 'ClassProperty':\n /* eslint-enable no-fallthrough */\n case 'Property':\n return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) ||\n hasNonFunctionYield(node.value, checkYieldReturnValue);\n // istanbul ignore next -- In Babel?\n case 'ObjectMethod':\n // istanbul ignore next -- In Babel?\n return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) ||\n node.arguments.some((nde) => {\n return hasNonFunctionYield(nde, checkYieldReturnValue);\n });\n\n case 'SpreadElement':\n case 'UnaryExpression':\n return hasNonFunctionYield(node.argument, checkYieldReturnValue);\n\n case 'TaggedTemplateExpression':\n return hasNonFunctionYield(node.quasi, checkYieldReturnValue);\n\n // ?.\n // istanbul ignore next -- In Babel?\n case 'OptionalMemberExpression':\n case 'MemberExpression':\n return hasNonFunctionYield(node.object, checkYieldReturnValue) ||\n hasNonFunctionYield(node.property, checkYieldReturnValue);\n\n // istanbul ignore next -- In Babel?\n case 'Import':\n case 'ImportExpression':\n return hasNonFunctionYield(node.source, checkYieldReturnValue);\n\n case 'ReturnStatement': {\n if (node.argument === null) {\n return false;\n }\n\n return hasNonFunctionYield(node.argument, checkYieldReturnValue);\n }\n\n case 'YieldExpression': {\n if (checkYieldReturnValue) {\n if (node.parent.type === 'VariableDeclarator') {\n return true;\n }\n\n return false;\n }\n\n // void return does not count.\n if (node.argument === null) {\n return false;\n }\n\n return true;\n }\n default: {\n return false;\n }\n }\n};\n\n/**\n * Checks if a node has a return statement. Void return does not count.\n *\n * @param {object} node\n * @returns {boolean}\n */\nconst hasYieldValue = (node, checkYieldReturnValue) => {\n return node.generator && (\n node.expression || hasNonFunctionYield(node.body, checkYieldReturnValue)\n );\n};\n\n/**\n * Checks if a node has a throws statement.\n *\n * @param {object} node\n * @param {boolean} innerFunction\n * @returns {boolean}\n */\n// eslint-disable-next-line complexity\nconst hasThrowValue = (node, innerFunction) => {\n if (!node) {\n return false;\n }\n\n // There are cases where a function may execute its inner function which\n // throws, but we're treating functions atomically rather than trying to\n // follow them\n switch (node.type) {\n case 'FunctionExpression':\n case 'FunctionDeclaration':\n case 'ArrowFunctionExpression': {\n return !innerFunction && !node.async && hasThrowValue(node.body, true);\n }\n case 'BlockStatement': {\n return node.body.some((bodyNode) => {\n return bodyNode.type !== 'FunctionDeclaration' && hasThrowValue(bodyNode);\n });\n }\n case 'LabeledStatement':\n case 'WhileStatement':\n case 'DoWhileStatement':\n case 'ForStatement':\n case 'ForInStatement':\n case 'ForOfStatement':\n case 'WithStatement': {\n return hasThrowValue(node.body);\n }\n case 'IfStatement': {\n return hasThrowValue(node.consequent) || hasThrowValue(node.alternate);\n }\n\n // We only consider it to throw an error if the catch or finally blocks throw an error.\n case 'TryStatement': {\n return hasThrowValue(node.handler && node.handler.body) ||\n hasThrowValue(node.finalizer);\n }\n case 'SwitchStatement': {\n return node.cases.some(\n (someCase) => {\n return someCase.consequent.some((nde) => {\n return hasThrowValue(nde);\n });\n },\n );\n }\n case 'ThrowStatement': {\n return true;\n }\n\n default: {\n return false;\n }\n }\n};\n\n/** @param {string} tag */\n/*\nconst isInlineTag = (tag) => {\n return /^(@link|@linkcode|@linkplain|@tutorial) /u.test(tag);\n};\n*/\n\n/**\n * Parses GCC Generic/Template types\n *\n * @see {https://github.com/google/closure-compiler/wiki/Generic-Types}\n * @see {https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template}\n * @param {JsDocTag} tag\n * @returns {Array<string>}\n */\nconst parseClosureTemplateTag = (tag) => {\n return tag.name\n .split(',')\n .map((type) => {\n return type.trim();\n });\n};\n\n/**\n * Checks user option for `contexts` array, defaulting to\n * contexts designated by the rule. Returns an array of\n * ESTree AST types, indicating allowable contexts.\n *\n * @param {*} context\n * @param {true|string[]} defaultContexts\n * @returns {string[]}\n */\nconst enforcedContexts = (context, defaultContexts) => {\n const {\n contexts = defaultContexts === true ? [\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n 'FunctionExpression',\n ] : defaultContexts,\n } = context.options[0] || {};\n\n return contexts;\n};\n\n/**\n * @param {string[]} contexts\n * @param {Function} checkJsdoc\n * @param {Function} handler\n */\nconst getContextObject = (contexts, checkJsdoc, handler) => {\n const properties = {};\n\n contexts.forEach((prop, idx) => {\n if (typeof prop === 'object') {\n const selInfo = {\n lastIndex: idx,\n selector: prop.context,\n };\n if (prop.comment) {\n properties[prop.context] = checkJsdoc.bind(\n null, {\n ...selInfo,\n comment: prop.comment,\n }, handler.bind(null, prop.comment),\n );\n } else {\n properties[prop.context] = checkJsdoc.bind(null, selInfo, null);\n }\n } else {\n const selInfo = {\n lastIndex: idx,\n selector: prop,\n };\n properties[prop] = checkJsdoc.bind(null, selInfo, null);\n }\n });\n\n return properties;\n};\n\nconst filterTags = (tags, filter) => {\n return tags.filter(filter);\n};\n\nconst tagsWithNamesAndDescriptions = new Set([\n 'param', 'arg', 'argument', 'property', 'prop',\n 'template',\n\n // These two are parsed by our custom parser as though having a `name`\n 'returns', 'return',\n]);\n\nconst getTagsByType = (context, mode, tags, tagPreference) => {\n const descName = getPreferredTagName(context, mode, 'description', tagPreference);\n const tagsWithoutNames = [];\n const tagsWithNames = filterTags(tags, (tag) => {\n const {tag: tagName} = tag;\n const tagWithName = tagsWithNamesAndDescriptions.has(tagName);\n if (!tagWithName && tagName !== descName) {\n tagsWithoutNames.push(tag);\n }\n\n return tagWithName;\n });\n\n return {\n tagsWithNames,\n tagsWithoutNames,\n };\n};\n\nconst getIndent = (sourceCode) => {\n return (sourceCode.text.match(/^\\n*([ \\t]+)/u)?.[1] ?? '') + ' ';\n};\n\nconst isConstructor = (node) => {\n return node?.type === 'MethodDefinition' && node.kind === 'constructor' ||\n node?.parent?.kind === 'constructor';\n};\n\nconst isGetter = (node) => {\n return node && node.parent.kind === 'get';\n};\n\nconst isSetter = (node) => {\n return node && node.parent.kind === 'set';\n};\n\nconst hasAccessorPair = (node) => {\n const {type, kind: sourceKind, key: {name: sourceName}} = node;\n const oppositeKind = sourceKind === 'get' ? 'set' : 'get';\n\n const children = type === 'MethodDefinition' ? 'body' : 'properties';\n\n return node.parent[children].some(({kind, key: {name}}) => {\n return kind === oppositeKind && name === sourceName;\n });\n};\n\nconst exemptSpeciaMethods = (jsdoc, node, context, schema) => {\n const hasSchemaOption = (prop) => {\n const schemaProperties = schema[0].properties;\n\n return context.options[0]?.[prop] ??\n (schemaProperties[prop] && schemaProperties[prop].default);\n };\n\n const checkGetters = hasSchemaOption('checkGetters');\n const checkSetters = hasSchemaOption('checkSetters');\n\n return !hasSchemaOption('checkConstructors') &&\n (\n isConstructor(node) ||\n hasATag(jsdoc, [\n 'class',\n 'constructor',\n ])) ||\n isGetter(node) && (\n !checkGetters ||\n checkGetters === 'no-setter' && hasAccessorPair(node.parent)\n ) ||\n isSetter(node) && (\n !checkSetters ||\n checkSetters === 'no-getter' && hasAccessorPair(node.parent)\n );\n};\n\n/**\n * Since path segments may be unquoted (if matching a reserved word,\n * identifier or numeric literal) or single or double quoted, in either\n * the `@param` or in source, we need to strip the quotes to give a fair\n * comparison.\n *\n * @param {string} str\n * @returns {string}\n */\nconst dropPathSegmentQuotes = (str) => {\n return str.replace(/\\.(['\"])(.*)\\1/gu, '.$2');\n};\n\nconst comparePaths = (name) => {\n return (otherPathName) => {\n return otherPathName === name ||\n dropPathSegmentQuotes(otherPathName) === dropPathSegmentQuotes(name);\n };\n};\n\nconst pathDoesNotBeginWith = (name, otherPathName) => {\n return !name.startsWith(otherPathName) &&\n !dropPathSegmentQuotes(name).startsWith(dropPathSegmentQuotes(otherPathName));\n};\n\nconst getRegexFromString = (regexString, requiredFlags) => {\n const match = regexString.match(/^\\/(.*)\\/([gimyus]*)$/us);\n let flags = 'u';\n let regex = regexString;\n if (match) {\n [, regex, flags] = match;\n if (!flags) {\n flags = 'u';\n }\n }\n\n const uniqueFlags = [...new Set(flags + (requiredFlags || ''))];\n flags = uniqueFlags.join('');\n\n return new RegExp(regex, flags);\n};\n\nexport default {\n comparePaths,\n dropPathSegmentQuotes,\n enforcedContexts,\n exemptSpeciaMethods,\n filterTags,\n flattenRoots,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n getJsdocTagsDeep,\n getPreferredTagName,\n getRegexFromString,\n getTagsByType,\n getTagStructureForMode,\n hasATag,\n hasDefinedTypeTag,\n hasParams,\n hasReturnValue,\n hasTag,\n hasThrowValue,\n hasValueOrExecutorHasNonEmptyResolveValue,\n hasYieldValue,\n isConstructor,\n isGetter,\n isNamepathDefiningTag,\n isSetter,\n isValidTag,\n overrideTagStructure,\n parseClosureTemplateTag,\n pathDoesNotBeginWith,\n setTagStructure,\n tagMightHaveNamepath,\n tagMightHaveNamePosition,\n tagMightHaveTypePosition,\n tagMissingRequiredTypeOrNamepath,\n tagMustHaveNamePosition,\n tagMustHaveTypePosition,\n};\n"],"file":"jsdocUtils.js"}
|