Skip to content

Commit

Permalink
Update with no ESlint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmengo committed Oct 18, 2024
1 parent b56db43 commit dbc775a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/theme/src/cli/utilities/theme-fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ describe('theme-fs', () => {

// When
const content = await readThemeFile(root, key)
const contentJson = JSON.parse(content?.toString() || '')
const contentJson = JSON.parse(content?.toString() ?? '')

// Then
expect(contentJson).toEqual({
Expand Down
24 changes: 14 additions & 10 deletions packages/theme/src/cli/utilities/theme-fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,16 @@ export function mountThemeFileSystem(root: string, options?: ThemeFileSystemOpti
.then(() => {
switch (eventName) {
case 'add':
case 'change':
return handleFileUpdate(eventName, themeId, adminSession, fileKey)
case 'unlink':
return handleFileDelete(themeId, adminSession, fileKey)
case 'change': {
handleFileUpdate(eventName, themeId, adminSession, fileKey)
return
}
case 'unlink': {
handleFileDelete(themeId, adminSession, fileKey)
}
}
})
.catch((error) => {
.catch((error: unknown) => {
outputWarn(`Error handling file event for ${fileKey}: ${error}`)
})
}
Expand All @@ -125,14 +128,14 @@ export function mountThemeFileSystem(root: string, options?: ThemeFileSystemOpti
const previousChecksum = files.get(fileKey)?.checksum

const contentPromise = read(fileKey).then(async () => {
const file = files.get(fileKey)!
const file = files.get(fileKey)

if (file.checksum !== previousChecksum) {
if (file?.checksum !== previousChecksum) {
// Sync only if the file has changed
unsyncedFileKeys.add(fileKey)
}

return file.value || file.attachment || ''
return file?.value ?? file?.attachment ?? ''
})

const syncPromise = contentPromise
Expand All @@ -154,6 +157,7 @@ export function mountThemeFileSystem(root: string, options?: ThemeFileSystemOpti

return true
})
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
.catch(createSyncingCatchError(fileKey, 'upload'))

emitEvent(eventName, {
Expand Down Expand Up @@ -203,8 +207,8 @@ export function mountThemeFileSystem(root: string, options?: ThemeFileSystemOpti
outputSyncResult('delete', fileKey)
return true
})
.catch((error) => {
createSyncingCatchError(fileKey, 'delete')(error)
.catch((error: unknown) => {
createSyncingCatchError(fileKey, 'delete')(error as Error)
return false
})

Expand Down

0 comments on commit dbc775a

Please sign in to comment.