Skip to content

Commit 18fac4b

Browse files
committed
chore: fix lint nits in process-lock
- Use numeric separators for readability (10_000) - Add trailing commas for consistency
1 parent 7771918 commit 18fac4b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/process-lock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ProcessLockManager {
128128
baseDelayMs = 100,
129129
maxDelayMs = 1000,
130130
retries = 3,
131-
staleMs = 10000,
131+
staleMs = 10_000,
132132
} = options
133133

134134
// Ensure exit handler is registered before any lock acquisition

test/process-lock.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe.sequential('process-lock', () => {
4848

4949
// Second acquire should fail
5050
await expect(
51-
processLock.acquire(testLockPath, { retries: 1, baseDelayMs: 10 })
51+
processLock.acquire(testLockPath, { retries: 1, baseDelayMs: 10 }),
5252
).rejects.toThrow(/Lock already exists/)
5353

5454
release1()
@@ -73,12 +73,12 @@ describe.sequential('process-lock', () => {
7373
fs.mkdirSync(testLockPath, { recursive: false })
7474

7575
// Modify mtime to make it appear stale
76-
const oldTime = Date.now() - 15000 // 15 seconds ago
76+
const oldTime = Date.now() - 15_000 // 15 seconds ago
7777
fs.utimesSync(testLockPath, oldTime / 1000, oldTime / 1000)
7878

7979
// Should detect and remove stale lock
8080
const release = await processLock.acquire(testLockPath, {
81-
staleMs: 10000,
81+
staleMs: 10_000,
8282
})
8383

8484
expect(existsSync(testLockPath)).toBe(true)
@@ -134,7 +134,7 @@ describe.sequential('process-lock', () => {
134134
processLock.withLock(testLockPath, async () => {
135135
expect(existsSync(testLockPath)).toBe(true)
136136
throw error
137-
})
137+
}),
138138
).rejects.toThrow('test error')
139139

140140
// Lock should be released
@@ -160,7 +160,7 @@ describe.sequential('process-lock', () => {
160160
async () => {
161161
executions.push(3)
162162
},
163-
{ retries: 5, baseDelayMs: 50 }
163+
{ retries: 5, baseDelayMs: 50 },
164164
)
165165

166166
await Promise.all([promise1, promise2])
@@ -181,7 +181,7 @@ describe.sequential('process-lock', () => {
181181
await expect(
182182
processLock.withLock(testLockPath, async () => {
183183
throw new Error('immediate error')
184-
})
184+
}),
185185
).rejects.toThrow('immediate error')
186186

187187
expect(existsSync(testLockPath)).toBe(false)
@@ -220,7 +220,7 @@ describe.sequential('process-lock', () => {
220220
retries: 3,
221221
baseDelayMs: 1000,
222222
maxDelayMs: 50, // Cap delays at 50ms
223-
})
223+
}),
224224
).rejects.toThrow()
225225

226226
const elapsed = Date.now() - startTime
@@ -234,7 +234,7 @@ describe.sequential('process-lock', () => {
234234
describe('stale detection', () => {
235235
it('should not consider fresh locks as stale', async () => {
236236
const release = await processLock.acquire(testLockPath, {
237-
staleMs: 10000,
237+
staleMs: 10_000,
238238
})
239239

240240
expect(existsSync(testLockPath)).toBe(true)
@@ -244,8 +244,8 @@ describe.sequential('process-lock', () => {
244244
processLock.acquire(testLockPath, {
245245
retries: 1,
246246
baseDelayMs: 10,
247-
staleMs: 10000,
248-
})
247+
staleMs: 10_000,
248+
}),
249249
).rejects.toThrow(/Lock already exists/)
250250

251251
release()
@@ -258,12 +258,12 @@ describe.sequential('process-lock', () => {
258258
fs.mkdirSync(testLockPath, { recursive: false })
259259

260260
// Set mtime to make it stale
261-
const staleTime = Date.now() - 11000 // 11 seconds ago
261+
const staleTime = Date.now() - 11_000 // 11 seconds ago
262262
fs.utimesSync(testLockPath, staleTime / 1000, staleTime / 1000)
263263

264264
// Should successfully acquire by removing stale lock
265265
const release = await processLock.acquire(testLockPath, {
266-
staleMs: 10000,
266+
staleMs: 10_000,
267267
})
268268

269269
expect(existsSync(testLockPath)).toBe(true)
@@ -310,7 +310,7 @@ describe.sequential('process-lock', () => {
310310

311311
// Should work even with nested path
312312
await expect(
313-
processLock.acquire(deepPath, { retries: 1 })
313+
processLock.acquire(deepPath, { retries: 1 }),
314314
).rejects.toThrow()
315315

316316
// mkdir with recursive: false should fail for non-existent parent

0 commit comments

Comments
 (0)