From f50ac6e11563f484ccba013ddce30d86736b7671 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Fri, 30 Aug 2019 17:40:23 +0200 Subject: [PATCH] chore: extend linting to cover react hooks (#36725) --- .eslintrc.json | 6 ++++-- package-lock.json | 6 ++++++ package.json | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index d68da12aff..9e01609fe8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,13 +1,15 @@ { "root": true, "extends": ["@freecodecamp/eslint-config", "prettier", "prettier/react"], - "plugins": ["prettier"], + "plugins": ["prettier", "react-hooks"], "rules": { "max-len": [ "error", { "code": 80, "ignoreUrls": true, "ignoreTemplateLiterals": true } ], - "prettier/prettier": "error" + "prettier/prettier": "error", + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn" }, "settings": { "react": { diff --git a/package-lock.json b/package-lock.json index d25cef17e6..2a1f098912 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4640,6 +4640,12 @@ } } }, + "eslint-plugin-react-hooks": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.0.1.tgz", + "integrity": "sha512-xir+3KHKo86AasxlCV8AHRtIZPHljqCRRUYgASkbatmt0fad4+5GgC7zkT7o/06hdKM6MIwp8giHVXqBPaarHQ==", + "dev": true + }, "eslint-rule-composer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", diff --git a/package.json b/package.json index e665155d30..da3c28c805 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "eslint-plugin-prefer-object-spread": "^1.2.1", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-react": "^7.14.3", + "eslint-plugin-react-hooks": "^2.0.1", "faker": "^4.1.0", "gray-matter": "^4.0.2", "gulp": "^4.0.2",