enh: add type checking to linting

This commit is contained in:
Ben Allfree 2023-10-12 04:17:13 -07:00
parent c812cc247f
commit a81440b725
8 changed files with 21 additions and 3 deletions

View File

@ -1,8 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh" . "$(dirname -- "$0")/_/husky.sh"
branch="$(git rev-parse --abbrev-ref HEAD)" branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then if [ "$branch" = "master" ]; then
yarn check:types
yarn lint yarn lint
fi fi

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh" . "$(dirname -- "$0")/_/husky.sh"
yarn check:types
yarn lint yarn lint

View File

@ -5,6 +5,10 @@
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {
"check:types": "concurrently 'yarn:check:types:*'",
"check:types:dashboard": "cd packages/dashboard && yarn check:types",
"check:types:common": "cd packages/common && yarn check:types",
"check:types:daemon": "cd packages/daemon && yarn check:types",
"lint": "prettier -c \"./**/*.{ts,js,cjs,svelte,json}\"", "lint": "prettier -c \"./**/*.{ts,js,cjs,svelte,json}\"",
"lint:fix": "prettier -w \"./**/*.{ts,js,cjs,svelte,json}\"", "lint:fix": "prettier -w \"./**/*.{ts,js,cjs,svelte,json}\"",
"build": "concurrently 'yarn:build:*'", "build": "concurrently 'yarn:build:*'",

View File

@ -4,7 +4,8 @@
"main": "src/index.ts", "main": "src/index.ts",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"postinstall": "cd ../.. && patch-package" "postinstall": "cd ../.. && patch-package",
"check:types": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"ajv": "^8.11.2", "ajv": "^8.11.2",

View File

@ -3,6 +3,7 @@
"version": "0.0.1", "version": "0.0.1",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"check:types": "tsc --noEmit --skipLibCheck",
"build": "concurrently 'yarn:build:*'", "build": "concurrently 'yarn:build:*'",
"build:docker": "cd src/services/PocketBaseService && docker build -t pockethost/pocketbase .", "build:docker": "cd src/services/PocketBaseService && docker build -t pockethost/pocketbase .",
"build:hooks": "tsup --target es5 ./src/hooks/src/*.ts -d ./pb_hooks && prettier -w \"./pb_hooks/*\"", "build:hooks": "tsup --target es5 ./src/hooks/src/*.ts -d ./pb_hooks && prettier -w \"./pb_hooks/*\"",

View File

@ -3,6 +3,7 @@
"version": "0.4.1", "version": "0.4.1",
"private": true, "private": true,
"scripts": { "scripts": {
"check:types": "svelte-check",
"preview": "npx http-server@latest ./build -P \"http://localhost:8080?\"", "preview": "npx http-server@latest ./build -P \"http://localhost:8080?\"",
"dev": "DEBUG=1 source ../../.env && vite dev --force", "dev": "DEBUG=1 source ../../.env && vite dev --force",
"build": "vite build", "build": "vite build",
@ -45,6 +46,7 @@
"@types/d3-scale": "^4.0.3", "@types/d3-scale": "^4.0.3",
"@types/d3-scale-chromatic": "^3.0.0", "@types/d3-scale-chromatic": "^3.0.0",
"@types/js-cookie": "^3.0.2", "@types/js-cookie": "^3.0.2",
"@types/marked": "^4.0.8" "@types/marked": "^4.0.8",
"svelte-check": "^3.5.2"
} }
} }

View File

@ -1,4 +1,5 @@
import type { Tooltip } from 'bootstrap' import type { Tooltip } from 'bootstrap'
import 'vite/client'
declare global { declare global {
interface Window { interface Window {

View File

@ -4,8 +4,11 @@
"baseUrl": "", "baseUrl": "",
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"preserveValueImports": false,
"importsNotUsedAsValues": "preserve",
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true, "sourceMap": true,
@ -16,7 +19,10 @@
"$src/*": ["./src/*"] "$src/*": ["./src/*"]
}, },
"types": ["./src/global.d.ts"] "types": ["./src/global.d.ts"]
} },
"include": ["src/*"],
"exclude": ["node_modules", "**/node_modules/*"]
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// //
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes