From e0a42b5480eda8cb7346f7b4cf32ac1b852791d9 Mon Sep 17 00:00:00 2001 From: Dominik Dosoudil Date: Fri, 22 Nov 2024 10:09:59 +0100 Subject: [PATCH] chore(eslint): enable react-hooks/recommended (#4498) * chore(eslint): enable react-hooks eslint rules * chore(eslint): ignore eslint error as it is false positive because process.env.NODE_ENV never changes during runtime --- .eslintrc | 2 +- src/modules/Accordion/AccordionAccordion.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index cae9985dda..da85b88782 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,7 +1,7 @@ { "root": true, "parser": "babel-eslint", - "extends": ["airbnb", "prettier"], + "extends": ["airbnb", "prettier", "plugin:react-hooks/recommended"], "env": { "browser": true }, diff --git a/src/modules/Accordion/AccordionAccordion.js b/src/modules/Accordion/AccordionAccordion.js index f99285ee5d..6dfc5fd86b 100644 --- a/src/modules/Accordion/AccordionAccordion.js +++ b/src/modules/Accordion/AccordionAccordion.js @@ -64,6 +64,9 @@ const AccordionAccordion = React.forwardRef(function (props, ref) { }) if (process.env.NODE_ENV !== 'production') { + // Following eslint error is ignored because process.env.NODE_ENV does not change during runtime, + // so it is not actually a problem because the useEffect will be called either always or never + // eslint-disable-next-line react-hooks/rules-of-hooks React.useEffect(() => { /* eslint-disable no-console */ if (exclusive && typeof activeIndex !== 'number') {