@@ -127,10 +127,20 @@ function extractBasePathReferences(
127
127
}
128
128
}
129
129
} ) ) {
130
- const variable = findVariable ( context , ( node as TSESTree . ImportSpecifier ) . local ) ;
131
- if ( ! variable ) continue ;
132
- for ( const reference of variable . references ) {
133
- if ( reference . identifier . type === 'Identifier' ) set . add ( reference . identifier ) ;
130
+ if ( node . type === 'ImportSpecifier' ) {
131
+ const variable = findVariable ( context , node . local ) ;
132
+ if ( variable === null ) {
133
+ continue ;
134
+ }
135
+ for ( const reference of variable . references ) {
136
+ if ( reference . identifier . type === 'Identifier' ) set . add ( reference . identifier ) ;
137
+ }
138
+ } else if (
139
+ node . type === 'MemberExpression' &&
140
+ node . property . type === 'Identifier' &&
141
+ node . property . name === 'base'
142
+ ) {
143
+ set . add ( node . property ) ;
134
144
}
135
145
}
136
146
return set ;
@@ -218,6 +228,8 @@ function expressionStartsWithBase(
218
228
return binaryExpressionStartsWithBase ( context , url , basePathNames ) ;
219
229
case 'Identifier' :
220
230
return variableStartsWithBase ( context , url , basePathNames ) ;
231
+ case 'MemberExpression' :
232
+ return memberExpressionStartsWithBase ( url , basePathNames ) ;
221
233
case 'TemplateLiteral' :
222
234
return templateLiteralStartsWithBase ( context , url , basePathNames ) ;
223
235
default :
@@ -236,6 +248,13 @@ function binaryExpressionStartsWithBase(
236
248
) ;
237
249
}
238
250
251
+ function memberExpressionStartsWithBase (
252
+ url : TSESTree . MemberExpression ,
253
+ basePathNames : Set < TSESTree . Identifier >
254
+ ) : boolean {
255
+ return url . property . type === 'Identifier' && basePathNames . has ( url . property ) ;
256
+ }
257
+
239
258
function variableStartsWithBase (
240
259
context : RuleContext ,
241
260
url : TSESTree . Identifier ,
0 commit comments