Skip to content

Feat: Adding lint workflow and Husky pre-commit hook #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
Empty file added .husky/_/husky.sh
Empty file.
6 changes: 6 additions & 0 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
@@ -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
23 changes: 13 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"workspaces": [
"apps/*",
Expand Down