@@ -97,8 +97,8 @@ function findRootNode(node) {
97
97
function findEndOfLineWithComments ( sourceCode , node ) {
98
98
const tokensToEndOfLine = takeTokensAfterWhile ( sourceCode , node , commentOnSameLineAs ( node ) )
99
99
let endOfTokens = tokensToEndOfLine . length > 0
100
- ? tokensToEndOfLine [ tokensToEndOfLine . length - 1 ] . end
101
- : node . end
100
+ ? tokensToEndOfLine [ tokensToEndOfLine . length - 1 ] . range [ 1 ]
101
+ : node . range [ 1 ]
102
102
let result = endOfTokens
103
103
for ( let i = endOfTokens ; i < sourceCode . text . length ; i ++ ) {
104
104
if ( sourceCode . text [ i ] === '\n' ) {
@@ -121,7 +121,7 @@ function commentOnSameLineAs(node) {
121
121
122
122
function findStartOfLineWithComments ( sourceCode , node ) {
123
123
const tokensToEndOfLine = takeTokensBeforeWhile ( sourceCode , node , commentOnSameLineAs ( node ) )
124
- let startOfTokens = tokensToEndOfLine . length > 0 ? tokensToEndOfLine [ 0 ] . start : node . start
124
+ let startOfTokens = tokensToEndOfLine . length > 0 ? tokensToEndOfLine [ 0 ] . range [ 0 ] : node . range [ 0 ]
125
125
let result = startOfTokens
126
126
for ( let i = startOfTokens - 1 ; i > 0 ; i -- ) {
127
127
if ( sourceCode . text [ i ] !== ' ' && sourceCode . text [ i ] !== '\t' ) {
@@ -296,11 +296,11 @@ function fixNewLineAfterImport(context, previousImport) {
296
296
const tokensToEndOfLine = takeTokensAfterWhile (
297
297
context . getSourceCode ( ) , prevRoot , commentOnSameLineAs ( prevRoot ) )
298
298
299
- let endOfLine = prevRoot . end
299
+ let endOfLine = prevRoot . range [ 1 ]
300
300
if ( tokensToEndOfLine . length > 0 ) {
301
- endOfLine = tokensToEndOfLine [ tokensToEndOfLine . length - 1 ] . end
301
+ endOfLine = tokensToEndOfLine [ tokensToEndOfLine . length - 1 ] . range [ 1 ]
302
302
}
303
- return ( fixer ) => fixer . insertTextAfterRange ( [ prevRoot . start , endOfLine ] , '\n' )
303
+ return ( fixer ) => fixer . insertTextAfterRange ( [ prevRoot . range [ 0 ] , endOfLine ] , '\n' )
304
304
}
305
305
306
306
function removeNewLineAfterImport ( context , currentImport , previousImport ) {
0 commit comments