Skip to content

Commit 41a7f74

Browse files
committed
chore: use husky and lint-staged
1 parent 7a51713 commit 41a7f74

File tree

4 files changed

+267
-8
lines changed

4 files changed

+267
-8
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ yarn-error.log*
2121
*.njsproj
2222
*.sln
2323
*.sw?
24+
25+
.eslintcache

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Mind elixir is a free open source mind map core.",
55
"main": "dist/MindElixir.js",
66
"scripts": {
7+
"prepare": "husky install",
78
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
89
"start": "webpack-dev-server --mode development --env dist=0",
910
"startd": "webpack-dev-server --mode development --env dist=1",
@@ -14,6 +15,11 @@
1415
"publish2": "npm run build && npm version patch -m \"build: release %s\" && npm publish",
1516
"beta": "npm run build && npm publish --tag beta"
1617
},
18+
"lint-staged": {
19+
"src/**/*.{ts,js,json}": [
20+
"eslint --cache --fix"
21+
]
22+
},
1723
"files": [
1824
"package.json",
1925
"dist"
@@ -41,11 +47,13 @@
4147
"eslint-plugin-prettier": "^4.2.1",
4248
"file-loader": "^6.2.0",
4349
"html-webpack-plugin": "^5.3.2",
50+
"husky": "^8.0.3",
4451
"jest": "^27.5.1",
4552
"jsdoc": "^3.6.3",
4653
"jsdoc-to-markdown": "^7.1.1",
4754
"less": "^4.1.2",
4855
"less-loader": "^10.2.0",
56+
"lint-staged": "^13.1.2",
4957
"prettier": "2.8.4",
5058
"puppeteer": "^13.5.1",
5159
"puppeteer-to-istanbul": "^1.4.0",
@@ -60,4 +68,4 @@
6068
"webpack-cli": "^4.9.2",
6169
"webpack-dev-server": "^4.7.4"
6270
}
63-
}
71+
}

0 commit comments

Comments
 (0)