File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
packages/eslint-plugin/src/rules Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -62,16 +62,17 @@ export default createRule<Options, MessageIds>({
62
62
63
63
return {
64
64
MemberExpression ( node : TSESTree . MemberExpression ) : void {
65
- const objectSymbol = typeChecker . getSymbolAtLocation (
66
- parserServices . esTreeNodeToTSNodeMap . get ( node . property ) ,
67
- ) ;
68
-
69
- if (
70
- allowPrivateClassPropertyAccess &&
71
- objectSymbol ?. declarations [ 0 ] ?. modifiers ?. [ 0 ] . kind ===
65
+ if ( allowPrivateClassPropertyAccess && node . computed ) {
66
+ // for perf reasons - only fetch the symbol if we have to
67
+ const objectSymbol = typeChecker . getSymbolAtLocation (
68
+ parserServices . esTreeNodeToTSNodeMap . get ( node . property ) ,
69
+ ) ;
70
+ if (
71
+ objectSymbol ?. getDeclarations ( ) ?. [ 0 ] ?. modifiers ?. [ 0 ] . kind ===
72
72
ts . SyntaxKind . PrivateKeyword
73
- ) {
74
- return ;
73
+ ) {
74
+ return ;
75
+ }
75
76
}
76
77
rules . MemberExpression ( node ) ;
77
78
} ,
You can’t perform that action at this time.
0 commit comments