From b2ff3696ca6541f5698863aee63eb9efa9aa6d24 Mon Sep 17 00:00:00 2001 From: khatab Wedaa <38974561+khatabwedaa@users.noreply.github.com> Date: Thu, 12 Nov 2020 10:25:19 +0200 Subject: [PATCH] Change prettier workflow to git hook (#25) --- .github/workflows/format_prettier.yml | 28 --------------------------- package.json | 13 +++++++++++++ 2 files changed, 13 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/format_prettier.yml diff --git a/.github/workflows/format_prettier.yml b/.github/workflows/format_prettier.yml deleted file mode 100644 index b861e95..0000000 --- a/.github/workflows/format_prettier.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Format Prettier - -# This action works with pull requests and pushes -on: - pull_request: - push: - branches: - - master - -jobs: - prettier: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - - - name: Prettify code - uses: creyD/prettier_action@v2.2 - with: - # This part is also where you can pass other options, for example: - prettier_options: - --write **/*.{js,md} - --tab-width 4 - --jsx-bracket-same-line true \ No newline at end of file diff --git a/package.json b/package.json index d50fc8c..579ddd4 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,21 @@ "babel-eslint": "^10.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", + "husky": "^4.3.0", + "lint-staged": "^10.5.1", + "prettier": "^2.1.2", "vue-template-compiler": "^2.6.11" }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{js,css,md}": [ + "prettier --tab-width 4 --jsx-bracket-same-line true --write" + ] + }, "eslintConfig": { "root": true, "env": {