@@ -11,6 +11,7 @@ import {
1111 isExpressionStatement ,
1212 isIdentifier ,
1313 isMemberExpression ,
14+ isPrivateIdentifier ,
1415 isThisExpression ,
1516 isTSTypeAnnotation ,
1617 isUnaryExpression ,
@@ -48,31 +49,32 @@ function getNodeIdentifierText(
4849 return undefined ;
4950 }
5051
51- const identifierText = isIdentifier ( node )
52- ? node . name
53- : hasID ( node ) && isDefined ( node . id )
54- ? getNodeIdentifierText ( node . id , context )
55- : hasKey ( node ) && isDefined ( node . key )
56- ? getNodeIdentifierText ( node . key , context )
57- : isAssignmentExpression ( node )
58- ? getNodeIdentifierText ( node . left , context )
59- : isMemberExpression ( node )
60- ? `${ getNodeIdentifierText ( node . object , context ) } .${ getNodeIdentifierText (
61- node . property ,
62- context
63- ) } `
64- : isThisExpression ( node )
65- ? "this"
66- : isUnaryExpression ( node )
67- ? getNodeIdentifierText ( node . argument , context )
68- : isExpressionStatement ( node )
69- ? context . getSourceCode ( ) . getText ( node as TSESTree . Node )
70- : isTSTypeAnnotation ( node )
71- ? context
72- . getSourceCode ( )
73- . getText ( node . typeAnnotation as TSESTree . Node )
74- . replaceAll ( / \s + / gmu, "" )
75- : null ;
52+ const identifierText =
53+ isIdentifier ( node ) || isPrivateIdentifier ( node )
54+ ? node . name
55+ : hasID ( node ) && isDefined ( node . id )
56+ ? getNodeIdentifierText ( node . id , context )
57+ : hasKey ( node ) && isDefined ( node . key )
58+ ? getNodeIdentifierText ( node . key , context )
59+ : isAssignmentExpression ( node )
60+ ? getNodeIdentifierText ( node . left , context )
61+ : isMemberExpression ( node )
62+ ? `${ getNodeIdentifierText ( node . object , context ) } .${ getNodeIdentifierText (
63+ node . property ,
64+ context
65+ ) } `
66+ : isThisExpression ( node )
67+ ? "this"
68+ : isUnaryExpression ( node )
69+ ? getNodeIdentifierText ( node . argument , context )
70+ : isExpressionStatement ( node )
71+ ? context . getSourceCode ( ) . getText ( node as TSESTree . Node )
72+ : isTSTypeAnnotation ( node )
73+ ? context
74+ . getSourceCode ( )
75+ . getText ( node . typeAnnotation as TSESTree . Node )
76+ . replaceAll ( / \s + / gmu, "" )
77+ : null ;
7678
7779 if ( identifierText !== null ) {
7880 return identifierText ;
0 commit comments