Skip to content

Commit

Permalink
build: strictly typecheck the codebase
Browse files Browse the repository at this point in the history
This change enables TypeScript's strict mode, which allows various bugs to be revealed and shows areas that remain untyped.

As there are many things to fix, I've added an optional step to the CI workflow.

Refs #398, #422
  • Loading branch information
thewilkybarkid committed Nov 4, 2021
1 parent afdc667 commit 163bd96
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
env:
TARGET: 'dev'

- name: 'Typecheck'
run: make typecheck
continue-on-error: true

- name: 'Lint'
run: make lint

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DEFAULT_GOAL: help
.PHONY: help build run dev prod start logs stop wait-healthy lint format test integration-test smoke-test
.PHONY: help build run dev prod start logs stop wait-healthy typecheck lint format test integration-test smoke-test

ifeq (${TARGET},)
TARGET := dev
Expand Down Expand Up @@ -46,6 +46,10 @@ endif
wait-healthy: ## Wait for the app to be healthy
@.scripts/wait-healthy.sh prereview

typecheck: export TARGET = dev
typecheck: build ## Run the typechecker
@${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview typecheck

lint: export TARGET = dev
lint: build ## Run the linter
@${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview lint
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"format": "prettier --ignore-unknown --check '**'",
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"test": "jest",
"typecheck": "tsc --noEmit --project tsconfig.dev.json",
"build": "rimraf dist && npm run build:scripts && npm run build:backend && npm run build:hooks && npm run build:frontend",
"build:dev": "rimraf dist && npm run build:scripts && npm run build:backend:dev && npm run build:hooks && npm run build:frontend:dev",
"build:backend": "parcel build --target=backend --no-optimize src/backend/index.ts && npm run build:templates",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"module": "commonjs",
"declaration": true,
"isolatedModules": true,
"noImplicitAny": false,
"strict": true,
"removeComments": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 163bd96

Please sign in to comment.