Skip to content

Commit 5788d22

Browse files
author
Alexey Ivanov
committed
add eslint prettier husky
1 parent 129ec35 commit 5788d22

File tree

5 files changed

+300
-16
lines changed

5 files changed

+300
-16
lines changed

.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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn run tsc --noEmit && yarn run lint-staged

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 80,
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"arrowParens": "avoid",
8+
"jsxBracketSameLine": false,
9+
"trailingComma": "all"
10+
}

package.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"name": "my-app",
33
"version": "0.0.1",
44
"license": "MIT",
5-
"scripts": {
6-
"start": "webpack serve --config webpack.dev.config.ts",
7-
"build": "webpack --config webpack.prod.config.ts"
5+
"lint-staged": {
6+
"src/**/*.{ts,tsx}": [
7+
"prettier --write",
8+
"eslint"
9+
]
810
},
911
"dependencies": {
1012
"react": "^17.0.1",
@@ -26,16 +28,31 @@
2628
"@typescript-eslint/parser": "^4.11.1",
2729
"babel-loader": "^8.2.2",
2830
"clean-webpack-plugin": "^4.0.0-alpha.0",
29-
"eslint": "^7.17.0",
30-
"eslint-plugin-react": "^7.22.0",
31+
"eslint": "^7.28.0",
32+
"eslint-config-prettier": "^8.3.0",
33+
"eslint-plugin-prettier": "^3.4.0",
34+
"eslint-plugin-react": "^7.24.0",
3135
"eslint-plugin-react-hooks": "^4.2.0",
36+
"eslint-plugin-sonarjs": "^0.8.0-125",
3237
"eslint-webpack-plugin": "^2.4.1",
3338
"fork-ts-checker-webpack-plugin": "^6.0.8",
3439
"html-webpack-plugin": "^5.3.1",
40+
"husky": "^6.0.0",
41+
"lint-staged": "^11.0.0",
42+
"prettier": "^2.3.1",
3543
"ts-node": "^10.0.0",
3644
"typescript": "^4.1.3",
3745
"webpack": "^5.11.1",
3846
"webpack-cli": "^4.3.1",
3947
"webpack-dev-server": "^3.11.1"
48+
},
49+
"scripts": {
50+
"start": "webpack serve --config webpack.dev.config.ts",
51+
"build": "webpack --config webpack.prod.config.ts",
52+
"lint": "eslint \"src/**/*.{ts,tsx}\"",
53+
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
54+
"pretify": "prettier --write \"src/**/*.{ts,tsx}\"",
55+
"check": "tsc",
56+
"prepare": "husky install"
4057
}
4158
}

0 commit comments

Comments
 (0)