From bbe91e5d480292776abc888376a9e41fb83d4a0b Mon Sep 17 00:00:00 2001 From: yuche Date: Fri, 2 Aug 2019 15:23:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(eslint):=20=E5=8A=A0=E5=85=A5=20hooks=20es?= =?UTF-8?q?lint=20=E8=A7=84=E5=88=99,=20close=20#3598?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/eslint-config-taro/package.json | 3 ++- packages/eslint-config-taro/rules/jsx.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-taro/package.json b/packages/eslint-config-taro/package.json index 93482efb22eb..98083d353811 100644 --- a/packages/eslint-config-taro/package.json +++ b/packages/eslint-config-taro/package.json @@ -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", diff --git a/packages/eslint-config-taro/rules/jsx.js b/packages/eslint-config-taro/rules/jsx.js index 1f520a8df839..4523506a2c9f 100644 --- a/packages/eslint-config-taro/rules/jsx.js +++ b/packages/eslint-config-taro/rules/jsx.js @@ -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'],