Skip to content

Commit

Permalink
Set up pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Albrecht committed Jun 14, 2022
1 parent 5da4693 commit 2416b18
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 14 deletions.
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {},
"settings": {
"react": {
"version": "detect"
}
}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn run lint-staged
25 changes: 24 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"prepare": "husky install"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write"
],
"*.{js,jsx,ts,tsx}": [
"eslint --max-warnings 0 --config .eslintrc.json"
],
"*.{ts,tsx}": [
"tsc-files -p tsconfig.json --noEmit"
]
},
"browserslist": {
"production": [
">0.2%",
Expand All @@ -41,5 +53,16 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.30.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.1",
"prettier": "^2.7.0",
"tsc-files": "^1.1.3"
}
}
Loading

0 comments on commit 2416b18

Please sign in to comment.