@@ -482,6 +482,14 @@ export default iterateJsdoc(({
482482 . concat ( tsModuleVariables )
483483 . concat ( /** @type {string[] } */ ( definedPreferredTypes ) )
484484 . concat ( ( ( ) => {
485+ let nodeToCheck = node ;
486+ if ( node ?. type === 'ExportNamedDeclaration' || node ?. type === 'ExportDefaultDeclaration' ) {
487+ nodeToCheck = /** @type {import('estree').ClassDeclaration & import('eslint').Rule.NodeParentExtension } */ (
488+ /** @type {import('estree').ExportNamedDeclaration & import('eslint').Rule.NodeParentExtension } */
489+ ( nodeToCheck ) ?. declaration
490+ ) ?? null ;
491+ }
492+
485493 // Other class members are not in scope, but we need them (e.g., for a
486494 // sibling property or method referenced by `{@link }`, or a member
487495 // referenced by `{@link }` from the class's own JSDoc block), and we
@@ -490,14 +498,14 @@ export default iterateJsdoc(({
490498 let classBody ;
491499 /** @type {string|undefined } */
492500 let className ;
493- if ( node ?. type === 'MethodDefinition' || node ?. type === 'PropertyDefinition' ) {
494- classBody = /** @type {import('estree').ClassBody } */ ( node . parent ) ;
501+ if ( nodeToCheck ?. type === 'MethodDefinition' || nodeToCheck ?. type === 'PropertyDefinition' ) {
502+ classBody = /** @type {import('estree').ClassBody } */ ( nodeToCheck . parent ) ;
495503 className = /** @type {import('estree').ClassDeclaration } */ (
496- node . parent ?. parent
504+ nodeToCheck . parent ?. parent
497505 ) ?. id ?. name ;
498- } else if ( node ?. type === 'ClassDeclaration' || node ?. type === 'ClassExpression' ) {
499- classBody = node . body ;
500- className = node . id ?. name ;
506+ } else if ( nodeToCheck ?. type === 'ClassDeclaration' || nodeToCheck ?. type === 'ClassExpression' ) {
507+ classBody = nodeToCheck . body ;
508+ className = nodeToCheck . id ?. name ;
501509 }
502510
503511 if ( classBody ) {
0 commit comments