@@ -92,7 +92,6 @@ export default {
92
92
const groups = options ?. groups ?? [ ]
93
93
const separator = options ?. separator ?? ""
94
94
const sorter = getSorter ( options )
95
- const source = context . getSourceCode ( )
96
95
97
96
return {
98
97
Program ( program ) {
@@ -145,23 +144,28 @@ export default {
145
144
* fix ( fixer ) {
146
145
for ( const [ node , complement ] of enumerate ( nodes , sorted ) ) {
147
146
yield fixer . replaceTextRange (
148
- getNodeRange ( source , node , ! isFirst ( node ) ) ,
149
- getNodeText ( source , complement , ! isFirst ( complement ) )
147
+ getNodeRange ( context . sourceCode , node , ! isFirst ( node ) ) ,
148
+ getNodeText (
149
+ context . sourceCode ,
150
+ complement ,
151
+ ! isFirst ( complement )
152
+ )
150
153
)
151
154
}
152
155
} ,
153
156
} )
154
157
}
155
158
156
- const text = source . getText ( )
159
+ const text = context . sourceCode . getText ( )
157
160
for ( let i = 1 ; i < nodes . length ; i ++ ) {
158
161
const node = nodes [ i ]
159
162
const prevNode = nodes [ i - 1 ]
160
163
161
164
// If the node has preceding comments, we want to use the first
162
165
// comment as the starting position for both determining what the
163
166
// current separator is as well as the location for the report.
164
- const nodeOrComment = source . getCommentsBefore ( node ) [ 0 ] ?? node
167
+ const nodeOrComment =
168
+ context . sourceCode . getCommentsBefore ( node ) [ 0 ] ?? node
165
169
166
170
// Find the range between nodes (including comments) so we can pull
167
171
// the text and apply fixes to newlines between imports.
0 commit comments