Enforced usage of typed hooks with linter #3024
agusterodin
started this conversation in
Show and tell
Replies: 1 comment
-
Yeah, actually, we do that in the Replay codebase as well! "overrides": [
{
"files": ["{src,packages,pages}/**/*.{js,jsx,ts,tsx}"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "react-redux",
"importNames": ["useDispatch", "useSelector"],
"message": "Please import 'useAppDispatch/useAppSelector' from 'ui/setup/hooks' instead."
},
]
}
], |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Neat idea that we use in our company monorepo. Enforced usage of typed hooks with linter:
.eslintrc.json
state/index.ts
Error if not used properly

No error when used properly

Beta Was this translation helpful? Give feedback.
All reactions