eslint-plugin-jsdoc 62.0.1 → 62.2.0
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.
|
@@ -188,11 +188,71 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
188
188
|
return result;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Recursively extracts types from a namespace declaration.
|
|
193
|
+
* @param {string} prefix - The namespace prefix (e.g., "MyNamespace" or "Outer.Inner").
|
|
194
|
+
* @param {import('@typescript-eslint/types').TSESTree.TSModuleDeclaration} moduleDeclaration - The module declaration node.
|
|
195
|
+
* @returns {string[]} Array of fully qualified type names.
|
|
196
|
+
*/
|
|
197
|
+
const getNamespaceTypes = (prefix, moduleDeclaration) => {
|
|
198
|
+
/* c8 ignore next 3 -- Guard for ambient modules without body. */
|
|
199
|
+
if (!moduleDeclaration.body || moduleDeclaration.body.type !== 'TSModuleBlock') {
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
return moduleDeclaration.body.body.flatMap(item => {
|
|
203
|
+
/** @type {import('@typescript-eslint/types').TSESTree.ProgramStatement | import('@typescript-eslint/types').TSESTree.NamedExportDeclarations | null} */
|
|
204
|
+
let declaration = item;
|
|
205
|
+
if (item.type === 'ExportNamedDeclaration' && item.declaration) {
|
|
206
|
+
declaration = item.declaration;
|
|
207
|
+
}
|
|
208
|
+
if (declaration.type === 'TSTypeAliasDeclaration' || declaration.type === 'ClassDeclaration') {
|
|
209
|
+
/* c8 ignore next 4 -- Guard for anonymous class declarations. */
|
|
210
|
+
if (!declaration.id) {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
return [`${prefix}.${declaration.id.name}`];
|
|
214
|
+
}
|
|
215
|
+
if (declaration.type === 'TSInterfaceDeclaration') {
|
|
216
|
+
return [`${prefix}.${declaration.id.name}`, ...declaration.body.body.map(prop => {
|
|
217
|
+
// Only `TSPropertySignature` and `TSMethodSignature` have 'key'.
|
|
218
|
+
if (prop.type !== 'TSPropertySignature' && prop.type !== 'TSMethodSignature') {
|
|
219
|
+
return '';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Key can be computed or a literal, only handle Identifier.
|
|
223
|
+
if (prop.key.type !== 'Identifier') {
|
|
224
|
+
return '';
|
|
225
|
+
}
|
|
226
|
+
const propName = prop.key.name;
|
|
227
|
+
/* c8 ignore next -- `propName` is always truthy for Identifiers. */
|
|
228
|
+
return propName ? `${prefix}.${declaration.id.name}.${propName}` : '';
|
|
229
|
+
}).filter(Boolean)];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Handle nested namespaces.
|
|
233
|
+
if (declaration.type === 'TSModuleDeclaration') {
|
|
234
|
+
/* c8 ignore next -- Nested string-literal modules aren't valid TS syntax. */
|
|
235
|
+
const nestedName = declaration.id?.type === 'Identifier' ? declaration.id.name : '';
|
|
236
|
+
/* c8 ignore next 3 -- Guard. */
|
|
237
|
+
if (!nestedName) {
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
return [`${prefix}.${nestedName}`, ...getNamespaceTypes(`${prefix}.${nestedName}`, declaration)];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Fallback for unhandled declaration types (e.g., TSEnumDeclaration, FunctionDeclaration, etc.).
|
|
244
|
+
return [];
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
|
|
191
248
|
/**
|
|
192
249
|
* We treat imports differently as we can't introspect their children.
|
|
193
250
|
* @type {string[]}
|
|
194
251
|
*/
|
|
195
252
|
const imports = [];
|
|
253
|
+
|
|
254
|
+
/** @type {Set<string>} */
|
|
255
|
+
const closedTypes = new Set();
|
|
196
256
|
const allDefinedTypes = new Set(globalScope.variables.map(({
|
|
197
257
|
name
|
|
198
258
|
}) => {
|
|
@@ -211,6 +271,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
211
271
|
const globalItem = /** @type {import('estree').Identifier & {parent: import('@typescript-eslint/types').TSESTree.Node}} */identifiers?.[0]?.parent;
|
|
212
272
|
switch (globalItem?.type) {
|
|
213
273
|
case 'ClassDeclaration':
|
|
274
|
+
closedTypes.add(name);
|
|
214
275
|
return [name, ...globalItem.body.body.map(item => {
|
|
215
276
|
const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */(/** @type {import('@typescript-eslint/types').TSESTree.PropertyDefinition} */item?.key)?.name;
|
|
216
277
|
/* c8 ignore next 3 -- Guard */
|
|
@@ -233,6 +294,9 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
233
294
|
}
|
|
234
295
|
return `${name}.${property}`;
|
|
235
296
|
}).filter(Boolean)];
|
|
297
|
+
case 'TSModuleDeclaration':
|
|
298
|
+
closedTypes.add(name);
|
|
299
|
+
return [name, ...getNamespaceTypes(name, globalItem)];
|
|
236
300
|
case 'VariableDeclarator':
|
|
237
301
|
if (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */(/** @type {import('@typescript-eslint/types').TSESTree.CallExpression} */globalItem?.init?.callee)?.name === 'require') {
|
|
238
302
|
imports.push(/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */globalItem.id.name);
|
|
@@ -266,6 +330,15 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
266
330
|
}).filter(Boolean);
|
|
267
331
|
}
|
|
268
332
|
return [];
|
|
333
|
+
})()).concat((() => {
|
|
334
|
+
// Detect static property assignments like `MyClass.Prop = ...`
|
|
335
|
+
const programBody = /** @type {import('@typescript-eslint/types').TSESTree.Program} */sourceCode.ast.body;
|
|
336
|
+
return programBody.flatMap(statement => {
|
|
337
|
+
if (statement.type === 'ExpressionStatement' && statement.expression.type === 'AssignmentExpression' && statement.expression.left.type === 'MemberExpression' && statement.expression.left.object.type === 'Identifier' && statement.expression.left.property.type === 'Identifier' && closedTypes.has(statement.expression.left.object.name)) {
|
|
338
|
+
return [`${statement.expression.left.object.name}.${statement.expression.left.property.name}`];
|
|
339
|
+
}
|
|
340
|
+
return [];
|
|
341
|
+
});
|
|
269
342
|
})()).concat(...getValidRuntimeIdentifiers(node && (sourceCode.getScope && /* c8 ignore next 3 */
|
|
270
343
|
sourceCode.getScope(node) ||
|
|
271
344
|
// @ts-expect-error ESLint 8
|
|
@@ -369,7 +442,9 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
369
442
|
} while (currNode?.type === 'JsdocTypeNamePath');
|
|
370
443
|
if (type === 'JsdocTypeName') {
|
|
371
444
|
const structuredTypes = structuredTags[tag.tag]?.type;
|
|
372
|
-
|
|
445
|
+
const rootNamespace = val.split('.')[0];
|
|
446
|
+
const isNamespaceValid = (definedTypes.includes(rootNamespace) || allDefinedTypes.has(rootNamespace)) && !closedTypes.has(rootNamespace);
|
|
447
|
+
if (!allDefinedTypes.has(val) && !definedNamesAndNamepaths.has(val) && (!Array.isArray(structuredTypes) || !structuredTypes.includes(val)) && !isNamespaceValid) {
|
|
373
448
|
const parent =
|
|
374
449
|
/**
|
|
375
450
|
* @type {import('jsdoc-type-pratt-parser').RootResult & {
|
|
@@ -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","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,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAA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UACvEE,OAAO,EAAE;QACX,CAAC,CAAC;MACJ;IACF;EACF,CAAC;EACDC,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJnF,WAAW,EAAE,0GAA0G;MACvHoF,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVjI,iBAAiB,EAAE;UACjB0C,WAAW,EAAE,mDAAmD;UAChEC,IAAI,EAAE;QACR,CAAC;QACD1C,YAAY,EAAE;UACZyC,WAAW,EAAE;AACzB;AACA,4BAA4B;UAChBwF,KAAK,EAAE;YACLvF,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDzC,gBAAgB,EAAE;UAChBwC,WAAW,EAAE;AACzB;AACA,6DAA6D;UACjDC,IAAI,EAAE;QACR,CAAC;QACDxC,mBAAmB,EAAE;UACnBuC,WAAW,EAAE;AACzB;AACA;AACA,qCAAqC;UACzBC,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAwF,MAAA,CAAA/I,OAAA,GAAAA,OAAA,CAAAhB,OAAA","ignoreList":[]}
|
|
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","getNamespaceTypes","prefix","moduleDeclaration","body","item","declaration","id","prop","key","propName","nestedName","imports","closedTypes","allDefinedTypes","identifiers","globalItem","property","init","callee","methodOrProp","programBody","ast","statement","expression","left","object","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","rootNamespace","isNamespaceValid","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 * Recursively extracts types from a namespace declaration.\n * @param {string} prefix - The namespace prefix (e.g., \"MyNamespace\" or \"Outer.Inner\").\n * @param {import('@typescript-eslint/types').TSESTree.TSModuleDeclaration} moduleDeclaration - The module declaration node.\n * @returns {string[]} Array of fully qualified type names.\n */\n const getNamespaceTypes = (prefix, moduleDeclaration) => {\n /* c8 ignore next 3 -- Guard for ambient modules without body. */\n if (!moduleDeclaration.body || moduleDeclaration.body.type !== 'TSModuleBlock') {\n return [];\n }\n\n return moduleDeclaration.body.body.flatMap((item) => {\n /** @type {import('@typescript-eslint/types').TSESTree.ProgramStatement | import('@typescript-eslint/types').TSESTree.NamedExportDeclarations | null} */\n let declaration = item;\n\n if (item.type === 'ExportNamedDeclaration' && item.declaration) {\n declaration = item.declaration;\n }\n\n if (declaration.type === 'TSTypeAliasDeclaration' || declaration.type === 'ClassDeclaration') {\n /* c8 ignore next 4 -- Guard for anonymous class declarations. */\n if (!declaration.id) {\n return [];\n }\n\n return [\n `${prefix}.${declaration.id.name}`,\n ];\n }\n\n if (declaration.type === 'TSInterfaceDeclaration') {\n return [\n `${prefix}.${declaration.id.name}`,\n ...declaration.body.body.map((prop) => {\n // Only `TSPropertySignature` and `TSMethodSignature` have 'key'.\n if (prop.type !== 'TSPropertySignature' && prop.type !== 'TSMethodSignature') {\n return '';\n }\n\n // Key can be computed or a literal, only handle Identifier.\n if (prop.key.type !== 'Identifier') {\n return '';\n }\n\n const propName = prop.key.name;\n /* c8 ignore next -- `propName` is always truthy for Identifiers. */\n return propName ? `${prefix}.${declaration.id.name}.${propName}` : '';\n }).filter(Boolean),\n ];\n }\n\n // Handle nested namespaces.\n if (declaration.type === 'TSModuleDeclaration') {\n /* c8 ignore next -- Nested string-literal modules aren't valid TS syntax. */\n const nestedName = declaration.id?.type === 'Identifier' ? declaration.id.name : '';\n /* c8 ignore next 3 -- Guard. */\n if (!nestedName) {\n return [];\n }\n\n return [\n `${prefix}.${nestedName}`,\n ...getNamespaceTypes(`${prefix}.${nestedName}`, declaration),\n ];\n }\n\n // Fallback for unhandled declaration types (e.g., TSEnumDeclaration, FunctionDeclaration, etc.).\n return [];\n });\n };\n\n /**\n * We treat imports differently as we can't introspect their children.\n * @type {string[]}\n */\n const imports = [];\n\n /** @type {Set<string>} */\n const closedTypes = new Set();\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 closedTypes.add(name);\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 'TSModuleDeclaration':\n closedTypes.add(name);\n return [\n name,\n ...getNamespaceTypes(name, globalItem),\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((() => {\n // Detect static property assignments like `MyClass.Prop = ...`\n const programBody = /** @type {import('@typescript-eslint/types').TSESTree.Program} */ (\n sourceCode.ast\n ).body;\n\n return programBody.flatMap((statement) => {\n if (\n statement.type === 'ExpressionStatement' &&\n statement.expression.type === 'AssignmentExpression' &&\n statement.expression.left.type === 'MemberExpression' &&\n statement.expression.left.object.type === 'Identifier' &&\n statement.expression.left.property.type === 'Identifier' &&\n closedTypes.has(statement.expression.left.object.name)\n ) {\n return [\n `${statement.expression.left.object.name}.${statement.expression.left.property.name}`,\n ];\n }\n\n return [];\n });\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 const rootNamespace = val.split('.')[0];\n const isNamespaceValid = (definedTypes.includes(rootNamespace) || allDefinedTypes.has(rootNamespace)) &&\n !closedTypes.has(rootNamespace);\n\n if (!allDefinedTypes.has(val) &&\n !definedNamesAndNamepaths.has(val) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(val)) && !isNamespaceValid\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,SA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|
|
|
5
5
|
"url": "http://gajus.com"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@es-joy/jsdoccomment": "~0.
|
|
8
|
+
"@es-joy/jsdoccomment": "~0.81.0",
|
|
9
9
|
"@es-joy/resolve.exports": "1.2.0",
|
|
10
10
|
"are-docs-informative": "^0.0.2",
|
|
11
|
-
"comment-parser": "1.4.
|
|
11
|
+
"comment-parser": "1.4.4",
|
|
12
12
|
"debug": "^4.4.3",
|
|
13
13
|
"escape-string-regexp": "^4.0.0",
|
|
14
14
|
"espree": "^11.0.0",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"description": "JSDoc linting rules for ESLint.",
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
26
|
-
"@babel/cli": "^7.28.
|
|
27
|
-
"@babel/core": "^7.28.
|
|
28
|
-
"@babel/eslint-parser": "^7.28.
|
|
26
|
+
"@babel/cli": "^7.28.6",
|
|
27
|
+
"@babel/core": "^7.28.6",
|
|
28
|
+
"@babel/eslint-parser": "^7.28.6",
|
|
29
29
|
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
|
30
30
|
"@babel/plugin-transform-flow-strip-types": "^7.27.1",
|
|
31
|
-
"@babel/preset-env": "^7.28.
|
|
31
|
+
"@babel/preset-env": "^7.28.6",
|
|
32
32
|
"@es-joy/escodegen": "^4.2.0",
|
|
33
33
|
"@es-joy/jsdoc-eslint-parser": "^0.27.0",
|
|
34
|
-
"@eslint/core": "^1.0.
|
|
34
|
+
"@eslint/core": "^1.0.1",
|
|
35
35
|
"@hkdobrev/run-if-changed": "^0.6.3",
|
|
36
36
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
37
37
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@types/estree": "^1.0.8",
|
|
45
45
|
"@types/json-schema": "^7.0.15",
|
|
46
46
|
"@types/mocha": "^10.0.10",
|
|
47
|
-
"@types/node": "^25.0.
|
|
47
|
+
"@types/node": "^25.0.9",
|
|
48
48
|
"@types/semver": "^7.7.1",
|
|
49
49
|
"@types/spdx-expression-parse": "^3.0.5",
|
|
50
|
-
"@typescript-eslint/types": "^8.
|
|
50
|
+
"@typescript-eslint/types": "^8.53.0",
|
|
51
51
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
52
52
|
"babel-plugin-istanbul": "^7.0.1",
|
|
53
53
|
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"chai": "^6.2.2",
|
|
57
57
|
"decamelize": "^6.0.1",
|
|
58
58
|
"eslint": "9.39.2",
|
|
59
|
-
"eslint-config-canonical": "^47.3.
|
|
59
|
+
"eslint-config-canonical": "^47.3.8",
|
|
60
60
|
"gitdown": "^4.1.1",
|
|
61
61
|
"glob": "^13.0.0",
|
|
62
62
|
"globals": "^17.0.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"sinon": "^21.0.1",
|
|
76
76
|
"ts-api-utils": "^2.4.0",
|
|
77
77
|
"typescript": "5.9.3",
|
|
78
|
-
"typescript-eslint": "^8.
|
|
78
|
+
"typescript-eslint": "^8.53.0"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
"test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
|
|
193
193
|
"test-index": "pnpm run test-no-cov test/rules/index.js"
|
|
194
194
|
},
|
|
195
|
-
"version": "62.0
|
|
195
|
+
"version": "62.2.0"
|
|
196
196
|
}
|
|
@@ -268,12 +268,87 @@ export default iterateJsdoc(({
|
|
|
268
268
|
return result;
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Recursively extracts types from a namespace declaration.
|
|
273
|
+
* @param {string} prefix - The namespace prefix (e.g., "MyNamespace" or "Outer.Inner").
|
|
274
|
+
* @param {import('@typescript-eslint/types').TSESTree.TSModuleDeclaration} moduleDeclaration - The module declaration node.
|
|
275
|
+
* @returns {string[]} Array of fully qualified type names.
|
|
276
|
+
*/
|
|
277
|
+
const getNamespaceTypes = (prefix, moduleDeclaration) => {
|
|
278
|
+
/* c8 ignore next 3 -- Guard for ambient modules without body. */
|
|
279
|
+
if (!moduleDeclaration.body || moduleDeclaration.body.type !== 'TSModuleBlock') {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return moduleDeclaration.body.body.flatMap((item) => {
|
|
284
|
+
/** @type {import('@typescript-eslint/types').TSESTree.ProgramStatement | import('@typescript-eslint/types').TSESTree.NamedExportDeclarations | null} */
|
|
285
|
+
let declaration = item;
|
|
286
|
+
|
|
287
|
+
if (item.type === 'ExportNamedDeclaration' && item.declaration) {
|
|
288
|
+
declaration = item.declaration;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (declaration.type === 'TSTypeAliasDeclaration' || declaration.type === 'ClassDeclaration') {
|
|
292
|
+
/* c8 ignore next 4 -- Guard for anonymous class declarations. */
|
|
293
|
+
if (!declaration.id) {
|
|
294
|
+
return [];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return [
|
|
298
|
+
`${prefix}.${declaration.id.name}`,
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (declaration.type === 'TSInterfaceDeclaration') {
|
|
303
|
+
return [
|
|
304
|
+
`${prefix}.${declaration.id.name}`,
|
|
305
|
+
...declaration.body.body.map((prop) => {
|
|
306
|
+
// Only `TSPropertySignature` and `TSMethodSignature` have 'key'.
|
|
307
|
+
if (prop.type !== 'TSPropertySignature' && prop.type !== 'TSMethodSignature') {
|
|
308
|
+
return '';
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Key can be computed or a literal, only handle Identifier.
|
|
312
|
+
if (prop.key.type !== 'Identifier') {
|
|
313
|
+
return '';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const propName = prop.key.name;
|
|
317
|
+
/* c8 ignore next -- `propName` is always truthy for Identifiers. */
|
|
318
|
+
return propName ? `${prefix}.${declaration.id.name}.${propName}` : '';
|
|
319
|
+
}).filter(Boolean),
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Handle nested namespaces.
|
|
324
|
+
if (declaration.type === 'TSModuleDeclaration') {
|
|
325
|
+
/* c8 ignore next -- Nested string-literal modules aren't valid TS syntax. */
|
|
326
|
+
const nestedName = declaration.id?.type === 'Identifier' ? declaration.id.name : '';
|
|
327
|
+
/* c8 ignore next 3 -- Guard. */
|
|
328
|
+
if (!nestedName) {
|
|
329
|
+
return [];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return [
|
|
333
|
+
`${prefix}.${nestedName}`,
|
|
334
|
+
...getNamespaceTypes(`${prefix}.${nestedName}`, declaration),
|
|
335
|
+
];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Fallback for unhandled declaration types (e.g., TSEnumDeclaration, FunctionDeclaration, etc.).
|
|
339
|
+
return [];
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
|
|
271
343
|
/**
|
|
272
344
|
* We treat imports differently as we can't introspect their children.
|
|
273
345
|
* @type {string[]}
|
|
274
346
|
*/
|
|
275
347
|
const imports = [];
|
|
276
348
|
|
|
349
|
+
/** @type {Set<string>} */
|
|
350
|
+
const closedTypes = new Set();
|
|
351
|
+
|
|
277
352
|
const allDefinedTypes = new Set(globalScope.variables.map(({
|
|
278
353
|
name,
|
|
279
354
|
}) => {
|
|
@@ -296,6 +371,7 @@ export default iterateJsdoc(({
|
|
|
296
371
|
)?.parent;
|
|
297
372
|
switch (globalItem?.type) {
|
|
298
373
|
case 'ClassDeclaration':
|
|
374
|
+
closedTypes.add(name);
|
|
299
375
|
return [
|
|
300
376
|
name,
|
|
301
377
|
...globalItem.body.body.map((item) => {
|
|
@@ -330,6 +406,12 @@ export default iterateJsdoc(({
|
|
|
330
406
|
return `${name}.${property}`;
|
|
331
407
|
}).filter(Boolean),
|
|
332
408
|
];
|
|
409
|
+
case 'TSModuleDeclaration':
|
|
410
|
+
closedTypes.add(name);
|
|
411
|
+
return [
|
|
412
|
+
name,
|
|
413
|
+
...getNamespaceTypes(name, globalItem),
|
|
414
|
+
];
|
|
333
415
|
case 'VariableDeclarator':
|
|
334
416
|
if (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
|
|
335
417
|
/** @type {import('@typescript-eslint/types').TSESTree.CallExpression} */ (
|
|
@@ -394,6 +476,29 @@ export default iterateJsdoc(({
|
|
|
394
476
|
|
|
395
477
|
return [];
|
|
396
478
|
})())
|
|
479
|
+
.concat((() => {
|
|
480
|
+
// Detect static property assignments like `MyClass.Prop = ...`
|
|
481
|
+
const programBody = /** @type {import('@typescript-eslint/types').TSESTree.Program} */ (
|
|
482
|
+
sourceCode.ast
|
|
483
|
+
).body;
|
|
484
|
+
|
|
485
|
+
return programBody.flatMap((statement) => {
|
|
486
|
+
if (
|
|
487
|
+
statement.type === 'ExpressionStatement' &&
|
|
488
|
+
statement.expression.type === 'AssignmentExpression' &&
|
|
489
|
+
statement.expression.left.type === 'MemberExpression' &&
|
|
490
|
+
statement.expression.left.object.type === 'Identifier' &&
|
|
491
|
+
statement.expression.left.property.type === 'Identifier' &&
|
|
492
|
+
closedTypes.has(statement.expression.left.object.name)
|
|
493
|
+
) {
|
|
494
|
+
return [
|
|
495
|
+
`${statement.expression.left.object.name}.${statement.expression.left.property.name}`,
|
|
496
|
+
];
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return [];
|
|
500
|
+
});
|
|
501
|
+
})())
|
|
397
502
|
.concat(...getValidRuntimeIdentifiers(node && (
|
|
398
503
|
(sourceCode.getScope &&
|
|
399
504
|
/* c8 ignore next 3 */
|
|
@@ -529,9 +634,13 @@ export default iterateJsdoc(({
|
|
|
529
634
|
|
|
530
635
|
if (type === 'JsdocTypeName') {
|
|
531
636
|
const structuredTypes = structuredTags[tag.tag]?.type;
|
|
637
|
+
const rootNamespace = val.split('.')[0];
|
|
638
|
+
const isNamespaceValid = (definedTypes.includes(rootNamespace) || allDefinedTypes.has(rootNamespace)) &&
|
|
639
|
+
!closedTypes.has(rootNamespace);
|
|
640
|
+
|
|
532
641
|
if (!allDefinedTypes.has(val) &&
|
|
533
642
|
!definedNamesAndNamepaths.has(val) &&
|
|
534
|
-
(!Array.isArray(structuredTypes) || !structuredTypes.includes(val))
|
|
643
|
+
(!Array.isArray(structuredTypes) || !structuredTypes.includes(val)) && !isNamespaceValid
|
|
535
644
|
) {
|
|
536
645
|
const parent =
|
|
537
646
|
/**
|