eslint-plugin-redux-tsc
v1.0.1
Published
`npm install eslint-plugin-redux-tsc --save`
Downloads
5
Maintainers
Readme
eslint-plugin-redux-tsc
Usage
npm install eslint-plugin-redux-tsc --save
Or
yarn add --dev eslint eslint-plugin-jest
In .eslintrc
plugins : [
// other plugins,
"redux-tsc"
],
rules : {
// other rules,
"redux-tsc/enforce-hooks": "error",
"redux-tsc/restrict-react-redux": "error"
}
Output
&&
Why
Redux strongly recommends using typed hooks when using with typescript projects.
Following their documentation ,
we add these Typed-hooks which look something of the sort of useAppSelector and useAppDispatch
which are to be used against the useSelector and useDispatch
, for React
via react-redux
.
One way, the documentation suggests is to restrict imports via @typescript-eslint/eslint-plugin
, which I find verbose.
I have wrapped on it to extend import restriction while also adding lint errors on the hook too.