Skip to content

Commit

Permalink
Add TypeScript type-checking to make sure and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
seanh committed Jul 4, 2024
1 parent 0d78e19 commit 779a0f2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ jobs:
run: make frontend-checkformatting
- name: Lint
run: make frontend-lint
- name: Typecheck
run: make frontend-typecheck
- name: Test
run: make frontend-tests
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ backend-lint: python
frontend-lint: node_modules/.uptodate
@yarn lint

.PHONY: frontend-typecheck
frontend-typecheck: node_modules/.uptodate
@yarn typecheck

.PHONY: format
format: backend-format frontend-format

Expand Down Expand Up @@ -162,7 +166,7 @@ requirements/lint.txt: requirements/tests.txt requirements/functests.txt
requirements requirements/: $(foreach file,$(wildcard requirements/*.in),$(basename $(file)).txt)

.PHONY: sure
sure: checkformatting lint test coverage functests
sure: checkformatting lint frontend-typecheck test coverage functests

.PHONY: docker
docker:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function CreateGroupForm() {
type="text"
id="name"
class="form-input__input group-form__name-input has-label"
autofocus=""
autofocus
autocomplete="off"
required
/>
Expand Down
2 changes: 1 addition & 1 deletion h/static/scripts/group-forms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render } from 'preact';
import CreateGroupForm from './components/CreateGroupForm';

function init() {
render(<CreateGroupForm />, document.querySelector('#create-group-form'));
render(<CreateGroupForm />, document.querySelector('#create-group-form')!);
}

init();
1 change: 1 addition & 0 deletions h/static/scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"jsx": "react-jsx",
"jsxImportSource": "preact",
"module": "es2020",
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "ES2020",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"checkformatting": "prettier --check *.{js,ts,tsx} h/static/scripts",
"format": "prettier --list-different --write *.{js,ts,tsx} h/static/scripts",
"lint": "eslint h/static/scripts",
"test": "gulp test"
"test": "gulp test",
"typecheck": "tsc --build h/static/scripts/tsconfig.json"
},
"dependencies": {
"@babel/core": "^7.24.7",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2705,12 +2705,12 @@ __metadata:
linkType: hard

"@types/vinyl@npm:^2.0.9":
version: 2.0.11
resolution: "@types/vinyl@npm:2.0.11"
version: 2.0.12
resolution: "@types/vinyl@npm:2.0.12"
dependencies:
"@types/expect": ^1.20.4
"@types/node": "*"
checksum: e921718775992ada7712a26da9635fb970bcdbcf4c4cc832344092d68710ffaf7dd3cce42b0050b2741b2cf75a30f3e1b87e1032ae26552db1faac17094d2b50
checksum: 885b7813676eed755b94d42501a56bf36c8d93d8ef6cc4d495bb5779fc5c81ffbcee7d0defe77515a90bf46209968da84b559471611efa0d2900ec75fa1a84de
languageName: node
linkType: hard

Expand Down

0 comments on commit 779a0f2

Please sign in to comment.