Skip to content

Commit 67afc9b

Browse files
committed
fix: ESLint errors in config and editable-json
- Fix import sort order in config.test.mts (promises as fs sorted by alias name) - Add no-await-in-loop eslint-disable comments for retry loops in editable-json.mts - Remove unused eslint-disable directive
1 parent 0fd9079 commit 67afc9b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/utils/config.test.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2+
promises as fs,
23
mkdtempSync,
34
readFileSync,
45
rmSync,
56
writeFileSync,
6-
promises as fs,
77
} from 'node:fs'
88
import os from 'node:os'
99
import path from 'node:path'

src/utils/editable-json.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function detectNewline(json: string): string {
6161
return match ? match[0] : '\n'
6262
}
6363

64-
6564
/**
6665
* Sort object keys alphabetically.
6766
* Creates a new object with sorted keys (does not mutate input).
@@ -159,12 +158,13 @@ async function retryWrite(
159158
): Promise<void> {
160159
for (let attempt = 0; attempt <= retries; attempt++) {
161160
try {
161+
// eslint-disable-next-line no-await-in-loop
162162
await fs.writeFile(filepath, content)
163163
if (process.platform === 'win32') {
164+
// eslint-disable-next-line no-await-in-loop
164165
await setTimeout(50)
165166
let accessRetries = 0
166167
const maxAccessRetries = 5
167-
// eslint-disable-next-line no-await-in-loop
168168
while (accessRetries < maxAccessRetries) {
169169
try {
170170
// eslint-disable-next-line no-await-in-loop
@@ -211,6 +211,7 @@ async function readFile(filepath: string): Promise<string> {
211211
const maxRetries = process.platform === 'win32' ? 5 : 1
212212
for (let attempt = 0; attempt <= maxRetries; attempt++) {
213213
try {
214+
// eslint-disable-next-line no-await-in-loop
214215
return await fs.readFile(filepath, 'utf8')
215216
} catch (err) {
216217
const isLastAttempt = attempt === maxRetries

0 commit comments

Comments
 (0)