Skip to content

Commit

Permalink
[New #133] Add format checking with prettier on pre-commit and on push
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Apr 28, 2022
1 parent abd48e6 commit 0c91631
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 46 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check code format

on:
push:
branches:
- '*'

jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run prettier:check
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run prettier:check
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package.json
package-lock.json
css/s-forms.min.css
dist
README.md
65 changes: 22 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,18 @@
"react-dom": "~17.0.2",
"style-loader": "^1.2.1",
"typescript": "^4.5.5",
"watchify": "^3.11.1"
"watchify": "^3.11.1",
"husky": "^7.0.0"
},
"scripts": {
"test": "jest",
"dev": "start-storybook -p 6006",
"build": "microbundle --jsx React.createElement",
"build-storybook": "build-storybook",
"chromatic": "npx chromatic"
"chromatic": "npx chromatic",
"prettier:check": "npx prettier --check .",
"prettier:format": "npx prettier --format .",
"prepare": "husky install"
},
"types": "./dist/s-forms.d.ts"
}

0 comments on commit 0c91631

Please sign in to comment.