Skip to content

Commit

Permalink
feat(lint): add react-hooks to eslint rules
Browse files Browse the repository at this point in the history
BREAKING CHANGE: For react projects, you now have to install the eslint-plugin-react-hooks package
  • Loading branch information
GabeDuarteM committed Mar 13, 2019
1 parent 7d25077 commit 268a093
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eslint/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = (isTypescript, isWeb) => {
'babel',
isWeb && 'react',
isWeb && 'jsx-a11y',
isWeb && 'react-hooks',
].filter(Boolean)

const parserOptions = {
Expand Down Expand Up @@ -440,6 +441,11 @@ module.exports = (isTypescript, isWeb) => {
'jsx-a11y/tabindex-no-positive': 'error',
}

const reactHooksPlugin = isWeb && {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
}

const rules = {
...possibleErrors,
...bestPractices,
Expand All @@ -450,6 +456,7 @@ module.exports = (isTypescript, isWeb) => {
...importPlugin,
...typescriptPlugin,
...reactPlugin,
...reactHooksPlugin,
...a11yPlugin,
}

Expand Down

0 comments on commit 268a093

Please sign in to comment.