@@ -40,16 +40,16 @@ export function removeAllScopeAndVariableAndReference(
4040 scopeManager : ScopeManager ;
4141 } ,
4242) : void {
43- const targetScopes = new Set < Scope > ( ) ;
43+ const removeTargetScopes = new Set < Scope > ( ) ;
4444 traverseNodes ( target , {
4545 visitorKeys : info . visitorKeys ,
4646 enterNode ( node ) {
4747 const scope = info . scopeManager . acquire ( node ) ;
4848 if ( scope ) {
49- targetScopes . add ( scope ) ;
49+ removeTargetScopes . add ( scope ) ;
5050 return ;
5151 }
52- if ( node . type === "Identifier" ) {
52+ if ( node . type === "Identifier" || node . type === "JSXIdentifier" ) {
5353 let scope = getInnermostScopeFromNode ( info . scopeManager , node ) ;
5454 while (
5555 scope &&
@@ -59,7 +59,7 @@ export function removeAllScopeAndVariableAndReference(
5959 ) {
6060 scope = scope . upper ! ;
6161 }
62- if ( targetScopes . has ( scope ) ) {
62+ if ( removeTargetScopes . has ( scope ) ) {
6363 return ;
6464 }
6565
@@ -72,7 +72,7 @@ export function removeAllScopeAndVariableAndReference(
7272 } ,
7373 } ) ;
7474
75- for ( const scope of targetScopes ) {
75+ for ( const scope of removeTargetScopes ) {
7676 removeScope ( info . scopeManager , scope ) ;
7777 }
7878}
@@ -221,7 +221,7 @@ function removeReference(reference: Reference, baseScope: Scope): void {
221221
222222/** Remove variable */
223223function removeIdentifierVariable (
224- node : TSESTree . Identifier ,
224+ node : TSESTree . Identifier | TSESTree . JSXIdentifier ,
225225 scope : Scope ,
226226) : void {
227227 for ( let varIndex = 0 ; varIndex < scope . variables . length ; varIndex ++ ) {
@@ -244,7 +244,7 @@ function removeIdentifierVariable(
244244 scope . set . delete ( name ) ;
245245 }
246246 } else {
247- const idIndex = variable . identifiers . indexOf ( node ) ;
247+ const idIndex = variable . identifiers . indexOf ( node as TSESTree . Identifier ) ;
248248 if ( idIndex >= 0 ) {
249249 variable . identifiers . splice ( idIndex , 1 ) ;
250250 }
@@ -255,7 +255,7 @@ function removeIdentifierVariable(
255255
256256/** Remove reference */
257257function removeIdentifierReference (
258- node : TSESTree . Identifier ,
258+ node : TSESTree . Identifier | TSESTree . JSXIdentifier ,
259259 scope : Scope ,
260260) : boolean {
261261 const reference = scope . references . find ( ( ref ) => ref . identifier === node ) ;
0 commit comments