eslint-plugin-redux-tsc

1.0.1 • Public • Published

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

Linthook

&&

LintImport

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.

Package Sidebar

Install

npm i eslint-plugin-redux-tsc

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

5.61 kB

Total Files

6

Last publish

Collaborators

  • manku27