chore: add git hooks

This commit is contained in:
Samuel 2024-12-18 17:58:01 +01:00
parent 3d49a25cae
commit 4495210f71
7 changed files with 951 additions and 12 deletions

2
.husky/commit-msg Normal file
View file

@ -0,0 +1,2 @@
export PATH="$PATH:$(pnpm bin)"
pnpm dlx commitlint --edit $1

3
.husky/pre-commit Normal file
View file

@ -0,0 +1,3 @@
export PATH="$PATH:$(pnpm bin)"
pnpm biome lint
pnpm biome format

12
.vscode/settings.json vendored
View file

@ -2,9 +2,17 @@
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"quickfix.biome": "explicit" "quickfix.biome": "explicit"
}, },
"[typescript][typescriptreact][json]": { "typescript.inlayHints.parameterNames.enabled": "all",
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome", "editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true "editor.formatOnSave": true
}, },
"typescript.inlayHints.parameterNames.enabled": "all" "[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
}
} }

1
commitlint.config.js Normal file
View file

@ -0,0 +1 @@
export default { extends: ["@commitlint/config-conventional"] };

View file

@ -9,16 +9,21 @@
"build": "vite build", "build": "vite build",
"serve": "vite preview", "serve": "vite preview",
"postinstall": "cp ./node_modules/sql.js/dist/sql-wasm.wasm ./src/assets/sql-wasm.wasm", "postinstall": "cp ./node_modules/sql.js/dist/sql-wasm.wasm ./src/assets/sql-wasm.wasm",
"generate-db-types": "kysely-codegen --dialect=sqlite --url=./src/assets/database.sqlite" "generate-db-types": "kysely-codegen --dialect=sqlite --url=./src/assets/database.sqlite",
"prepare": "husky"
}, },
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@biomejs/biome": "1.9.4", "@biomejs/biome": "1.9.4",
"@commitlint/cli": "^19.6.1",
"@commitlint/config-conventional": "^19.6.0",
"@types/node": "^22.10.1", "@types/node": "^22.10.1",
"@types/sql.js": "^1.4.9", "@types/sql.js": "^1.4.9",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"better-sqlite3": "^11.7.0", "better-sqlite3": "^11.7.0",
"husky": "^9.1.7",
"kysely-codegen": "^0.17.0", "kysely-codegen": "^0.17.0",
"lint-staged": "^15.2.11",
"postcss": "^8.4.49", "postcss": "^8.4.49",
"tailwindcss": "^3.4.16", "tailwindcss": "^3.4.16",
"typescript": "^5.7.2", "typescript": "^5.7.2",

937
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -76,6 +76,7 @@ export const createMessageStatsSources = (
// increment the message count of the message's weekday for this recipient // increment the message count of the message's weekday for this recipient
weekday[weekdayIndex][message.fromRecipientId] += 1; weekday[weekdayIndex][message.fromRecipientId] += 1;
// increment the message count of the message's daytime for this recipient
daytime[messageDate.getHours()][message.fromRecipientId] += 1; daytime[messageDate.getHours()][message.fromRecipientId] += 1;
} }
} }