Skip to content

Commit be65312

Browse files
adds linter and husky hooks (#3)
* adds linter and husky hooks * husky hooks * fake change to see linting working on gh actions * fix eslint issue
1 parent 3c4d767 commit be65312

File tree

7 files changed

+26
-1
lines changed

7 files changed

+26
-1
lines changed

.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"es2021": true,
55
"jest/globals": true
66
},
7+
"ignorePatterns": [
8+
"src/setupTests.js",
9+
"src/reportWebVitals.js",
10+
"build/*",
11+
"coverage/*"
12+
],
713
"extends": [
814
"plugin:react/recommended",
915
"airbnb"

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
- name: Installs dependencies
1616
run: npm install
1717

18+
- name: Run Linter
19+
run: npm run eslint
20+
1821
- name: Run build
1922
run: npm run build
2023

.github/workflows/pull-request-checks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
- name: Installs dependencies
1616
run: npm install
1717

18+
- name: Run Linter
19+
run: npm run eslint
20+
1821
- name: Run build
1922
run: npm run build
2023

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run eslint
5+
npm test

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@testing-library/react": "^11.1.0",
1010
"@testing-library/user-event": "^12.1.10",
1111
"graphql": "^15.5.0",
12+
"husky": "^5.1.0",
1213
"react": "^17.0.1",
1314
"react-dom": "^17.0.1",
1415
"react-router-dom": "^5.2.0",
@@ -20,7 +21,8 @@
2021
"build": "react-scripts build",
2122
"test": "react-scripts test --watchAll=false --coverage",
2223
"eject": "react-scripts eject",
23-
"deploy": "echo 'work in progress'"
24+
"deploy": "echo 'work in progress'",
25+
"eslint": "eslint ."
2426
},
2527
"eslintConfig": {
2628
"extends": [

0 commit comments

Comments
 (0)