Skip to content
Branch: master
Find file History
hristo-kanchev and gaearon [eslint-plugin-react-hooks] Fixed crash when referencing arguments in…
… arrow functions. (#16356)

* Fixed issue with def being undefined while referencing arguments.

* Removed todo comment.

* Skip exhaustive deps check if def is null.

* Fixed code formatting in ExhaustiveDeps.

* Removed unneeded comment in ExhaustiveDeps.
Latest commit 9e64bf1 Aug 14, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
__tests__ [eslint-plugin-react-hooks] Fixed crash when referencing arguments in… Aug 14, 2019
npm Add ESLint rule for React Hooks Oct 29, 2018
src [eslint-plugin-react-hooks] Fixed crash when referencing arguments in… Aug 14, 2019
README.md Fix sample ESLint configuration (#14926) Feb 22, 2019
index.js Add ESLint rule for React Hooks Oct 29, 2018
package.json

README.md

eslint-plugin-react-hooks

This ESLint plugin enforces the Rules of Hooks.

It is a part of the Hooks API for React.

Installation

Note: If you're using Create React App, please wait for a corresponding 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 --save-dev

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

Then add it to your ESLint configuration:

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

Valid and Invalid Examples

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

For feedback about the exhaustive-deps rule, please post in this thread.

License

MIT

You can’t perform that action at this time.