Skip to content

Commit

Permalink
chore: fix typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud committed Sep 6, 2024
1 parent f553579 commit 4896c74
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 62 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
run: |
bun concurrently \
-c auto \
-n format,lint,typecheck \
-n format,lint,typecheck-server,typecheck-client \
'bun dprint check' \
'bun biome check --config-path=.biome.jsonc .' \
'bun tsc'
'bun tsc --noEmit --project server/tsconfig.json' \
'bun tsc --noEmit --project client/tsconfig.json'
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
node_modules
dist
coverage
lcov.info
.env
tsconfig.tsbuildinfo
11 changes: 8 additions & 3 deletions .lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ pre-commit:
stage_fixed: true
lint:
run: bun biome lint --config-path=.biome.jsonc --no-errors-on-unmatched
typecheck:
glob: '*.{cjs,js,jsx,mjs,ts,tsx}'
run: bun tsc-files --noEmit
typecheck-server:
glob: 'server/**/*.{cjs.js,json,mjs,ts}'
root: 'server/'
run: bun tsc --noEmit
typecheck-client:
glob: '*.{cjs,js,json,jsx,mjs,ts,tsx}'
root: 'client/'
run: bun tsc --noEmit
2 changes: 0 additions & 2 deletions client/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export interface OpenPassportQRcodeProps {
scope: string
userId: string
requirements: any[]
// TODO: add better type
// @ts-ignore
onSuccess: (result: any) => void
devMode?: boolean
}
Expand Down
14 changes: 0 additions & 14 deletions server/src/lib/verify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import forge from 'node-forge'
import { groth16 } from 'snarkjs'
import { config } from './config'
import { attributeToPosition, countryCodes, defaultOptions } from './constants'
import { runSnarkjsVerification } from './run-snarkjs-verification'
Expand Down Expand Up @@ -59,19 +58,6 @@ const verifyRequirements = (
const arraysEqual = (arr1: string[], arr2: string[]) =>
arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index])

const verifyProof = async (
vkey: any,
publicSignals: string[],
proof: any,
report: OpenPassportVerifierReport,
) => {
groth16.verify(vkey, publicSignals, proof).then(valid => {
if (valid === false)
report.exposeAttribute('proof')
})
console.log('\x1b[32m%s\x1b[0m', `- proof verified`)
}

const verifyCertificate = (
dsc: string,
parsedPublicKey: string[],
Expand Down
22 changes: 20 additions & 2 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"noImplicitAny": false

"allowJs": true,
"checkJs": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"moduleDetection": "force",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"useUnknownInCatchVariables": true,
"strict": true,

"skipLibCheck": true,
"skipDefaultLibCheck": true
}
}
36 changes: 0 additions & 36 deletions tsconfig.json

This file was deleted.

0 comments on commit 4896c74

Please sign in to comment.