Skip to content

Commit

Permalink
chore: add a Github action to typecheck and lint a PR (#46)
Browse files Browse the repository at this point in the history
* chore: add a Github action to typecheck and lint a PR

* Update .husky/pre-commit

---------

Co-authored-by: Rémy Baranx <[email protected]>
Co-authored-by: Roman <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2024
1 parent 4e25208 commit 7dbe9db
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Type checking
run: npm run typecheck

- name: Linting
run: npm run lint:fix
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run typecheck && yarn run lint --fix
npm run typecheck && npm run lint:fix
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"build": "next build",
"dev": "next dev",
"lint": "eslint --ext js,jsx,ts,tsx .",
"lint:fix": "eslint --ext js,jsx,ts,tsx --fix .",
"lint": "eslint --ext js,jsx,ts,tsx --max-warnings=0 .",
"lint:fix": "eslint --ext js,jsx,ts,tsx --max-warnings=0 --fix .",
"lint:package": "sort-package-json",
"typecheck": "tsc --pretty"
},
Expand Down

0 comments on commit 7dbe9db

Please sign in to comment.