Skip to content

SergAlexAnd/eslint-plugin-react-hooks-order

Repository files navigation

eslint-plugin-react-hooks-order


Installation

$ npm i eslint eslint-plugin-react-hooks-order --save-dev

Usage

Add hooks to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["react-hooks-order"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "hooks/sort": [
      2,
      {
        "groups": [
          "useReducer",
          "useContext",
          "useState",
          "useRef",
          "useDispatch",
          "useCallback",
          "useEffect"
        ]
      }
    ]
  }
}

About

Plugin to set hooks order in react components

Resources

License

Stars

Watchers

Forks

Packages

No packages published