eslint-plugin-jsdoc 61.1.10 → 61.1.12
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/dist/buildForbidRuleDefinition.cjs +1 -3
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildForbidRuleDefinition.d.ts +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +1 -3
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.d.ts +1 -1
- package/dist/cjs/buildForbidRuleDefinition.d.ts +1 -1
- package/dist/cjs/buildRejectOrPreferRuleDefinition.d.ts +1 -1
- package/dist/cjs/iterateJsdoc.d.ts +2 -4
- package/dist/cjs/rules/checkTypes.d.ts +1 -1
- package/dist/cjs/rules/convertToJsdocComments.d.ts +105 -97
- package/dist/cjs/rules/noRestrictedSyntax.d.ts +1 -1
- package/dist/cjs/rules/requireTags.d.ts +1 -1
- package/dist/exportParser.cjs +1 -0
- package/dist/exportParser.cjs.map +1 -1
- package/dist/iterateJsdoc.cjs +3 -7
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +2 -4
- package/dist/jsdocUtils.cjs +4 -2
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkTypes.d.ts +1 -1
- package/dist/rules/convertToJsdocComments.cjs +1 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.d.ts +105 -97
- package/dist/rules/noRestrictedSyntax.d.ts +1 -1
- package/dist/rules/noUndefinedTypes.cjs +10 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +1 -1
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +1 -0
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +24 -15
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireTags.d.ts +1 -1
- package/package.json +7 -7
- package/src/buildForbidRuleDefinition.js +1 -3
- package/src/buildRejectOrPreferRuleDefinition.js +1 -3
- package/src/exportParser.js +1 -0
- package/src/iterateJsdoc.js +3 -7
- package/src/jsdocUtils.js +9 -3
- package/src/rules/convertToJsdocComments.js +1 -0
- package/src/rules/noUndefinedTypes.js +11 -0
- package/src/rules/requireFileOverview.js +1 -1
- package/src/rules/requireJsdoc.js +1 -0
- package/src/rules/requireParam.js +23 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noUndefinedTypes.cjs","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdoccomment","_parseImportsExports","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","extraTypes","globalTypes","typescriptGlobals","stripPseudoTypes","str","replace","_default","exports","iterateJsdoc","context","node","report","settings","sourceCode","state","utils","foundTypedefValues","scopeManager","globalScope","checkUsedTypedefs","definedTypes","disableReporting","markVariablesAsUsed","options","definedPreferredTypes","mode","preferredTypes","structuredTags","keys","length","values","map","preferredType","undefined","reportSettings","replacement","filter","Boolean","allComments","getAllComments","comments","comment","test","value","commentNode","parseComment","globals","flatMap","trim","split","concat","languageOptions","typedefs","doc","tags","tag","isNameOrNamepathDefiningTag","includes","typedefDeclarations","name","importTags","description","type","typePart","imprt","importsExports","parseImportsExports","types","namedImports","push","names","namespaceImports","namespace","ancestorNodes","currentNode","parent","getTemplateTags","ancestorNode","getJSDocComment","jsdc","templateTags","getPresentTags","closureGenericTypes","parseClosureTemplateTag","cjsOrESMScope","childScopes","block","getValidRuntimeIdentifiers","scope","result","Set","scp","variables","add","upper","imports","allDefinedTypes","identifiers","globalItem","body","item","property","key","init","callee","id","methodOrProp","getScope","tagToParsedType","propertyName","potentialType","parsedType","tryParseType","parseType","typeTags","filterTags","tagMightHaveTypePosition","namepathReferencingTags","isNamepathReferencingTag","namepathOrUrlReferencingTags","filterAllTags","isNamepathOrUrlReferencingTag","tagsWithTypes","traverse","nde","parentNode","_parent","val","currNode","right","structuredTypes","Array","isArray","typeParameters","some","typeParam","markVariableAsUsed","exit","loc","typedef","message","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/noUndefinedTypes.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\n\nconst extraTypes = [\n 'null', 'undefined', 'void', 'string', 'boolean', 'object',\n 'function', 'symbol',\n 'number', 'bigint', 'NaN', 'Infinity',\n 'any', '*', 'never', 'unknown', 'const',\n 'this', 'true', 'false',\n 'Array', 'Object', 'RegExp', 'Date', 'Function', 'Intl',\n];\n\nconst globalTypes = [\n 'globalThis', 'global', 'window', 'self',\n];\n\nconst typescriptGlobals = [\n // https://www.typescriptlang.org/docs/handbook/utility-types.html\n 'Awaited',\n 'Partial',\n 'Required',\n 'Readonly',\n 'Record',\n 'Pick',\n 'Omit',\n 'Exclude',\n 'Extract',\n 'NonNullable',\n 'Parameters',\n 'ConstructorParameters',\n 'ReturnType',\n 'InstanceType',\n 'ThisParameterType',\n 'OmitThisParameter',\n 'ThisType',\n 'Uppercase',\n 'Lowercase',\n 'Capitalize',\n 'Uncapitalize',\n];\n\n/**\n * @param {string|false|undefined} [str]\n * @returns {undefined|string|false}\n */\nconst stripPseudoTypes = (str) => {\n return str && str.replace(/(?:\\.|<>|\\.<>|\\[\\])$/v, '');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n sourceCode,\n state,\n utils,\n}) => {\n /** @type {string[]} */\n const foundTypedefValues = [];\n\n const {\n scopeManager,\n } = sourceCode;\n\n // When is this ever `null`?\n const globalScope = /** @type {import('eslint').Scope.Scope} */ (\n scopeManager.globalScope\n );\n\n const\n /**\n * @type {{\n * checkUsedTypedefs: boolean\n * definedTypes: string[],\n * disableReporting: boolean,\n * markVariablesAsUsed: boolean,\n * }}\n */ {\n checkUsedTypedefs = false,\n definedTypes = [],\n disableReporting = false,\n markVariablesAsUsed = true,\n } = context.options[0] || {};\n\n /** @type {(string|undefined)[]} */\n let definedPreferredTypes = [];\n const {\n mode,\n preferredTypes,\n structuredTags,\n } = settings;\n if (Object.keys(preferredTypes).length) {\n definedPreferredTypes = /** @type {string[]} */ (Object.values(preferredTypes).map((preferredType) => {\n if (typeof preferredType === 'string') {\n // May become an empty string but will be filtered out below\n return stripPseudoTypes(preferredType);\n }\n\n if (!preferredType) {\n return undefined;\n }\n\n if (typeof preferredType !== 'object') {\n utils.reportSettings(\n 'Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.',\n );\n }\n\n return stripPseudoTypes(preferredType.replacement);\n })\n .filter(Boolean));\n }\n\n const allComments = sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return parseComment(commentNode, '');\n });\n\n const globals = allComments\n .filter((comment) => {\n return (/^\\s*globals/v).test(comment.value);\n }).flatMap((commentNode) => {\n return commentNode.value.replace(/^\\s*globals/v, '').trim().split(/,\\s*/v);\n }).concat(Object.keys(context.languageOptions.globals ?? []));\n\n const typedefs = comments\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag) && ![\n 'arg',\n 'argument',\n 'param',\n 'prop',\n 'property',\n ].includes(tag);\n });\n });\n\n const typedefDeclarations = typedefs\n .map((tag) => {\n return tag.name;\n });\n\n const importTags = settings.mode === 'typescript' ? /** @type {string[]} */ (comments.flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'import';\n });\n }).flatMap((tag) => {\n const {\n description,\n name,\n type,\n } = tag;\n const typePart = type ? `{${type}} ` : '';\n const imprt = 'import ' + (description ?\n `${typePart}${name} ${description}` :\n `${typePart}${name}`);\n\n const importsExports = parseImportsExports(imprt.trim());\n\n const types = [];\n const namedImports = Object.values(importsExports.namedImports || {})[0]?.[0];\n if (namedImports) {\n if (namedImports.default) {\n types.push(namedImports.default);\n }\n\n if (namedImports.names) {\n types.push(...Object.keys(namedImports.names));\n }\n }\n\n const namespaceImports = Object.values(importsExports.namespaceImports || {})[0]?.[0];\n if (namespaceImports) {\n if (namespaceImports.namespace) {\n types.push(namespaceImports.namespace);\n }\n\n if (namespaceImports.default) {\n types.push(namespaceImports.default);\n }\n }\n\n return types;\n }).filter(Boolean)) : [];\n\n const ancestorNodes = [];\n\n let currentNode = node;\n // No need for Program node?\n while (currentNode?.parent) {\n ancestorNodes.push(currentNode);\n currentNode = currentNode.parent;\n }\n\n /**\n * @param {import('eslint').Rule.Node} ancestorNode\n * @returns {import('comment-parser').Spec[]}\n */\n const getTemplateTags = function (ancestorNode) {\n const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);\n if (!commentNode) {\n return [];\n }\n\n const jsdc = parseComment(commentNode, '');\n\n return jsdc.tags.filter((tag) => {\n return tag.tag === 'template';\n });\n };\n\n // `currentScope` may be `null` or `Program`, so in such a case,\n // we look to present tags instead\n const templateTags = ancestorNodes.length ?\n ancestorNodes.flatMap((ancestorNode) => {\n return getTemplateTags(ancestorNode);\n }) :\n utils.getPresentTags([\n 'template',\n ]);\n\n const closureGenericTypes = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n // In modules, including Node, there is a global scope at top with the\n // Program scope inside\n const cjsOrESMScope = globalScope.childScopes[0]?.block?.type === 'Program';\n\n /**\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {Set<string>}\n */\n const getValidRuntimeIdentifiers = (scope) => {\n const result = new Set();\n\n let scp = scope;\n while (scp) {\n for (const {\n name,\n } of scp.variables) {\n result.add(name);\n }\n\n scp = scp.upper;\n }\n\n return result;\n };\n\n /**\n * We treat imports differently as we can't introspect their children.\n * @type {string[]}\n */\n const imports = [];\n\n const allDefinedTypes = new Set(globalScope.variables.map(({\n name,\n }) => {\n return name;\n })\n\n // If the file is a module, concat the variables from the module scope.\n .concat(\n cjsOrESMScope ?\n globalScope.childScopes.flatMap(({\n variables,\n }) => {\n return variables;\n }).flatMap(({\n identifiers,\n name,\n }) => {\n const globalItem = /** @type {import('estree').Identifier & {parent: import('@typescript-eslint/types').TSESTree.Node}} */ (\n identifiers?.[0]\n )?.parent;\n switch (globalItem?.type) {\n case 'ClassDeclaration':\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.PropertyDefinition} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'ImportDefaultSpecifier':\n case 'ImportNamespaceSpecifier':\n case 'ImportSpecifier':\n imports.push(name);\n break;\n case 'TSInterfaceDeclaration':\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'VariableDeclarator':\n if (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.CallExpression} */ (\n globalItem?.init\n )?.callee)?.name === 'require'\n ) {\n imports.push(/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n globalItem.id\n ).name);\n break;\n }\n\n // Module scope names are also defined\n return [\n name,\n ];\n }\n\n return [\n name,\n ];\n /* c8 ignore next */\n }) : [],\n )\n .concat(extraTypes)\n .concat(typedefDeclarations)\n .concat(importTags)\n .concat(definedTypes)\n .concat(/** @type {string[]} */ (definedPreferredTypes))\n .concat((() => {\n // Other methods are not in scope, but we need them, and we grab them here\n if (node?.type === 'MethodDefinition') {\n return /** @type {import('estree').ClassBody} */ (node.parent).body.flatMap((methodOrProp) => {\n if (methodOrProp.type === 'MethodDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n\n if (methodOrProp.type === 'PropertyDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n /* c8 ignore next 2 -- Not yet built */\n\n return '';\n }).filter(Boolean);\n }\n\n return [];\n })())\n .concat(...getValidRuntimeIdentifiers(node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n )))\n .concat(\n settings.mode === 'jsdoc' ?\n [] :\n [\n ...settings.mode === 'typescript' ? typescriptGlobals : [],\n ...closureGenericTypes,\n ],\n ));\n\n /**\n * @typedef {{\n * parsedType: import('jsdoc-type-pratt-parser').RootResult;\n * tag: import('comment-parser').Spec|import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * line?: import('../iterateJsdoc.js').Integer\n * }\n * }} TypeAndTagInfo\n */\n\n /**\n * @param {string} propertyName\n * @returns {(tag: (import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * name?: string,\n * type?: string,\n * line?: import('../iterateJsdoc.js').Integer\n * })|import('comment-parser').Spec & {\n * namepathOrURL?: string\n * }\n * ) => undefined|TypeAndTagInfo}\n */\n const tagToParsedType = (propertyName) => {\n return (tag) => {\n try {\n const potentialType = tag[\n /** @type {\"type\"|\"name\"|\"namepathOrURL\"} */ (propertyName)\n ];\n return {\n parsedType: mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode),\n tag,\n };\n } catch {\n return undefined;\n }\n };\n };\n\n const typeTags = utils.filterTags(({\n tag,\n }) => {\n return tag !== 'import' && utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure');\n }).map(tagToParsedType('type'));\n\n const namepathReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathReferencingTag(tag);\n }).map(tagToParsedType('name'));\n\n const namepathOrUrlReferencingTags = utils.filterAllTags(({\n tag,\n }) => {\n return utils.isNamepathOrUrlReferencingTag(tag);\n }).map(tagToParsedType('namepathOrURL'));\n\n const tagsWithTypes = /** @type {TypeAndTagInfo[]} */ ([\n ...typeTags,\n ...namepathReferencingTags,\n ...namepathOrUrlReferencingTags,\n // Remove types which failed to parse\n ].filter(Boolean));\n\n for (const {\n parsedType,\n tag,\n } of tagsWithTypes) {\n // eslint-disable-next-line complexity -- Refactor\n traverse(parsedType, (nde, parentNode) => {\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */\n // eslint-disable-next-line canonical/id-match -- Avoid clashes\n (nde)._parent = parentNode;\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n let val = value;\n\n /** @type {import('jsdoc-type-pratt-parser').NonRootResult|undefined} */\n let currNode = nde;\n do {\n currNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (currNode)._parent;\n if (\n // Avoid appending for imports and globals since we don't want to\n // check their properties which may or may not exist\n !imports.includes(val) && !globals.includes(val) &&\n !importTags.includes(val) &&\n !extraTypes.includes(val) &&\n !typedefDeclarations.includes(val) &&\n !globalTypes.includes(val) &&\n currNode && 'right' in currNode &&\n currNode.right?.type === 'JsdocTypeProperty'\n ) {\n val = val + '.' + currNode.right.value;\n }\n } while (currNode?.type === 'JsdocTypeNamePath');\n\n if (type === 'JsdocTypeName') {\n const structuredTypes = structuredTags[tag.tag]?.type;\n if (!allDefinedTypes.has(val) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(val))\n ) {\n const parent =\n /**\n * @type {import('jsdoc-type-pratt-parser').RootResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (nde)._parent;\n if (parent?.type === 'JsdocTypeTypeParameter') {\n return;\n }\n\n if (parent?.type === 'JsdocTypeFunction' &&\n /** @type {import('jsdoc-type-pratt-parser').FunctionResult} */\n (parent)?.typeParameters?.some((typeParam) => {\n return value === typeParam.name.value;\n })\n ) {\n return;\n }\n\n if (!disableReporting) {\n report(`The type '${val}' is undefined.`, null, tag);\n }\n } else if (markVariablesAsUsed && !extraTypes.includes(val)) {\n if (sourceCode.markVariableAsUsed) {\n sourceCode.markVariableAsUsed(val);\n /* c8 ignore next 4 */\n } else {\n // @ts-expect-error ESLint 8\n context.markVariableAsUsed(val);\n }\n }\n\n if (checkUsedTypedefs && typedefDeclarations.includes(val)) {\n foundTypedefValues.push(val);\n }\n }\n });\n }\n\n state.foundTypedefValues = foundTypedefValues;\n}, {\n // We use this method rather than checking at end of handler above because\n // in that case, it is invoked too many times and would thus report errors\n // too many times.\n exit ({\n context,\n state,\n utils,\n }) {\n const {\n checkUsedTypedefs = false,\n } = context.options[0] || {};\n\n if (!checkUsedTypedefs) {\n return;\n }\n\n const allComments = context.sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return {\n doc: parseComment(commentNode, ''),\n loc: commentNode.loc,\n };\n });\n const typedefs = comments\n .flatMap(({\n doc,\n loc,\n }) => {\n const tags = doc.tags.filter(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n });\n if (!tags.length) {\n return [];\n }\n\n return {\n loc,\n tags,\n };\n });\n\n for (const typedef of typedefs) {\n if (\n !state.foundTypedefValues.includes(typedef.tags[0].name)\n ) {\n context.report({\n loc: /** @type {import('@eslint/core').SourceLocation} */ (typedef.loc),\n message: 'This typedef was not used within the file',\n });\n }\n }\n },\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkUsedTypedefs: {\n description: 'Whether to check typedefs for use within the file',\n type: 'boolean',\n },\n definedTypes: {\n description: `This array can be populated to indicate other types which\nare automatically considered as defined (in addition to globals, etc.).\nDefaults to an empty array.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n disableReporting: {\n description: `Whether to disable reporting of errors. Defaults to\n\\`false\\`. This may be set to \\`true\\` in order to take advantage of only\nmarking defined variables as used or checking used typedefs.`,\n type: 'boolean',\n },\n markVariablesAsUsed: {\n description: `Whether to mark variables as used for the purposes\nof the \\`no-unused-vars\\` rule when they are not found to be undefined.\nDefaults to \\`true\\`. May be set to \\`false\\` to enforce a practice of not\nimporting types unless used in code.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAMA,IAAAE,oBAAA,GAAAF,OAAA;AAE+B,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,C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UndefinedTypes.cjs","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdoccomment","_parseImportsExports","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","extraTypes","globalTypes","typescriptGlobals","stripPseudoTypes","str","replace","_default","exports","iterateJsdoc","context","node","report","settings","sourceCode","state","utils","foundTypedefValues","scopeManager","globalScope","checkUsedTypedefs","definedTypes","disableReporting","markVariablesAsUsed","options","definedPreferredTypes","mode","preferredTypes","structuredTags","keys","length","values","map","preferredType","undefined","reportSettings","replacement","filter","Boolean","allComments","getAllComments","comments","comment","test","value","commentNode","parseComment","globals","flatMap","trim","split","concat","languageOptions","typedefs","doc","tags","tag","isNameOrNamepathDefiningTag","includes","typedefDeclarations","name","importTags","description","type","typePart","imprt","importsExports","parseImportsExports","types","namedImports","push","names","namespaceImports","namespace","ancestorNodes","currentNode","parent","getTemplateTags","ancestorNode","getJSDocComment","jsdc","templateTags","getPresentTags","closureGenericTypes","parseClosureTemplateTag","cjsOrESMScope","childScopes","block","getValidRuntimeIdentifiers","scope","result","Set","scp","variables","add","upper","imports","allDefinedTypes","identifiers","globalItem","body","item","property","key","init","callee","id","methodOrProp","getScope","tagToParsedType","propertyName","potentialType","parsedType","tryParseType","parseType","typeTags","filterTags","tagMightHaveTypePosition","namepathReferencingTags","isNamepathReferencingTag","namepathOrUrlReferencingTags","filterAllTags","isNamepathOrUrlReferencingTag","definedNamesAndNamepaths","tagsWithTypes","traverse","nde","parentNode","_parent","val","currNode","right","structuredTypes","Array","isArray","typeParameters","some","typeParam","markVariableAsUsed","exit","loc","typedef","message","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/noUndefinedTypes.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\n\nconst extraTypes = [\n 'null', 'undefined', 'void', 'string', 'boolean', 'object',\n 'function', 'symbol',\n 'number', 'bigint', 'NaN', 'Infinity',\n 'any', '*', 'never', 'unknown', 'const',\n 'this', 'true', 'false',\n 'Array', 'Object', 'RegExp', 'Date', 'Function', 'Intl',\n];\n\nconst globalTypes = [\n 'globalThis', 'global', 'window', 'self',\n];\n\nconst typescriptGlobals = [\n // https://www.typescriptlang.org/docs/handbook/utility-types.html\n 'Awaited',\n 'Partial',\n 'Required',\n 'Readonly',\n 'Record',\n 'Pick',\n 'Omit',\n 'Exclude',\n 'Extract',\n 'NonNullable',\n 'Parameters',\n 'ConstructorParameters',\n 'ReturnType',\n 'InstanceType',\n 'ThisParameterType',\n 'OmitThisParameter',\n 'ThisType',\n 'Uppercase',\n 'Lowercase',\n 'Capitalize',\n 'Uncapitalize',\n];\n\n/**\n * @param {string|false|undefined} [str]\n * @returns {undefined|string|false}\n */\nconst stripPseudoTypes = (str) => {\n return str && str.replace(/(?:\\.|<>|\\.<>|\\[\\])$/v, '');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n sourceCode,\n state,\n utils,\n}) => {\n /** @type {string[]} */\n const foundTypedefValues = [];\n\n const {\n scopeManager,\n } = sourceCode;\n\n // When is this ever `null`?\n const globalScope = /** @type {import('eslint').Scope.Scope} */ (\n scopeManager.globalScope\n );\n\n const\n /**\n * @type {{\n * checkUsedTypedefs: boolean\n * definedTypes: string[],\n * disableReporting: boolean,\n * markVariablesAsUsed: boolean,\n * }}\n */ {\n checkUsedTypedefs = false,\n definedTypes = [],\n disableReporting = false,\n markVariablesAsUsed = true,\n } = context.options[0] || {};\n\n /** @type {(string|undefined)[]} */\n let definedPreferredTypes = [];\n const {\n mode,\n preferredTypes,\n structuredTags,\n } = settings;\n if (Object.keys(preferredTypes).length) {\n definedPreferredTypes = /** @type {string[]} */ (Object.values(preferredTypes).map((preferredType) => {\n if (typeof preferredType === 'string') {\n // May become an empty string but will be filtered out below\n return stripPseudoTypes(preferredType);\n }\n\n if (!preferredType) {\n return undefined;\n }\n\n if (typeof preferredType !== 'object') {\n utils.reportSettings(\n 'Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.',\n );\n }\n\n return stripPseudoTypes(preferredType.replacement);\n })\n .filter(Boolean));\n }\n\n const allComments = sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return parseComment(commentNode, '');\n });\n\n const globals = allComments\n .filter((comment) => {\n return (/^\\s*globals/v).test(comment.value);\n }).flatMap((commentNode) => {\n return commentNode.value.replace(/^\\s*globals/v, '').trim().split(/,\\s*/v);\n }).concat(Object.keys(context.languageOptions.globals ?? []));\n\n const typedefs = comments\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag) && ![\n 'arg',\n 'argument',\n 'param',\n 'prop',\n 'property',\n ].includes(tag);\n });\n });\n\n const typedefDeclarations = typedefs\n .map((tag) => {\n return tag.name;\n });\n\n const importTags = settings.mode === 'typescript' ? /** @type {string[]} */ (comments.flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'import';\n });\n }).flatMap((tag) => {\n const {\n description,\n name,\n type,\n } = tag;\n const typePart = type ? `{${type}} ` : '';\n const imprt = 'import ' + (description ?\n `${typePart}${name} ${description}` :\n `${typePart}${name}`);\n\n const importsExports = parseImportsExports(imprt.trim());\n\n const types = [];\n const namedImports = Object.values(importsExports.namedImports || {})[0]?.[0];\n if (namedImports) {\n if (namedImports.default) {\n types.push(namedImports.default);\n }\n\n if (namedImports.names) {\n types.push(...Object.keys(namedImports.names));\n }\n }\n\n const namespaceImports = Object.values(importsExports.namespaceImports || {})[0]?.[0];\n if (namespaceImports) {\n if (namespaceImports.namespace) {\n types.push(namespaceImports.namespace);\n }\n\n if (namespaceImports.default) {\n types.push(namespaceImports.default);\n }\n }\n\n return types;\n }).filter(Boolean)) : [];\n\n const ancestorNodes = [];\n\n let currentNode = node;\n // No need for Program node?\n while (currentNode?.parent) {\n ancestorNodes.push(currentNode);\n currentNode = currentNode.parent;\n }\n\n /**\n * @param {import('eslint').Rule.Node} ancestorNode\n * @returns {import('comment-parser').Spec[]}\n */\n const getTemplateTags = function (ancestorNode) {\n const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);\n if (!commentNode) {\n return [];\n }\n\n const jsdc = parseComment(commentNode, '');\n\n return jsdc.tags.filter((tag) => {\n return tag.tag === 'template';\n });\n };\n\n // `currentScope` may be `null` or `Program`, so in such a case,\n // we look to present tags instead\n const templateTags = ancestorNodes.length ?\n ancestorNodes.flatMap((ancestorNode) => {\n return getTemplateTags(ancestorNode);\n }) :\n utils.getPresentTags([\n 'template',\n ]);\n\n const closureGenericTypes = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n // In modules, including Node, there is a global scope at top with the\n // Program scope inside\n const cjsOrESMScope = globalScope.childScopes[0]?.block?.type === 'Program';\n\n /**\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {Set<string>}\n */\n const getValidRuntimeIdentifiers = (scope) => {\n const result = new Set();\n\n let scp = scope;\n while (scp) {\n for (const {\n name,\n } of scp.variables) {\n result.add(name);\n }\n\n scp = scp.upper;\n }\n\n return result;\n };\n\n /**\n * We treat imports differently as we can't introspect their children.\n * @type {string[]}\n */\n const imports = [];\n\n const allDefinedTypes = new Set(globalScope.variables.map(({\n name,\n }) => {\n return name;\n })\n\n // If the file is a module, concat the variables from the module scope.\n .concat(\n cjsOrESMScope ?\n globalScope.childScopes.flatMap(({\n variables,\n }) => {\n return variables;\n }).flatMap(({\n identifiers,\n name,\n }) => {\n const globalItem = /** @type {import('estree').Identifier & {parent: import('@typescript-eslint/types').TSESTree.Node}} */ (\n identifiers?.[0]\n )?.parent;\n switch (globalItem?.type) {\n case 'ClassDeclaration':\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.PropertyDefinition} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'ImportDefaultSpecifier':\n case 'ImportNamespaceSpecifier':\n case 'ImportSpecifier':\n imports.push(name);\n break;\n case 'TSInterfaceDeclaration':\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'VariableDeclarator':\n if (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.CallExpression} */ (\n globalItem?.init\n )?.callee)?.name === 'require'\n ) {\n imports.push(/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n globalItem.id\n ).name);\n break;\n }\n\n // Module scope names are also defined\n return [\n name,\n ];\n }\n\n return [\n name,\n ];\n /* c8 ignore next */\n }) : [],\n )\n .concat(extraTypes)\n .concat(typedefDeclarations)\n .concat(importTags)\n .concat(definedTypes)\n .concat(/** @type {string[]} */ (definedPreferredTypes))\n .concat((() => {\n // Other methods are not in scope, but we need them, and we grab them here\n if (node?.type === 'MethodDefinition') {\n return /** @type {import('estree').ClassBody} */ (node.parent).body.flatMap((methodOrProp) => {\n if (methodOrProp.type === 'MethodDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n\n if (methodOrProp.type === 'PropertyDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n /* c8 ignore next 2 -- Not yet built */\n\n return '';\n }).filter(Boolean);\n }\n\n return [];\n })())\n .concat(...getValidRuntimeIdentifiers(node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n )))\n .concat(\n settings.mode === 'jsdoc' ?\n [] :\n [\n ...settings.mode === 'typescript' ? typescriptGlobals : [],\n ...closureGenericTypes,\n ],\n ));\n\n /**\n * @typedef {{\n * parsedType: import('jsdoc-type-pratt-parser').RootResult;\n * tag: import('comment-parser').Spec|import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * line?: import('../iterateJsdoc.js').Integer\n * }\n * }} TypeAndTagInfo\n */\n\n /**\n * @param {string} propertyName\n * @returns {(tag: (import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * name?: string,\n * type?: string,\n * line?: import('../iterateJsdoc.js').Integer\n * })|import('comment-parser').Spec & {\n * namepathOrURL?: string\n * }\n * ) => undefined|TypeAndTagInfo}\n */\n const tagToParsedType = (propertyName) => {\n return (tag) => {\n try {\n const potentialType = tag[\n /** @type {\"type\"|\"name\"|\"namepathOrURL\"} */ (propertyName)\n ];\n return {\n parsedType: mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode),\n tag,\n };\n } catch {\n return undefined;\n }\n };\n };\n\n const typeTags = utils.filterTags(({\n tag,\n }) => {\n return tag !== 'import' && utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure');\n }).map(tagToParsedType('type'));\n\n const namepathReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathReferencingTag(tag);\n }).map(tagToParsedType('name'));\n\n const namepathOrUrlReferencingTags = utils.filterAllTags(({\n tag,\n }) => {\n return utils.isNamepathOrUrlReferencingTag(tag);\n }).map(tagToParsedType('namepathOrURL'));\n\n const definedNamesAndNamepaths = new Set(utils.filterTags(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n }).map(({\n name,\n }) => {\n return name;\n }));\n\n const tagsWithTypes = /** @type {TypeAndTagInfo[]} */ ([\n ...typeTags,\n ...namepathReferencingTags,\n ...namepathOrUrlReferencingTags,\n // Remove types which failed to parse\n ].filter(Boolean));\n\n for (const {\n parsedType,\n tag,\n } of tagsWithTypes) {\n // eslint-disable-next-line complexity -- Refactor\n traverse(parsedType, (nde, parentNode) => {\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */\n // eslint-disable-next-line canonical/id-match -- Avoid clashes\n (nde)._parent = parentNode;\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n let val = value;\n\n /** @type {import('jsdoc-type-pratt-parser').NonRootResult|undefined} */\n let currNode = nde;\n do {\n currNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (currNode)._parent;\n if (\n // Avoid appending for imports and globals since we don't want to\n // check their properties which may or may not exist\n !imports.includes(val) && !globals.includes(val) &&\n !importTags.includes(val) &&\n !extraTypes.includes(val) &&\n !typedefDeclarations.includes(val) &&\n !globalTypes.includes(val) &&\n currNode && 'right' in currNode &&\n currNode.right?.type === 'JsdocTypeProperty'\n ) {\n val = val + '.' + currNode.right.value;\n }\n } while (currNode?.type === 'JsdocTypeNamePath');\n\n if (type === 'JsdocTypeName') {\n const structuredTypes = structuredTags[tag.tag]?.type;\n if (!allDefinedTypes.has(val) &&\n !definedNamesAndNamepaths.has(val) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(val))\n ) {\n const parent =\n /**\n * @type {import('jsdoc-type-pratt-parser').RootResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (nde)._parent;\n if (parent?.type === 'JsdocTypeTypeParameter') {\n return;\n }\n\n if (parent?.type === 'JsdocTypeFunction' &&\n /** @type {import('jsdoc-type-pratt-parser').FunctionResult} */\n (parent)?.typeParameters?.some((typeParam) => {\n return value === typeParam.name.value;\n })\n ) {\n return;\n }\n\n if (!disableReporting) {\n report(`The type '${val}' is undefined.`, null, tag);\n }\n } else if (markVariablesAsUsed && !extraTypes.includes(val)) {\n if (sourceCode.markVariableAsUsed) {\n sourceCode.markVariableAsUsed(val);\n /* c8 ignore next 4 */\n } else {\n // @ts-expect-error ESLint 8\n context.markVariableAsUsed(val);\n }\n }\n\n if (checkUsedTypedefs && typedefDeclarations.includes(val)) {\n foundTypedefValues.push(val);\n }\n }\n });\n }\n\n state.foundTypedefValues = foundTypedefValues;\n}, {\n // We use this method rather than checking at end of handler above because\n // in that case, it is invoked too many times and would thus report errors\n // too many times.\n exit ({\n context,\n state,\n utils,\n }) {\n const {\n checkUsedTypedefs = false,\n } = context.options[0] || {};\n\n if (!checkUsedTypedefs) {\n return;\n }\n\n const allComments = context.sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return {\n doc: parseComment(commentNode, ''),\n loc: commentNode.loc,\n };\n });\n const typedefs = comments\n .flatMap(({\n doc,\n loc,\n }) => {\n const tags = doc.tags.filter(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n });\n if (!tags.length) {\n return [];\n }\n\n return {\n loc,\n tags,\n };\n });\n\n for (const typedef of typedefs) {\n if (\n !state.foundTypedefValues.includes(typedef.tags[0].name)\n ) {\n context.report({\n loc: /** @type {import('@eslint/core').SourceLocation} */ (typedef.loc),\n message: 'This typedef was not used within the file',\n });\n }\n }\n },\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkUsedTypedefs: {\n description: 'Whether to check typedefs for use within the file',\n type: 'boolean',\n },\n definedTypes: {\n description: `This array can be populated to indicate other types which\nare automatically considered as defined (in addition to globals, etc.).\nDefaults to an empty array.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n disableReporting: {\n description: `Whether to disable reporting of errors. Defaults to\n\\`false\\`. This may be set to \\`true\\` in order to take advantage of only\nmarking defined variables as used or checking used typedefs.`,\n type: 'boolean',\n },\n markVariablesAsUsed: {\n description: `Whether to mark variables as used for the purposes\nof the \\`no-unused-vars\\` rule when they are not found to be undefined.\nDefaults to \\`true\\`. May be set to \\`false\\` to enforce a practice of not\nimporting types unless used in code.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAMA,IAAAE,oBAAA,GAAAF,OAAA;AAE+B,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,CA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,CAAC,CAAC;AAAAwF,MAAA,CAAA/I,OAAA,GAAAA,OAAA,CAAAhB,OAAA","ignoreList":[]}
|
|
@@ -186,7 +186,7 @@ will be checked, but you must use \`file\` on the configuration object).`,
|
|
|
186
186
|
state
|
|
187
187
|
}) {
|
|
188
188
|
if (!state.hasNonComment) {
|
|
189
|
-
state.hasNonComment = node.range[0];
|
|
189
|
+
state.hasNonComment = /** @type {[number, number]} */node.range?.[0];
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireFileOverview.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","defaultTags","file","initialCommentsOnly","mustExist","preventDuplicates","setDefaults","state","globalTags","hasDuplicates","hasTag","hasNonCommentBeforeTag","_default","exports","iterateJsdoc","context","jsdocNode","utils","tags","options","tagName","Object","keys","targetTagName","getPreferredTagName","Boolean","hasDuplicate","hasNonComment","range","exit","entries","obj","getPreferredTagNameObject","reportSettings","replacement","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","patternProperties","type","nonComment","node","module"],"sources":["../../src/rules/requireFileOverview.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultTags = {\n file: {\n initialCommentsOnly: true,\n mustExist: true,\n preventDuplicates: true,\n },\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n // First iteration\n if (!state.globalTags) {\n state.globalTags = true;\n state.hasDuplicates = {};\n state.hasTag = {};\n state.hasNonCommentBeforeTag = {};\n }\n};\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n state,\n utils,\n}) => {\n const {\n tags = defaultTags,\n } = context.options[0] || {};\n\n setDefaults(state);\n\n for (const tagName of Object.keys(tags)) {\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n\n const hasTag = Boolean(targetTagName && utils.hasTag(targetTagName));\n\n state.hasTag[tagName] = hasTag || state.hasTag[tagName];\n\n const hasDuplicate = state.hasDuplicates[tagName];\n\n if (hasDuplicate === false) {\n // Was marked before, so if a tag now, is a dupe\n state.hasDuplicates[tagName] = hasTag;\n } else if (!hasDuplicate && hasTag) {\n // No dupes set before, but has first tag, so change state\n // from `undefined` to `false` so can detect next time\n state.hasDuplicates[tagName] = false;\n state.hasNonCommentBeforeTag[tagName] = state.hasNonComment &&\n state.hasNonComment < jsdocNode.range[0];\n }\n }\n}, {\n exit ({\n context,\n state,\n utils,\n }) {\n setDefaults(state);\n const {\n tags = defaultTags,\n } = context.options[0] || {};\n\n for (const [\n tagName,\n {\n initialCommentsOnly = false,\n mustExist = false,\n preventDuplicates = false,\n },\n ] of Object.entries(tags)) {\n const obj = utils.getPreferredTagNameObject({\n tagName,\n });\n if (obj && typeof obj === 'object' && 'blocked' in obj) {\n utils.reportSettings(\n `\\`settings.jsdoc.tagNamePreference\\` cannot block @${obj.tagName} ` +\n 'for the `require-file-overview` rule',\n );\n } else {\n const targetTagName = (\n obj && typeof obj === 'object' && obj.replacement\n ) || obj;\n if (mustExist && !state.hasTag[tagName]) {\n utils.reportSettings(`Missing @${targetTagName}`);\n }\n\n if (preventDuplicates && state.hasDuplicates[tagName]) {\n utils.reportSettings(\n `Duplicate @${targetTagName}`,\n );\n }\n\n if (initialCommentsOnly &&\n state.hasNonCommentBeforeTag[tagName]\n ) {\n utils.reportSettings(\n `@${targetTagName} should be at the beginning of the file`,\n );\n }\n }\n }\n },\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks that all files have one `@file`, `@fileoverview`, or `@overview` tag at the beginning of the file.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-file-overview.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `The keys of this object are tag names, and the values are configuration\nobjects indicating what will be checked for these whole-file tags.\n\nEach configuration object has 3 potential boolean keys (which default\nto \\`false\\` when this option is supplied).\n\n1. \\`mustExist\\` - enforces that all files have a \\`@file\\`, \\`@fileoverview\\`, or \\`@overview\\` tag.\n2. \\`preventDuplicates\\` - enforces that duplicate file overview tags within a given file will be reported\n3. \\`initialCommentsOnly\\` - reports file overview tags which are not, as per\n [the docs](https://jsdoc.app/tags-file.html), \"at the beginning of\n the file\"–where beginning of the file is interpreted in this rule\n as being when the overview tag is not preceded by anything other than\n a comment.\n\nWhen no \\`tags\\` is present, the default is:\n\n\\`\\`\\`json\n{\n \"file\": {\n \"initialCommentsOnly\": true,\n \"mustExist\": true,\n \"preventDuplicates\": true,\n }\n}\n\\`\\`\\`\n\nYou can add additional tag names and/or override \\`file\\` if you supply this\noption, e.g., in place of or in addition to \\`file\\`, giving other potential\nfile global tags like \\`@license\\`, \\`@copyright\\`, \\`@author\\`, \\`@module\\` or\n\\`@exports\\`, optionally restricting them to a single use or preventing them\nfrom being preceded by anything besides comments.\n\nFor example:\n\n\\`\\`\\`js\n{\n \"license\": {\n \"mustExist\": true,\n \"preventDuplicates\": true,\n }\n}\n\\`\\`\\`\n\nThis would require one and only one \\`@license\\` in the file, though because\n\\`initialCommentsOnly\\` is absent and defaults to \\`false\\`, the \\`@license\\`\ncan be anywhere.\n\nIn the case of \\`@license\\`, you can use this rule along with the\n\\`check-values\\` rule (with its \\`allowedLicenses\\` or \\`licensePattern\\` options),\nto enforce a license whitelist be present on every JS file.\n\nNote that if you choose to use \\`preventDuplicates\\` with \\`license\\`, you still\nhave a way to allow multiple licenses for the whole page by using the SPDX\n\"AND\" expression, e.g., \\`@license (MIT AND GPL-3.0)\\`.\n\nNote that the tag names are the main JSDoc tag name, so you should use \\`file\\`\nin this configuration object regardless of whether you have configured\n\\`fileoverview\\` instead of \\`file\\` on \\`tagNamePreference\\` (i.e., \\`fileoverview\\`\nwill be checked, but you must use \\`file\\` on the configuration object).`,\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n initialCommentsOnly: {\n type: 'boolean',\n },\n mustExist: {\n type: 'boolean',\n },\n preventDuplicates: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n nonComment ({\n node,\n state,\n }) {\n if (!state.hasNonComment) {\n state.hasNonComment = node.range[0];\n }\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,MAAMG,WAAW,GAAG;EAClBC,IAAI,EAAE;IACJC,mBAAmB,EAAE,IAAI;IACzBC,SAAS,EAAE,IAAI;IACfC,iBAAiB,EAAE;EACrB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAIC,KAAK,IAAK;EAC7B;EACA,IAAI,CAACA,KAAK,CAACC,UAAU,EAAE;IACrBD,KAAK,CAACC,UAAU,GAAG,IAAI;IACvBD,KAAK,CAACE,aAAa,GAAG,CAAC,CAAC;IACxBF,KAAK,CAACG,MAAM,GAAG,CAAC,CAAC;IACjBH,KAAK,CAACI,sBAAsB,GAAG,CAAC,CAAC;EACnC;AACF,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEa,IAAAc,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,SAAS;EACTT,KAAK;EACLU;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,IAAI,GAAGjB;EACT,CAAC,GAAGc,OAAO,CAACI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5Bb,WAAW,CAACC,KAAK,CAAC;EAElB,KAAK,MAAMa,OAAO,IAAIC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAAC,EAAE;IACvC,MAAMK,aAAa,GAAG,qBAAuBN,KAAK,CAACO,mBAAmB,CAAC;MACrEJ;IACF,CAAC,CAA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ClB,sDAAsDF,GAAG,CAACX,OAAO,GAAG,GACpE,sCACF,CAAC;MACH,CAAC,MAAM;QACL,MAAMG,aAAa,GACjBQ,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACG,WAAW,IAC9CH,GAAG;QACR,IAAI3B,SAAS,IAAI,CAACG,KAAK,CAACG,MAAM,CAACU,OAAO,CAAC,EAAE;UACvCH,KAAK,CAACgB,cAAc,CAAC,YAAYV,aAAa,EAAE,CAAC;QACnD;QAEA,IAAIlB,iBAAiB,IAAIE,KAAK,CAACE,aAAa,CAACW,OAAO,CAAC,EAAE;UACrDH,KAAK,CAACgB,cAAc,CAClB,cAAcV,aAAa,EAC7B,CAAC;QACH;QAEA,IAAIpB,mBAAmB,IACnBI,KAAK,CAACI,sBAAsB,CAACS,OAAO,CAAC,EACvC;UACAH,KAAK,CAACgB,cAAc,CAClB,IAAIV,aAAa,yCACnB,CAAC;QACH;MACF;IACF;EACF,CAAC;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,2GAA2G;MACxHC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVxB,IAAI,EAAE;UACJoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;UAC7DK,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVvC,mBAAmB,EAAE;kBACnByC,IAAI,EAAE;gBACR,CAAC;gBACDxC,SAAS,EAAE;kBACTwC,IAAI,EAAE;gBACR,CAAC;gBACDvC,iBAAiB,EAAE;kBACjBuC,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EACDC,UAAUA,CAAE;IACVC,IAAI;IACJvC;EACF,CAAC,EAAE;IACD,IAAI,CAACA,KAAK,CAACoB,aAAa,EAAE;MACxBpB,KAAK,CAACoB,aAAa,GAAGmB,IAAI,CAAClB,KAAK,CAAC,CAAC,CAAC;IACrC;EACF;AACF,CAAC,CAAC;AAAAmB,MAAA,CAAAlC,OAAA,GAAAA,OAAA,CAAAb,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"requireFileOverview.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","defaultTags","file","initialCommentsOnly","mustExist","preventDuplicates","setDefaults","state","globalTags","hasDuplicates","hasTag","hasNonCommentBeforeTag","_default","exports","iterateJsdoc","context","jsdocNode","utils","tags","options","tagName","Object","keys","targetTagName","getPreferredTagName","Boolean","hasDuplicate","hasNonComment","range","exit","entries","obj","getPreferredTagNameObject","reportSettings","replacement","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","patternProperties","type","nonComment","node","module"],"sources":["../../src/rules/requireFileOverview.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultTags = {\n file: {\n initialCommentsOnly: true,\n mustExist: true,\n preventDuplicates: true,\n },\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n // First iteration\n if (!state.globalTags) {\n state.globalTags = true;\n state.hasDuplicates = {};\n state.hasTag = {};\n state.hasNonCommentBeforeTag = {};\n }\n};\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n state,\n utils,\n}) => {\n const {\n tags = defaultTags,\n } = context.options[0] || {};\n\n setDefaults(state);\n\n for (const tagName of Object.keys(tags)) {\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n\n const hasTag = Boolean(targetTagName && utils.hasTag(targetTagName));\n\n state.hasTag[tagName] = hasTag || state.hasTag[tagName];\n\n const hasDuplicate = state.hasDuplicates[tagName];\n\n if (hasDuplicate === false) {\n // Was marked before, so if a tag now, is a dupe\n state.hasDuplicates[tagName] = hasTag;\n } else if (!hasDuplicate && hasTag) {\n // No dupes set before, but has first tag, so change state\n // from `undefined` to `false` so can detect next time\n state.hasDuplicates[tagName] = false;\n state.hasNonCommentBeforeTag[tagName] = state.hasNonComment &&\n state.hasNonComment < jsdocNode.range[0];\n }\n }\n}, {\n exit ({\n context,\n state,\n utils,\n }) {\n setDefaults(state);\n const {\n tags = defaultTags,\n } = context.options[0] || {};\n\n for (const [\n tagName,\n {\n initialCommentsOnly = false,\n mustExist = false,\n preventDuplicates = false,\n },\n ] of Object.entries(tags)) {\n const obj = utils.getPreferredTagNameObject({\n tagName,\n });\n if (obj && typeof obj === 'object' && 'blocked' in obj) {\n utils.reportSettings(\n `\\`settings.jsdoc.tagNamePreference\\` cannot block @${obj.tagName} ` +\n 'for the `require-file-overview` rule',\n );\n } else {\n const targetTagName = (\n obj && typeof obj === 'object' && obj.replacement\n ) || obj;\n if (mustExist && !state.hasTag[tagName]) {\n utils.reportSettings(`Missing @${targetTagName}`);\n }\n\n if (preventDuplicates && state.hasDuplicates[tagName]) {\n utils.reportSettings(\n `Duplicate @${targetTagName}`,\n );\n }\n\n if (initialCommentsOnly &&\n state.hasNonCommentBeforeTag[tagName]\n ) {\n utils.reportSettings(\n `@${targetTagName} should be at the beginning of the file`,\n );\n }\n }\n }\n },\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks that all files have one `@file`, `@fileoverview`, or `@overview` tag at the beginning of the file.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-file-overview.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `The keys of this object are tag names, and the values are configuration\nobjects indicating what will be checked for these whole-file tags.\n\nEach configuration object has 3 potential boolean keys (which default\nto \\`false\\` when this option is supplied).\n\n1. \\`mustExist\\` - enforces that all files have a \\`@file\\`, \\`@fileoverview\\`, or \\`@overview\\` tag.\n2. \\`preventDuplicates\\` - enforces that duplicate file overview tags within a given file will be reported\n3. \\`initialCommentsOnly\\` - reports file overview tags which are not, as per\n [the docs](https://jsdoc.app/tags-file.html), \"at the beginning of\n the file\"–where beginning of the file is interpreted in this rule\n as being when the overview tag is not preceded by anything other than\n a comment.\n\nWhen no \\`tags\\` is present, the default is:\n\n\\`\\`\\`json\n{\n \"file\": {\n \"initialCommentsOnly\": true,\n \"mustExist\": true,\n \"preventDuplicates\": true,\n }\n}\n\\`\\`\\`\n\nYou can add additional tag names and/or override \\`file\\` if you supply this\noption, e.g., in place of or in addition to \\`file\\`, giving other potential\nfile global tags like \\`@license\\`, \\`@copyright\\`, \\`@author\\`, \\`@module\\` or\n\\`@exports\\`, optionally restricting them to a single use or preventing them\nfrom being preceded by anything besides comments.\n\nFor example:\n\n\\`\\`\\`js\n{\n \"license\": {\n \"mustExist\": true,\n \"preventDuplicates\": true,\n }\n}\n\\`\\`\\`\n\nThis would require one and only one \\`@license\\` in the file, though because\n\\`initialCommentsOnly\\` is absent and defaults to \\`false\\`, the \\`@license\\`\ncan be anywhere.\n\nIn the case of \\`@license\\`, you can use this rule along with the\n\\`check-values\\` rule (with its \\`allowedLicenses\\` or \\`licensePattern\\` options),\nto enforce a license whitelist be present on every JS file.\n\nNote that if you choose to use \\`preventDuplicates\\` with \\`license\\`, you still\nhave a way to allow multiple licenses for the whole page by using the SPDX\n\"AND\" expression, e.g., \\`@license (MIT AND GPL-3.0)\\`.\n\nNote that the tag names are the main JSDoc tag name, so you should use \\`file\\`\nin this configuration object regardless of whether you have configured\n\\`fileoverview\\` instead of \\`file\\` on \\`tagNamePreference\\` (i.e., \\`fileoverview\\`\nwill be checked, but you must use \\`file\\` on the configuration object).`,\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n initialCommentsOnly: {\n type: 'boolean',\n },\n mustExist: {\n type: 'boolean',\n },\n preventDuplicates: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n nonComment ({\n node,\n state,\n }) {\n if (!state.hasNonComment) {\n state.hasNonComment = /** @type {[number, number]} */ (node.range)?.[0];\n }\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,MAAMG,WAAW,GAAG;EAClBC,IAAI,EAAE;IACJC,mBAAmB,EAAE,IAAI;IACzBC,SAAS,EAAE,IAAI;IACfC,iBAAiB,EAAE;EACrB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAIC,KAAK,IAAK;EAC7B;EACA,IAAI,CAACA,KAAK,CAACC,UAAU,EAAE;IACrBD,KAAK,CAACC,UAAU,GAAG,IAAI;IACvBD,KAAK,CAACE,aAAa,GAAG,CAAC,CAAC;IACxBF,KAAK,CAACG,MAAM,GAAG,CAAC,CAAC;IACjBH,KAAK,CAACI,sBAAsB,GAAG,CAAC,CAAC;EACnC;AACF,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEa,IAAAc,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,SAAS;EACTT,KAAK;EACLU;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,IAAI,GAAGjB;EACT,CAAC,GAAGc,OAAO,CAACI,OAAO,CAAC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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;UAC7DK,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVvC,mBAAmB,EAAE;kBACnByC,IAAI,EAAE;gBACR,CAAC;gBACDxC,SAAS,EAAE;kBACTwC,IAAI,EAAE;gBACR,CAAC;gBACDvC,iBAAiB,EAAE;kBACjBuC,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EACDC,UAAUA,CAAE;IACVC,IAAI;IACJvC;EACF,CAAC,EAAE;IACD,IAAI,CAACA,KAAK,CAACoB,aAAa,EAAE;MACxBpB,KAAK,CAACoB,aAAa,GAAG,+BAAiCmB,IAAI,CAAClB,KAAK,GAAI,CAAC,CAAC;IACzE;EACF;AACF,CAAC,CAAC;AAAAmB,MAAA,CAAAlC,OAAA,GAAAA,OAAA,CAAAb,OAAA","ignoreList":[]}
|
|
@@ -548,6 +548,7 @@ var _default = exports.default = {
|
|
|
548
548
|
/** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */
|
|
549
549
|
let baseNode = (0, _jsdoccomment.getReducedASTNode)(node, sourceCode);
|
|
550
550
|
const decorator = (0, _jsdoccomment.getDecorator)(/** @type {import('eslint').Rule.Node} */
|
|
551
|
+
// @ts-expect-error Bug?
|
|
551
552
|
baseNode);
|
|
552
553
|
if (decorator) {
|
|
553
554
|
baseNode = decorator;
|
|
@@ -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 (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;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAMG,cAAc,GAAG;EACrBC,oBAAoB,EAAE,KAAK;EAC3BC,WAAW,EAAE,oCAAoC;EACjDC,UAAU,EAAE;IACVC,iBAAiB,EAAE;MACjBL,OAAO,EAAE,IAAI;MACbG,WAAW,EA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EAAE,0BAA0B,EAAE,oBAAoB,CACzE,CAACG,QAAQ,CAAChG,IAAI,CAACP,MAAM,CAACtC,IAAI,CAAC,IAC5B,CACE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,oBAAoB,CACpE,CAAC6I,QAAQ,CAAChG,IAAI,CAACP,MAAM,CAACtC,IAAI,CAAC,IAC1B6C,IAAI;QACF;AACd;AACA;AACA;AACA;QACeA,IAAI,CAACP,MAAM,CAAEwG,KAAK,EACvB;UACA5D,UAAU,CAAC;YACTqB,iBAAiB,EAAE;UACrB,CAAC,EAAE,IAAI,EAAE1D,IAAI,CAAC;QAChB;MACF,CAAC;MAEDnB,gBAAgBA,CAAEmB,IAAI,EAAE;QACtB,IAAI,CAAC6F,SAAS,CAAC,kBAAkB,CAAC,EAAE;UAClC;QACF;QAEAxD,UAAU,CAAC;UACTqB,iBAAiB,EAAE,IAAI;UACvBR,QAAQ,EAAE;QACZ,CAAC,EAAE,IAAI,EAAE,yCAA2ClD,IAAI,CAACiG,KAAM,CAAC;MAClE;IACF,CAAC;EACH,CAAC;EACDC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,QAAQ,EAAE,kBAAkB;MAC5BpJ,WAAW,EAAE,qHAAqH;MAClIqJ,WAAW,EAAE,IAAI;MACjBC,GAAG,EAAE;IACP,CAAC;IAEDC,OAAO,EAAE,MAAM;IAEfC,QAAQ,EAAE;MACRC,YAAY,EAAE;IAChB,CAAC;IAEDC,MAAM,EAAE,CACN5J,cAAc,CACf;IAEDK,IAAI,EAAE;EACR;AACF,CAAC;AAAAwJ,MAAA,CAAA5E,OAAA,GAAAA,OAAA,CAAAlF,OAAA","ignoreList":[]}
|
|
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;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAMG,cAAc,GAAG;EACrBC,oBAAoB,EAAE,KAAK;EAC3BC,WAAW,EAAE,oCAAoC;EACjDC,UAAU,EAAE;IACVC,iBAAiB,EAAE;MACjBL,OAAO,EAAE,IAAI;MACbG,WAAW,EAAE;AACnB;AACA,0CAA0C;MACpCG,IAAI,EAAE;IACR,CAAC;IACDC,YA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AAI,CAACP,MAAM,CAACtC,IAAI,CAAC,IAC5B,CACE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,oBAAoB,CACpE,CAAC6I,QAAQ,CAAChG,IAAI,CAACP,MAAM,CAACtC,IAAI,CAAC,IAC1B6C,IAAI;QACF;AACd;AACA;AACA;AACA;QACeA,IAAI,CAACP,MAAM,CAAEwG,KAAK,EACvB;UACA5D,UAAU,CAAC;YACTqB,iBAAiB,EAAE;UACrB,CAAC,EAAE,IAAI,EAAE1D,IAAI,CAAC;QAChB;MACF,CAAC;MAEDnB,gBAAgBA,CAAEmB,IAAI,EAAE;QACtB,IAAI,CAAC6F,SAAS,CAAC,kBAAkB,CAAC,EAAE;UAClC;QACF;QAEAxD,UAAU,CAAC;UACTqB,iBAAiB,EAAE,IAAI;UACvBR,QAAQ,EAAE;QACZ,CAAC,EAAE,IAAI,EAAE,yCAA2ClD,IAAI,CAACiG,KAAM,CAAC;MAClE;IACF,CAAC;EACH,CAAC;EACDC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,QAAQ,EAAE,kBAAkB;MAC5BpJ,WAAW,EAAE,qHAAqH;MAClIqJ,WAAW,EAAE,IAAI;MACjBC,GAAG,EAAE;IACP,CAAC;IAEDC,OAAO,EAAE,MAAM;IAEfC,QAAQ,EAAE;MACRC,YAAY,EAAE;IAChB,CAAC;IAEDC,MAAM,EAAE,CACN5J,cAAc,CACf;IAEDK,IAAI,EAAE;EACR;AACF,CAAC;AAAAwJ,MAAA,CAAA5E,OAAA,GAAAA,OAAA,CAAAlF,OAAA","ignoreList":[]}
|
|
@@ -66,7 +66,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
66
66
|
if (node && 'params' in node && node.params.length === 1 && node.params?.[0] && typeof node.params[0] === 'object' && node.params[0].type === 'ObjectPattern' && 'typeAnnotation' in node.params[0] && node.params[0].typeAnnotation) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
if (node && node.parent
|
|
69
|
+
if (node && node.parent?.type === 'VariableDeclarator' && 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -163,26 +163,35 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
163
163
|
* }}
|
|
164
164
|
*/
|
|
165
165
|
const findExpectedIndex = (jsdocTags, indexAtFunctionParams) => {
|
|
166
|
-
|
|
166
|
+
// Get the parameters that come after the current index in the flattened order
|
|
167
|
+
const remainingFlattenedRoots = flattenedRoots.slice((indexAtFunctionParams || 0) + 1);
|
|
168
|
+
|
|
169
|
+
// Find the first existing tag that comes after the current parameter in the flattened order
|
|
167
170
|
const foundIndex = jsdocTags.findIndex(({
|
|
168
171
|
name,
|
|
169
172
|
newAdd
|
|
170
173
|
}) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
if (newAdd) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Check if the tag name matches any of the remaining flattened roots
|
|
179
|
+
return remainingFlattenedRoots.some(flattenedRoot => {
|
|
180
|
+
// The flattened roots don't have the root prefix (e.g., "bar", "bar.baz")
|
|
181
|
+
// but JSDoc tags do (e.g., "root0", "root0.bar", "root0.bar.baz")
|
|
182
|
+
// So we need to check if the tag name ends with the flattened root
|
|
183
|
+
|
|
184
|
+
// Check if tag name ends with ".<flattenedRoot>"
|
|
185
|
+
if (name.endsWith(`.${flattenedRoot}`)) {
|
|
186
|
+
return true;
|
|
181
187
|
}
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
|
|
189
|
+
// Also check if tag name exactly matches the flattenedRoot
|
|
190
|
+
// (for single-level params)
|
|
191
|
+
if (name === flattenedRoot) {
|
|
192
|
+
return true;
|
|
184
193
|
}
|
|
185
|
-
return
|
|
194
|
+
return false;
|
|
186
195
|
});
|
|
187
196
|
});
|
|
188
197
|
const tags = foundIndex > -1 ? jsdocTags.slice(0, foundIndex) : jsdocTags.filter(({
|