fix(lint): add deps, remove any, update warning limit
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 34s

This commit is contained in:
enes 2024-08-20 14:38:03 +02:00
parent bec3c92b03
commit 61f39d17ff
5 changed files with 26 additions and 14 deletions

View File

@ -7,7 +7,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 6",
"lint:fix": "eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:staged": "eslint --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"formatter:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",

View File

@ -236,9 +236,11 @@ export const SignPage = () => {
if (!arrayBuffer) return
const blob = new Blob([arrayBuffer])
saveAs(blob, `exported-${unixNow()}.sigit.zip`)
} catch (error: any) {
} catch (error) {
console.log('error in zip:>> ', error)
toast.error(error.message || 'Error occurred in generating zip file')
if (error instanceof Error) {
toast.error(error.message || 'Error occurred in generating zip file')
}
}
}

View File

@ -141,7 +141,7 @@ export const DisplayMeta = ({
})
}
})
}, [users, submittedBy])
}, [users, submittedBy, metadata])
const downloadFile = async (filename: string) => {
const arrayBuffer = await files[filename].file.arrayBuffer()

View File

@ -1,18 +1,26 @@
export class DecryptionError extends Error {
public message: string = ''
constructor(public inputError: any) {
constructor(public inputError: unknown) {
super()
if (inputError.message.toLowerCase().includes('expected')) {
this.message = `The decryption key length or format is invalid.`
} else if (
inputError.message.includes('The JWK "alg" member was inconsistent')
) {
this.message = `The decryption key is invalid.`
// Make sure inputError has access to the .message
if (inputError instanceof Error) {
if (inputError.message.toLowerCase().includes('expected')) {
this.message = `The decryption key length or format is invalid.`
} else if (
inputError.message.includes('The JWK "alg" member was inconsistent')
) {
this.message = `The decryption key is invalid.`
} else {
this.message =
inputError.message || 'An error occurred while decrypting file.'
}
} else {
// We don't have message on the inputError
// Stringify whole error and set that as a message
this.message =
inputError.message || 'An error occurred while decrypting file.'
JSON.stringify(inputError) || 'An error occurred while decrypting file.'
}
this.name = 'DecryptionError'

View File

@ -37,9 +37,11 @@ const readContentOfZipEntry = async <T extends OutputType>(
const loadZip = async (data: InputFileFormat): Promise<JSZip | null> => {
try {
return await JSZip.loadAsync(data)
} catch (err: any) {
} catch (err) {
console.log('err in loading zip file :>> ', err)
toast.error(err.message || 'An error occurred in loading zip file.')
if (err instanceof Error) {
toast.error(err.message || 'An error occurred in loading zip file.')
}
return null
}
}