@@ -3,27 +3,27 @@ import isShorthandPropertyAssignmentPatternLeft from '../utils/is-shorthand-prop
33import isShorthandImportLocal from '../utils/is-shorthand-import-local.js' ;
44import isShorthandExportLocal from '../utils/is-shorthand-export-local.js' ;
55
6- export default function replaceReferenceIdentifier ( identifier , replacement , fixer ) {
6+ export default function replaceReferenceIdentifier ( identifier , replacement , context , fixer ) {
77 if (
88 isShorthandPropertyValue ( identifier )
99 || isShorthandPropertyAssignmentPatternLeft ( identifier )
1010 ) {
1111 return fixer . replaceText ( identifier , `${ identifier . name } : ${ replacement } ` ) ;
1212 }
1313
14- if ( isShorthandImportLocal ( identifier ) ) {
14+ if ( isShorthandImportLocal ( identifier , context ) ) {
1515 return fixer . replaceText ( identifier , `${ identifier . name } as ${ replacement } ` ) ;
1616 }
1717
18- if ( isShorthandExportLocal ( identifier ) ) {
18+ if ( isShorthandExportLocal ( identifier , context ) ) {
1919 return fixer . replaceText ( identifier , `${ replacement } as ${ identifier . name } ` ) ;
2020 }
2121
2222 // `typeAnnotation`
2323 if ( identifier . typeAnnotation ) {
24+ const { sourceCode} = context ;
2425 return fixer . replaceTextRange (
25- // eslint-disable-next-line internal/no-restricted-property-access
26- [ identifier . range [ 0 ] , identifier . typeAnnotation . range [ 0 ] ] ,
26+ [ sourceCode . getRange ( identifier ) [ 0 ] , sourceCode . getRange ( identifier . typeAnnotation ) [ 0 ] ] ,
2727 `${ replacement } ${ identifier . optional ? '?' : '' } ` ,
2828 ) ;
2929 }
0 commit comments