diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..2570fd4d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +name: Lint, Format and Type check workflow + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + linting_and_type-checking: + name: Linting, Formatting and Type checking + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Linting and Formatting checks + run: yarn run lint + + - name: Type checking + run: yarn run typecheck \ No newline at end of file diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 00000000..e69de29b diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit new file mode 100755 index 00000000..4f1f1e8d --- /dev/null +++ b/.husky/_/pre-commit @@ -0,0 +1,6 @@ +#!/bin/sh +. "$(dirname "$0")/husky.sh" + +echo 'Performing code styling, testing, and building processes before committing' + +yarn run lint && yarn run typecheck diff --git a/package.json b/package.json index a194f4b1..e92ab557 100644 --- a/package.json +++ b/package.json @@ -5,17 +5,20 @@ "build": "turbo build", "dev": "turbo dev", "lint": "turbo lint", - "format": "prettier --write \"**/*.{ts,tsx,md}\"" - }, - "devDependencies": { - "@repo/eslint-config": "*", - "@repo/typescript-config": "*", - "prettier": "^3.2.5", - "turbo": "latest" - }, - "engines": { - "node": ">=18" + "format": "prettier --write \"**/*.{ts,tsx,md}\"", + "typecheck": "tsc --pretty --noEmit", + "prepare": "husky" }, + "devDependencies": { + "@repo/eslint-config": "*", + "@repo/typescript-config": "*", + "husky": "^9.0.11", + "prettier": "^3.2.5", + "turbo": "latest" + }, + "engines": { + "node": ">=18" + }, "packageManager": "yarn@1.22.21", "workspaces": [ "apps/*",