From 7c1782f5df6d9ed7d029d96c52611d15c089834f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= Date: Wed, 7 Aug 2024 14:39:49 +0900 Subject: [PATCH] ci: eslint and prettier lint automation using husky lint-staged github-actions (#12) * ci: eslint and prettier lint automation using husky lint-staged github-actions * fix: error in prettier --check options No parser could be inferred for file '.../.markdownlintignore' occured. So I fixed it. * perf: made lint.yml using parallel operation --- .github/workflows/lint.yml | 15 ++++++++++----- .markdownlintignore | 3 +++ .prettierignore | 1 + package.json | 6 +++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bd07aea..225cc99 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,6 +9,14 @@ on: jobs: lint: + strategy: + matrix: + type: + - eslint + - prettier + - editorconfig + - markdownlint + runs-on: ubuntu-latest steps: @@ -30,8 +38,5 @@ jobs: - name: Set up node_modules run: npm ci - - name: Lint editorconfig - run: npm run lint-editorconfig --if-present - - - name: Lint markdownlint - run: npm run lint-markdownlint --if-present + - name: Lint ${{ matrix.type }} + run: npm run lint-${{ matrix.type }} --if-present diff --git a/.markdownlintignore b/.markdownlintignore index 60b79ab..5096460 100644 --- a/.markdownlintignore +++ b/.markdownlintignore @@ -3,3 +3,6 @@ # production /build + +# files +LICENSE diff --git a/.prettierignore b/.prettierignore index 0974c6e..d52b332 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ node_modules build +.markdownlintignore package-lock.json *.md diff --git a/package.json b/package.json index fb9d10d..9c08bc4 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,11 @@ "prettier": "^3.3.3" }, "lint-staged": { - "*": "npx editorconfig-checker", + "*": [ + "npx prettier --check", + "npx editorconfig-checker" + ], + "*.js": "npx eslint", "*.md": "npx markdownlint" } }