Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Add code style check (#59)
Browse files Browse the repository at this point in the history
* Add code style check

add style check workflow

* move prettier to devDependencies
  • Loading branch information
xx-db authored Aug 1, 2024
1 parent b0edba9 commit ecece99
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Code Format Check

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Run lint check
run: |
yarn install && yarn test:format
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"format": "prettier --write 'src/**/*.{js,ts,jsx,tsx,json,html}' && eslint 'src/**/*.{js,ts,jsx,tsx,json,html}' --fix",
"test:format": "prettier --check 'src/**/*.{js,ts,jsx,tsx,json,html}' && eslint 'src/**/*.{js,ts,jsx,tsx,json,html}'"
},
"eslintConfig": {
"extends": [
Expand All @@ -47,6 +49,7 @@
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0"
"@types/react-dom": "^18.0.0",
"prettier": "^3.3.3"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8011,6 +8011,11 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==

prettier@^3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==

pretty-bytes@^5.3.0, pretty-bytes@^5.4.1:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
Expand Down

0 comments on commit ecece99

Please sign in to comment.