@@ -11,6 +11,7 @@ import {
11
11
isExpressionStatement ,
12
12
isIdentifier ,
13
13
isMemberExpression ,
14
+ isPrivateIdentifier ,
14
15
isThisExpression ,
15
16
isTSTypeAnnotation ,
16
17
isUnaryExpression ,
@@ -48,31 +49,32 @@ function getNodeIdentifierText(
48
49
return undefined ;
49
50
}
50
51
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 ;
76
78
77
79
if ( identifierText !== null ) {
78
80
return identifierText ;
0 commit comments