Skip to content

Commit 129060c

Browse files
committed
👷 build: add lint-staged and husky
1 parent 5ef8ced commit 129060c

File tree

6 files changed

+324
-15
lines changed

6 files changed

+324
-15
lines changed

‎.huskyrc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"skipCI": false,
3+
"hooks": {
4+
"pre-commit": "lint-staged"
5+
}
6+
}

‎.lintstagedrc.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"linters": {
3+
"*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write", "git add"],
4+
"*.{css,scss}": ["stylelint --fix", "prettier --write", "git add"],
5+
"*.{json,md}": ["prettier --write", "git add"]
6+
},
7+
"ignore": ["src/members.json"]
8+
}

‎.prettierignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
dist
2+
build
23
coverage
4+
src/members.json

‎.vscode/settings.json‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
"typescript.tsdk": "node_modules/typescript/lib",
33
"editor.formatOnSave": true,
44
"prettier.eslintIntegration": true,
5-
"prettier.stylelintIntegration": true,
6-
"[json]": {
7-
"editor.formatOnSave": false
8-
}
5+
"prettier.stylelintIntegration": true
96
}

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build": "react-scripts build",
1414
"test": "react-scripts test",
1515
"bundle-analyzer": "react-scripts build --stats && webpack-bundle-analyzer build/bundle-stats.json",
16-
"commit": "git-cz"
16+
"commit": "lint-staged && git-cz"
1717
},
1818
"dependencies": {
1919
"array-to-tree": "^3.3.0",
@@ -33,6 +33,8 @@
3333
"commitizen": "^3.0.7",
3434
"cz-moe": "^0.0.2",
3535
"eslint-config-prettier": "^4.1.0",
36+
"husky": "^1.3.1",
37+
"lint-staged": "^8.1.5",
3638
"node-sass": "^4.11.0",
3739
"prettier": "^1.16.4",
3840
"react-scripts": "3.0.0-next.b0cbf2ca",

0 commit comments

Comments
 (0)