Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.4 KB

File metadata and controls

48 lines (32 loc) · 1.4 KB

eslint-plugin-react-hooks

This ESLint plugin enforces the Rules of Hooks.

It is a part of the Hooks proposal for React.

Experimental Status

This is an experimental release and is intended to be used for testing the Hooks proposal with React 16.8 alpha. The exact heuristics it uses may be adjusted.

The Rules of Hooks documentation contains a link to the technical RFC. Please leave a comment on the RFC if you have concerns or ideas about how this plugin should work.

Installation

Note: If you're using Create React App, please wait for a corresponding experimental release of react-scripts that includes this rule instead of adding it directly.

Assuming you already have ESLint installed, run:

# npm
npm install eslint-plugin-react-hooks@next --save-dev

# yarn
yarn add eslint-plugin-react-hooks@next --dev

Then add it to your ESLint configuration:

{
  "plugins": [
    // ...
    "react-hooks"
  ],
  "rules": {
    // ...
    "react-hooks/rules-of-hooks": "error"
  }
}

Valid and Invalid Examples

Please refer to the Rules of Hooks documentation and the Hooks FAQ to learn more about this rule.

License

MIT