Skip to content

Commit 2d360d9

Browse files
committed
feat!: Update minimum supported ESLint version to 8
1 parent b835ea6 commit 2d360d9

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

bun.lockb

0 Bytes
Binary file not shown.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"index.cjs"
3434
],
3535
"peerDependencies": {
36-
"eslint": ">=6"
36+
"eslint": ">=8"
3737
},
3838
"dependencies": {
3939
"@typescript-eslint/experimental-utils": "^5.54.1",

src/rules/imports.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export default {
9292
const groups = options?.groups ?? []
9393
const separator = options?.separator ?? ""
9494
const sorter = getSorter(options)
95-
const source = context.getSourceCode()
9695

9796
return {
9897
Program(program) {
@@ -145,23 +144,28 @@ export default {
145144
*fix(fixer) {
146145
for (const [node, complement] of enumerate(nodes, sorted)) {
147146
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+
)
150153
)
151154
}
152155
},
153156
})
154157
}
155158

156-
const text = source.getText()
159+
const text = context.sourceCode.getText()
157160
for (let i = 1; i < nodes.length; i++) {
158161
const node = nodes[i]
159162
const prevNode = nodes[i - 1]
160163

161164
// If the node has preceding comments, we want to use the first
162165
// comment as the starting position for both determining what the
163166
// 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
165169

166170
// Find the range between nodes (including comments) so we can pull
167171
// the text and apply fixes to newlines between imports.

src/utils.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ export function report(
138138
nodes: Node[],
139139
sorted: Node[]
140140
) {
141-
const source = context.getSourceCode()
142141
const firstUnsortedNode = isUnsorted(nodes, sorted)
143142

144143
if (firstUnsortedNode) {
@@ -148,8 +147,8 @@ export function report(
148147
*fix(fixer) {
149148
for (const [node, complement] of enumerate(nodes, sorted)) {
150149
yield fixer.replaceTextRange(
151-
getNodeRange(source, node),
152-
getNodeText(source, complement)
150+
getNodeRange(context.sourceCode, node),
151+
getNodeText(context.sourceCode, complement)
153152
)
154153
}
155154
},

0 commit comments

Comments
 (0)