Skip to content
This repository has been archived by the owner on Feb 9, 2025. It is now read-only.

Commit

Permalink
feat: Add eslint-plugin-react-hooks
Browse files Browse the repository at this point in the history
Closes #60

BREAKING CHANGE: There are linting rules for React hooks now.
  • Loading branch information
jhnns committed Jul 9, 2019
1 parent f4fcb9c commit 6c0d0a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ Special rules for Node.js >= 8.0.0 environments:

### [`peerigon/react`](react.js)

**Important: Requires [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react) and [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y) as project dependency.**
**Important: Requires [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react), [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y) and [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) as project dependency.**

```
npm i eslint-plugin-react eslint-plugin-jsx-a11y --save-dev
npm i eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-react-hooks --save-dev
```

Rules for [React](https://facebook.github.io/react/) development, including accessibility rules.
Expand Down
4 changes: 3 additions & 1 deletion react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable sort-keys */

module.exports = {
plugins: ["react", "jsx-a11y"],
plugins: ["react", "jsx-a11y", "react-hooks"],
extends: ["plugin:import/react", "plugin:react/recommended", "plugin:jsx-a11y/recommended"],
rules: {
/* eslint-enable sort-keys */
Expand All @@ -20,6 +20,8 @@ module.exports = {
],
},
],
"react-hooks/exhaustive-deps": "warn", // https://www.npmjs.com/package/eslint-plugin-react-hooks
"react-hooks/rules-of-hooks": "error", // https://www.npmjs.com/package/eslint-plugin-react-hooks
"react/boolean-prop-naming": "off", // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
"react/button-has-type": "error", // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
"react/default-props-match-prop-types": "error", // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
Expand Down

0 comments on commit 6c0d0a3

Please sign in to comment.