Skip to content

Commit b07bd90

Browse files
committed
Add husky - pre commit hook
Signed-off-by: Aviv Turgeman <[email protected]>
1 parent 5b7e102 commit b07bd90

File tree

4 files changed

+277
-4
lines changed

4 files changed

+277
-4
lines changed

.husky/pre-commit

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# .husky/pre-commit
2+
3+
yarn lint-staged
4+
translation_file_diff=$(git diff --name-only packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json)
5+
6+
if [ -n "$translation_file_diff" ]; then
7+
git add $translation_file_diff
8+
fi
9+
10+
# see what's going to be committed
11+
git status

package.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"packages/common",
1111
"packages/forklift-console-plugin"
1212
],
13+
"lint-staged": {
14+
"*.{js,jsx,ts,tsx,json}": [
15+
"yarn i18n"
16+
]
17+
},
1318
"scripts": {
1419
"clean": "rm -rf ./dist ./coverage && yarn workspace @kubev2v/common run clean && yarn workspace @kubev2v/forklift-console-plugin run clean",
1520
"clean:all": "yarn run clean && rm -rf ./node_modules ./tmp",
@@ -33,7 +38,8 @@
3338
"e2e:console": "bash ./ci/deploy-console.sh",
3439
"e2e:pre-test": "yarn run e2e:cluster && yarn run e2e:build && yarn run e2e:deployCrds && yarn run e2e:console",
3540
"storybook": "yarn workspace @kubev2v/common run storybook dev -p 6006",
36-
"storybook:build": "yarn workspace @kubev2v/common run storybook build"
41+
"storybook:build": "yarn workspace @kubev2v/common run storybook build",
42+
"postinstall": "husky"
3743
},
3844
"devDependencies": {
3945
"@cspell/eslint-plugin": "^6.31.1",
@@ -59,9 +65,11 @@
5965
"eslint-plugin-simple-import-sort": "^7.0.0",
6066
"eslint-plugin-testing-library": "^5.6.0",
6167
"eslint-plugin-unused-imports": "^2.0.0",
68+
"husky": "^9.1.7",
6269
"i18next-parser": "^9.3.0",
6370
"jest": "^28.1.3",
6471
"jest-environment-jsdom": "^28.1.3",
72+
"lint-staged": "^15.4.3",
6573
"prettier": "^2.7.1",
6674
"rollup": "^4.22.4",
6775
"rollup-plugin-analyzer": "^4.0.0",

packages/eslint-plugin/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const base = {
7777

7878
// take the place of `.eslintignore`
7979
'dist/',
80+
'distlib/',
8081
'generated/',
8182
'node_modules/',
8283
'storybook-static/',

0 commit comments

Comments
 (0)