Skip to content

Commit

Permalink
feat(eslint): 加入 hooks eslint 规则, close #3598
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Aug 2, 2019
1 parent d5d3733 commit bbe91e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/eslint-config-taro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"babel-eslint": "^8.2.3",
"eslint": "^5.16.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.4.0"
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react-hooks": "^1.6.1"
},
"author": "O2Team",
"license": "MIT",
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-config-taro/rules/jsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ module.exports = {
}
},
plugins: [
'react'
'react',
'react-hooks'
],

// View link below for react rules documentation
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// Specify whether double or single quotes should be used in JSX attributes
// https://eslint.org/docs/rules/jsx-quotes
'jsx-quotes': ['error', 'prefer-single'],
Expand Down

0 comments on commit bbe91e5

Please sign in to comment.