diff --git a/.github/workflows/pre-commit-checks.yml b/.github/workflows/pre-commit-checks.yml new file mode 100644 index 0000000..344640f --- /dev/null +++ b/.github/workflows/pre-commit-checks.yml @@ -0,0 +1,35 @@ +name: Pre-commit checks + +on: + pull_request: + branches: ['*'] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Cache Node.js dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: yarn + + - name: Lint check + run: yarn lint:check + + - name: Prettier check + run: yarn format:check diff --git a/package.json b/package.json index b5747f6..96092dd 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "lint:check": "eslint . --ext .js,.jsx,.ts,.tsx, src/", "lint:fix": "eslint . --fix --ext js,jsx,ts,tsx, src/", "check:all": "yarn format:check && yarn lint:check", + "fix:all": "yarn format:fix && yarn lint:fix", "prepare": "husky install" }, "dependencies": {