Enforce rules-of-hooks via eslint

Summary:
allow-large-files

Enforce rules-of-hooks in React Native via the eslint-plugin-react-hooks plugin. See https://reactjs.org/docs/hooks-rules.html

Reviewed By: rickhanlonii

Differential Revision: D13998695

fbshipit-source-id: 48f1cde18c7112ce91d5087461875bcd0b50bf4f
This commit is contained in:
Christoph Nakazawa 2019-02-08 07:04:29 -08:00 committed by Facebook Github Bot
parent ccefc700d0
commit 7ecf55fc9d
3 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@
"flowtype",
"prettier",
"react",
"react-hooks",
"react-native",
"jest",
],
@ -240,6 +241,10 @@
"react/self-closing-comp": 1,
"react/wrap-multilines": 0,
// React-Hooks Plugin
// The following rules are made available via `eslint-plugin-react-hooks`
"react-hooks/rules-of-hooks": "error",
// React-Native Plugin
// The following rules are made available via `eslint-plugin-react-native`

View File

@ -223,6 +223,7 @@
"eslint-plugin-jest": "21.8.0",
"eslint-plugin-prettier": "2.6.0",
"eslint-plugin-react": "7.8.2",
"eslint-plugin-react-hooks": "^1.0.1",
"eslint-plugin-react-native": "3.5.0",
"flow-bin": "^0.92.0",
"jest": "24.0.0-alpha.6",

View File

@ -2627,6 +2627,11 @@ eslint-plugin-prettier@2.6.0:
fast-diff "^1.1.1"
jest-docblock "^21.0.0"
eslint-plugin-react-hooks@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.0.1.tgz#76b6fb4edafab02eab0090078977687157605dd9"
integrity sha512-yNhvY7EFBp0mq0Bt8BHoS57GwJ4e1qSYdvDFSfPnjmiSmyGUfQFQGcQs4K0JQFDGopWkURWq58psbUJIhWZ2Kg==
eslint-plugin-react-native-globals@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-native-globals/-/eslint-plugin-react-native-globals-0.1.2.tgz#ee1348bc2ceb912303ce6bdbd22e2f045ea86ea2"