Skip to content

Commit 31dc621

Browse files
p1003czerwiukk
andauthored
Add husky (#219)
## Description Adds husky ## Motivation and Context We want pre-commit like functionality (husky does that) --------- Co-authored-by: Adrian Czerwiec <adrian.czerwiec@swmansion.com>
1 parent 22932e9 commit 31dc621

File tree

6 files changed

+266
-6
lines changed

6 files changed

+266
-6
lines changed

.husky/pre-commit

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
PRE_FIX_HASH=$(git diff --cached --full-index)
4+
5+
npx lint-staged
6+
7+
POST_FIX_HASH=$(git diff --cached --full-index)
8+
9+
if [ "$PRE_FIX_HASH" != "$POST_FIX_HASH" ]; then
10+
git diff --staged --name-only | grep -E '\.(js|ts|jsx|tsx|json|css|scss)$'
11+
12+
git reset HEAD --quiet
13+
14+
exit 1
15+
fi
16+

examples/room-manager/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,10 @@
3030
"tsc": "^2.0.4",
3131
"tsx": "^4.19.3",
3232
"typescript": "~5.8.2"
33+
},
34+
"lint-staged": {
35+
"*.{ts,tsx,js,jsx}": [
36+
"eslint --fix"
37+
]
3338
}
3439
}

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"cspell": "^9.4.0",
1212
"eslint": "^9.23.0",
1313
"globals": "^16.0.0",
14+
"husky": "^9.1.7",
15+
"lint-staged": "^16.2.7",
1416
"prettier": "^3.5.3",
1517
"typedoc": "^0.28.1",
1618
"typedoc-material-theme": "^1.3.0",
@@ -26,6 +28,10 @@
2628
"format": "yarn workspaces foreach -A -p run format",
2729
"docs": "typedoc",
2830
"spellcheck": "cspell '**/*.md' '**/*.mdx' '**/*.html' --exclude '**/api/**' --show-suggestions",
29-
"spellcheck:report": "yarn spellcheck --no-show-suggestions"
31+
"spellcheck:report": "yarn spellcheck --no-show-suggestions",
32+
"prepare": "husky"
33+
},
34+
"lint-staged": {
35+
"*.{ts,tsx,mjs,cjs,json,md,mdx,yaml,yml}": "prettier --write"
3036
}
3137
}

packages/js-server-sdk/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,10 @@
7474
"prettier": "^3.6.2",
7575
"tsup": "^8.4.0",
7676
"typed-emitter": "^2.1.0"
77+
},
78+
"lint-staged": {
79+
"*.{js,ts,tsx,mjs,cjs}": [
80+
"eslint --fix --config packages/js-server-sdk/eslint.config.mjs"
81+
]
7782
}
7883
}

packages/js-server-sdk/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export {
99
ViewerToken,
1010
StreamerToken,
1111
} from '@fishjam-cloud/fishjam-openapi';
12+
1213
export { ServerMessage } from '@fishjam-cloud/fishjam-proto';
1314
export { FishjamWSNotifier } from './ws_notifier';
1415
export type * from './ws_notifier';

0 commit comments

Comments
 (0)