chore: extend lint:ts to cover api (#49793)

* fix: include express-session types + suppress err

* chore: add api to lint:ts

* fix: remove unnecessary typeRoots config
This commit is contained in:
Oliver Eyton-Williams
2023-03-22 13:29:46 +01:00
committed by GitHub
parent 982878948f
commit 36b06be8ce
5 changed files with 14 additions and 4 deletions

View File

@@ -53,6 +53,8 @@ const start = async () => {
// NOTE: Awaited to ensure `.use` is registered on `fastify`
await fastify.register(middie);
await fastify.register(fastifyCookie);
// @ts-expect-error - @fastify/session's types are not, yet, compatible with
// express-session's types
await fastify.register(fastifySession, {
secret: SESSION_SECRET,
rolling: false,

View File

@@ -18,10 +18,11 @@
"description": "The freeCodeCamp.org open-source codebase and curriculum",
"devDependencies": {
"@fastify/type-provider-typebox": "2.4.0",
"@types/express-session": "1.17.7",
"@types/supertest": "2.0.12",
"jest": "29.5.0",
"prisma": "4.11.0",
"pino-pretty": "10.0.0",
"prisma": "4.11.0",
"supertest": "6.3.3",
"ts-jest": "29.0.5"
},

View File

@@ -6,7 +6,6 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"typeRoots": ["../node_modules/@types", "../node_modules/@fastify"]
"resolveJsonModule": true
}
}

View File

@@ -68,7 +68,7 @@
"lint": "npm-run-all create:* -p lint:*",
"lint:challenges": "cd ./curriculum && pnpm run lint",
"lint:js": "eslint --max-warnings 0 .",
"lint:ts": "tsc && tsc -p config && tsc -p tools/ui-components && tsc -p utils",
"lint:ts": "tsc && tsc -p config && tsc -p tools/ui-components && tsc -p utils && tsc -p api",
"lint:prettier": "prettier --list-different .",
"reload:server": "pm2 reload api-server/ecosystem.config.js",
"seed": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seed-demo-user",

8
pnpm-lock.yaml generated
View File

@@ -119,6 +119,7 @@ importers:
'@fastify/type-provider-typebox': 2.4.0
'@prisma/client': 4.11.0
'@sinclair/typebox': 0.25.24
'@types/express-session': 1.17.7
'@types/supertest': 2.0.12
connect-mongo: 4.6.0
fastify: 4.14.1
@@ -143,6 +144,7 @@ importers:
nodemon: 2.0.21
devDependencies:
'@fastify/type-provider-typebox': 2.4.0_naatsb2dmwxq3j32xoqzjtyzqm
'@types/express-session': 1.17.7
'@types/supertest': 2.0.12
jest: 29.5.0
pino-pretty: 10.0.0
@@ -9265,6 +9267,12 @@ packages:
'@types/qs': 6.9.7
'@types/range-parser': 1.2.4
/@types/express-session/1.17.7:
resolution: {integrity: sha512-L25080PBYoRLu472HY/HNCxaXY8AaGgqGC8/p/8+BYMhG0RDOLQ1wpXOpAzr4Gi5TGozTKyJv5BVODM5UNyVMw==}
dependencies:
'@types/express': 4.17.17
dev: true
/@types/express/4.17.17:
resolution: {integrity: sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==}
dependencies: