Skip to content

Commit

Permalink
feat: add recommended config eslint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 6, 2019
1 parent d827445 commit 01c4a55
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/eslint-plugin-react-hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ Then add it to your ESLint configuration:
}
```

Or use the recommended config:

```js
{
"extends": [
// ...
"plugin:react-hooks/recommended"
]
}
```

## Valid and Invalid Examples

Please refer to the [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) documentation and the [Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#what-exactly-do-the-lint-rules-enforce) to learn more about this rule.
Expand Down
9 changes: 9 additions & 0 deletions packages/eslint-plugin-react-hooks/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

import RuleOfHooks from './RulesOfHooks';

export const configs = {
recommended: {
plugins: ['react-hooks'],
rules: {
'react-hooks/rules-of-hooks': 'error',
},
},
};

export const rules = {
'rules-of-hooks': RuleOfHooks,
};

0 comments on commit 01c4a55

Please sign in to comment.