From 6df50c4a5f933b4bfa0726184c295e7c2a62ae0d Mon Sep 17 00:00:00 2001 From: Nathanaël Houn Date: Wed, 13 Jul 2022 20:41:40 +0200 Subject: ci: add lint and prettier to the pr checks (#127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: add lint and prettier to the pr checks * bad position of function in messenger ⇒ ci fail * Revert "bad position of function in messenger ⇒ ci fail" This reverts commit f8ea1aa674f479093c89f3e7dc6b0ce386003285. --- .github/workflows/builds.yml | 11 ++++++++--- .husky/pre-commit | 5 ++++- package.json | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 806b2a2..9a3533e 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -14,7 +14,7 @@ on: workflow_dispatch: inputs: message: - description: 'Message for build' + description: "Message for build" required: true jobs: @@ -31,8 +31,13 @@ jobs: - name: Use Node.js specified in the '.nvmrc' file uses: actions/setup-node@v3 with: - node-version-file: '.nvmrc' + node-version-file: ".nvmrc" - name: Install pnpm run: npm i -gf "pnpm@$(node -p 'require("./package.json").engines.pnpm')" && pnpm -v - name: Install node dependencies recursively - run: pnpm i && pnpm lint && pnpm reformat-files && pnpm package + run: pnpm i + - name: Check code style and formatting + if: ${{ github.event_name == 'pull_request' }} + run: pnpm lint && pnpm reformat-files + - name: Package recipes + run: pnpm package diff --git a/.husky/pre-commit b/.husky/pre-commit index cf9de02..da4248e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,7 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -pnpm i && pnpm lint && pnpm reformat-files && pnpm package +pnpm i || exit 1 +pnpm lint:fix --quiet || exit 1 +pnpm reformat-files || exit 1 +pnpm package || exit 1 diff --git a/package.json b/package.json index d4cacd4..f243f82 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "prepare": "pnpm dlx husky install", "package": "node scripts/package.js", "create": "node scripts/create.js", - "lint": "eslint . --fix --report-unused-disable-directives", + "lint": "eslint \"{recipes,scripts}/**/*.{js,jsx,ts,tsx}\" --quiet", + "lint:fix": "npm run lint -- --fix", "reformat-files": "prettier --ignore-path .eslintignore --write --require-pragma \"**/*.{js,json,scss}\"", "contributors": "all-contributors" }, -- cgit v1.2.3-70-g09d2