File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ export function updateConfigValue<Key extends keyof LocalConfig>(
381381 // Note: We need to handle deletions explicitly since editor.update() only merges.
382382 // First, get all keys from the existing content.
383383 const existingKeys = new Set (
384- Object . keys ( editor . content ) . filter ( k => typeof k === 'string' )
384+ Object . keys ( editor . content ) . filter ( k => typeof k === 'string' ) ,
385385 )
386386 const newKeys = new Set ( Object . keys ( configToSave ) )
387387
@@ -410,8 +410,11 @@ export function updateConfigValue<Key extends keyof LocalConfig>(
410410 }
411411
412412 // Stringify with formatting preserved.
413- const jsonContent = JSON . stringify ( contentToSave , undefined , indent )
414- . replace ( / \n / g, newline )
413+ const jsonContent = JSON . stringify (
414+ contentToSave ,
415+ undefined ,
416+ indent ,
417+ ) . replace ( / \n / g, newline )
415418 writeFileSync (
416419 configFilePath ,
417420 Buffer . from ( jsonContent + newline ) . toString ( 'base64' ) ,
Original file line number Diff line number Diff line change 11import {
2+ promises as fs ,
23 mkdtempSync ,
34 readFileSync ,
45 rmSync ,
56 writeFileSync ,
6- promises as fs ,
77} from 'node:fs'
88import os from 'node:os'
99import path from 'node:path'
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments