From 76e3b7e6f19cea387a22504c654137d5a676ce61 Mon Sep 17 00:00:00 2001 From: Jordi Bunster Date: Mon, 12 Apr 2021 13:13:17 -0700 Subject: [PATCH] Warn on React hook misuse (#632) --- .eslintrc.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c1b67a931..800988b8f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,7 @@ module.exports = { browser: true, es6: true, }, - plugins: ["@typescript-eslint", "no-null", "prefer-arrow"], + plugins: ["@typescript-eslint", "no-null", "prefer-arrow", "react-hooks"], extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], globals: { Atomics: "readonly", @@ -20,7 +20,7 @@ module.exports = { overrides: [ { files: ["**/*.tsx"], - extends: ["plugin:react/recommended"], // TODO: Add react-hooks + extends: ["plugin:react/recommended"], plugins: ["react"], }, { @@ -42,6 +42,8 @@ module.exports = { "prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }], eqeqeq: "error", "react/display-name": "off", + "react-hooks/rules-of-hooks": "warn", // TODO: error + "react-hooks/exhaustive-deps": "warn", // TODO: error "no-restricted-syntax": [ "error", {