Skip to content

Commit

Permalink
chore: add a pre-commit hook for linting (base#601)
Browse files Browse the repository at this point in the history
* add a precommit hook for linting

* test

* Revert "test"

This reverts commit f5329bd.

* add eslintcache to gitignore
  • Loading branch information
JFrankfurt authored Jun 26, 2024
1 parent 344775d commit 7e28d75
Show file tree
Hide file tree
Showing 5 changed files with 370 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ package-lock.json
schema.graphql
persisted_queries.json
**/*.graphql.ts

# eslint
.eslintcache
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
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"

npx lint-staged
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"license": "Apache-2.0",
"scripts": {
"build": "yarn workspaces foreach run build",
"lint": "yarn workspaces foreach run lint"
"lint": "yarn workspaces foreach run lint",
"postinstall": "husky install",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable"
},
"workspaces": [
"apps/*",
Expand Down Expand Up @@ -49,8 +52,11 @@
"eslint-plugin-react-perf": "^3.3.1",
"eslint-plugin-relay": "^1.8.3",
"eslint-plugin-simple-import-sort": "^8.0.0",
"husky": ">=6",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"lint-staged": ">=10",
"pinst": ">=2",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-test-renderer": "18.2.0",
Expand All @@ -77,5 +83,9 @@
"moment": "^2.29.4",
"next": "12.2.3",
"tslib": "^2.3.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix",
"*.{js,jsx,ts,tsx,css,md}": "prettier --write"
}
}
Loading

0 comments on commit 7e28d75

Please sign in to comment.