github-pages-deploy-action/node_modules/eslint-plugin-jsdoc/dist/jsdocUtils.js.map
2020-03-31 08:40:00 -04:00

1 line
26 KiB
Plaintext

{"version":3,"sources":["../src/jsdocUtils.js"],"names":["getFunctionParameterNames","functionNode","getParamName","param","_","has","name","left","type","get","argument","parameter","Error","params","map","getJsdocTagsDeep","jsdoc","targetTagName","tags","reduce","arr","tag","idx","push","getJsdocTags","jsdocNames","filter","includes","modeWarnSettings","getTagNamesForMode","mode","context","jsdocTags","typeScriptTags","closureTags","hasBeenWarned","report","loc","start","column","line","message","markSettingAsWarned","getPreferredTagName","tagPreference","prefValues","values","some","prefVal","replacement","tagNames","preferredTagName","findKey","aliases","isValidTag","definedTags","validTagNames","keys","concat","flatten","additionalTags","allTags","hasTag","targetTagLower","toLowerCase","doc","hasATag","targetTagNames","hasDefinedTypeReturnTag","tagType","trim","tagsWithMandatoryTypePosition","tagsWithMandatoryTypePositionClosure","tagsWithOptionalTypePosition","tagsWithOptionalTypePositionClosure","namepathDefiningTags","tagsWithOptionalNamePosition","tagsWithMandatoryNamePosition","tagsWithMandatoryTypeOrNamePosition","isNamepathDefiningTag","tagName","tagMightHaveTypePosition","tagMustHaveTypePosition","tagMightHaveNamePosition","tagMustHaveNamePosition","tagMightHaveEitherTypeOrNamePosition","tagMustHaveEitherTypeOrNamePosition","hasReturnValue","node","expression","body","bodyNode","consequent","alternate","block","handler","finalizer","cases","someCase","parseClosureTemplateTag","description","split","enforcedContexts","defaultContexts","options","contexts","getContextObject","checkJsdoc","obj","prop","filterTags","tagsWithNamesAndDescriptions","getTagsByType","descName","tagsWithoutNames","tagsWithNames","tagWithName","getIndent","sourceCode","indent","text","match","charAt"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAIA,MAAMA,yBAAyB,GAAIC,YAAD,IAA2C;AAC3E,QAAMC,YAAY,GAAIC,KAAD,IAAW;AAC9B,QAAIC,gBAAEC,GAAF,CAAMF,KAAN,EAAa,MAAb,CAAJ,EAA0B;AACxB,a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E,EAAAA,uBAXa;AAYbmB,EAAAA,cAZa;AAabzB,EAAAA,MAba;AAcbiB,EAAAA,qBAda;AAebzB,EAAAA,UAfa;AAgBb6C,EAAAA,uBAhBa;AAiBbd,EAAAA,oCAjBa;AAkBbF,EAAAA,wBAlBa;AAmBbF,EAAAA,wBAnBa;AAoBbK,EAAAA,mCApBa;AAqBbF,EAAAA,uBArBa;AAsBbF,EAAAA;AAtBa,C","sourcesContent":["import _ from 'lodash';\nimport {jsdocTags, closureTags, typeScriptTags} from './tagNames';\nimport WarnSettings from './WarnSettings';\n\ntype ParserMode = \"jsdoc\"|\"typescript\"|\"closure\";\n\nconst getFunctionParameterNames = (functionNode : Object) : Array<string> => {\n const getParamName = (param) => {\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' || _.get(param, 'left.type') === 'ObjectPattern') {\n return '<ObjectPattern>';\n }\n\n if (param.type === 'ArrayPattern' || _.get(param, 'left.type') === 'ArrayPattern') {\n return '<ArrayPattern>';\n }\n\n if (param.type === 'RestElement') {\n return param.argument.name;\n }\n\n if (param.type === 'TSParameterProperty') {\n return getParamName(param.parameter);\n }\n\n throw new Error('Unsupported function signature format.');\n };\n\n return functionNode.params.map(getParamName);\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 return (jsdoc.tags || []).reduce((arr, {name, tag}, idx) => {\n if (tag !== targetTagName) {\n return arr;\n }\n arr.push({\n idx,\n name,\n });\n\n return arr;\n }, []);\n};\n\nconst getJsdocTags = (jsdoc : Object, targetTagName : string) : Array<string> => {\n let jsdocNames;\n\n jsdocNames = getJsdocTagsDeep(jsdoc, targetTagName);\n\n jsdocNames = jsdocNames.filter(({name}) => {\n return !name.includes('.');\n });\n\n return jsdocNames;\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':\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 = _.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 if (_.has(tagPreference, name)) {\n return tagPreference[name];\n }\n\n const tagNames = getTagNamesForMode(mode, context);\n\n const preferredTagName = _.findKey(tagNames, (aliases) => {\n return aliases.includes(name);\n });\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 const validTagNames = _.keys(tagNames).concat(_.flatten(_.values(tagNames)));\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 return value.\n *\n * @param {JsDocTag} tag\n * the tag which should be checked.\n * @returns {boolean}\n * true in case a return value is declared; otherwise false.\n */\nconst hasDefinedTypeReturnTag = (tag) => {\n // The function should not continue in the event @returns is not defined...\n if (typeof tag === 'undefined' || tag === null) {\n return false;\n }\n\n // .. same applies if it declares `@returns {undefined}` or `@returns {void}`\n const tagType = tag.type.trim();\n if (tagType === 'undefined' || tagType === 'void') {\n return false;\n }\n\n // In any other case, something must be returned, and\n // a return statement is expected\n return true;\n};\n\nconst tagsWithMandatoryTypePosition = [\n // These both show curly brackets in the doc signature and examples\n // \"typeExpression\"\n 'implements',\n\n // \"typeName\"\n 'type',\n];\n\nconst tagsWithMandatoryTypePositionClosure = [\n ...tagsWithMandatoryTypePosition,\n 'this',\n 'define',\n];\n\n// All of these have a signature with \"type\" except for\n// `augments`/`extends` (\"namepath\")\n// `param`/`arg`/`argument` (no signature)\n// `property`/`prop` (no signature)\n// `modifies` (undocumented)\nconst tagsWithOptionalTypePosition = [\n // These have the example showing curly brackets but not in their doc signature, e.g.: https://jsdoc.app/tags-enum.html\n 'enum',\n 'member', 'var',\n\n 'typedef',\n\n // These do not show curly brackets in either the signature or examples\n 'augments', 'extends',\n\n 'class', 'constructor',\n 'constant', 'const',\n\n // These show the signature with curly brackets but not in the example\n 'module',\n 'namespace',\n\n // These have no formal signature in the docs but show curly brackets\n // in the examples\n 'param', 'arg', 'argument',\n 'property', 'prop',\n\n // These show curly brackets in the signature and in the examples\n 'returns', 'return',\n 'throws', 'exception',\n 'yields', 'yield',\n\n // Has no documentation, but test example has curly brackets, and\n // \"name\" would be suggested rather than \"namepath\" based on example; not\n // sure if name is required\n 'modifies',\n];\n\nconst tagsWithOptionalTypePositionClosure = [\n ...tagsWithOptionalTypePosition,\n\n 'export',\n\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n 'package',\n 'private',\n 'protected',\n\n // These do not show a signature nor show curly brackets in the example\n 'public',\n 'static',\n];\n\n// None of these show as having curly brackets for their name/namepath\nconst namepathDefiningTags = [\n // These appear to require a \"name\" in their signature, albeit these\n // are somewhat different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n 'external', 'host',\n 'event',\n\n // These allow for \"name\"'s in their signature, but indicate as optional\n 'class', 'constructor',\n 'constant', 'const',\n 'function', 'func', 'method',\n 'interface',\n 'member', 'var',\n 'mixin',\n 'namespace',\n\n // Todo: Should add `module` here (with optional \"name\" and no curly brackets);\n // this block impacts `no-undefined-types` and `valid-types` (search for\n // \"isNamepathDefiningTag|tagMightHaveNamePosition|tagMightHaveEitherTypeOrNamePosition\")\n\n // These seem to all require a \"namepath\" in their signatures (with no counter-examples)\n 'name',\n 'typedef',\n 'callback',\n];\n\n// The following do not seem to allow curly brackets in their doc\n// signature or examples (besides `modifies`)\nconst tagsWithOptionalNamePosition = [\n ...namepathDefiningTags,\n\n // `borrows` has a different format, however, so needs special parsing;\n // seems to require both, and as \"namepath\"'s\n 'borrows',\n\n // Signature seems to require a \"name\" (of an event) and no counter-examples\n 'emits', 'fires',\n 'listens',\n\n // Signature seems to require a \"namepath\" (and no counter-examples)\n 'alias',\n 'augments', 'extends',\n 'lends',\n 'this',\n\n // Signature seems to require a \"namepath\" (and no counter-examples),\n // though it allows an incomplete namepath ending with connecting symbol\n 'memberof', 'memberof!',\n\n // Signature seems to require a \"OtherObjectPath\" with no counter-examples\n 'mixes',\n\n // Signature allows for \"namepath\" or text\n 'see',\n];\n\n// Todo: `@link` seems to require a namepath OR URL and might be checked as such.\n\n// The doc signature of `event` seems to require a \"name\"\nconst tagsWithMandatoryNamePosition = [\n // \"name\" (and a special syntax for the `external` name)\n 'external', 'host',\n\n // \"namepath\"\n 'callback',\n 'name',\n 'typedef',\n];\n\nconst tagsWithMandatoryTypeOrNamePosition = [\n // \"namepath\"\n 'alias',\n 'augments', 'extends',\n 'borrows',\n 'lends',\n 'memberof', 'memberof!',\n 'name',\n 'this',\n 'typedef',\n\n // \"name\"\n 'external', 'host',\n\n // \"OtherObjectPath\"\n 'mixes',\n];\n\nconst isNamepathDefiningTag = (tagName) => {\n return namepathDefiningTags.includes(tagName);\n};\n\nconst tagMightHaveTypePosition = (mode, tag) => {\n if (mode === 'closure') {\n return tagsWithMandatoryTypePositionClosure.includes(tag) ||\n tagsWithOptionalTypePositionClosure.includes(tag);\n }\n\n return tagsWithMandatoryTypePosition.includes(tag) ||\n tagsWithOptionalTypePosition.includes(tag);\n};\n\nconst tagMustHaveTypePosition = (mode, tag) => {\n if (mode === 'closure') {\n return tagsWithMandatoryTypePositionClosure.includes(tag);\n }\n\n return tagsWithMandatoryTypePosition.includes(tag);\n};\n\nconst tagMightHaveNamePosition = (tag) => {\n return tagsWithOptionalNamePosition.includes(tag);\n};\n\nconst tagMustHaveNamePosition = (tag) => {\n return tagsWithMandatoryNamePosition.includes(tag);\n};\n\nconst tagMightHaveEitherTypeOrNamePosition = (mode, tag) => {\n return tagMightHaveTypePosition(mode, tag) || tagMightHaveNamePosition(tag);\n};\n\nconst tagMustHaveEitherTypeOrNamePosition = (tag) => {\n return tagsWithMandatoryTypeOrNamePosition.includes(tag);\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 */\n// eslint-disable-next-line complexity\nconst hasReturnValue = (node) => {\n if (!node) {\n return false;\n }\n switch (node.type) {\n case 'FunctionExpression':\n case 'FunctionDeclaration':\n case 'ArrowFunctionExpression': {\n return node.expression || hasReturnValue(node.body);\n }\n case 'BlockStatement': {\n return node.body.some((bodyNode) => {\n return bodyNode.type !== 'FunctionDeclaration' && hasReturnValue(bodyNode);\n });\n }\n case 'WhileStatement':\n case 'DoWhileStatement':\n case 'ForStatement':\n case 'ForInStatement':\n case 'ForOfStatement':\n case 'WithStatement': {\n return hasReturnValue(node.body);\n }\n case 'IfStatement': {\n return hasReturnValue(node.consequent) || hasReturnValue(node.alternate);\n }\n case 'TryStatement': {\n return hasReturnValue(node.block) ||\n hasReturnValue(node.handler && node.handler.body) ||\n hasReturnValue(node.finalizer);\n }\n case 'SwitchStatement': {\n return node.cases.some(\n (someCase) => {\n return someCase.consequent.some(hasReturnValue);\n },\n );\n }\n case 'ReturnStatement': {\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/** @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 * @param {JsDocTag} tag\n * @returns {Array<string>}\n */\nconst parseClosureTemplateTag = (tag) => {\n return (tag.name + ' ' + tag.description)\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 /* istanbul ignore next */\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 */\nconst getContextObject = (contexts, checkJsdoc) => {\n return contexts.reduce((obj, prop) => {\n obj[prop] = checkJsdoc;\n\n return obj;\n }, {});\n};\n\nconst filterTags = (tags = [], filter) => {\n return tags.filter(filter);\n};\n\nconst tagsWithNamesAndDescriptions = [\n 'param', 'arg', 'argument', 'property', 'prop',\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.includes(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 let indent = sourceCode.text.match(/^\\n*([ \\t]+)/u);\n /* istanbul ignore next */\n indent = indent ? indent[1] + indent[1].charAt() : ' ';\n\n return indent;\n};\n\nexport default {\n enforcedContexts,\n filterTags,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n getJsdocTags,\n getJsdocTagsDeep,\n getPreferredTagName,\n getTagsByType,\n hasATag,\n hasDefinedTypeReturnTag,\n hasReturnValue,\n hasTag,\n isNamepathDefiningTag,\n isValidTag,\n parseClosureTemplateTag,\n tagMightHaveEitherTypeOrNamePosition,\n tagMightHaveNamePosition,\n tagMightHaveTypePosition,\n tagMustHaveEitherTypeOrNamePosition,\n tagMustHaveNamePosition,\n tagMustHaveTypePosition,\n};\n"],"file":"jsdocUtils.js"}