Skip to content

Commit e0a42b5

Browse files
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
1 parent a7e8c69 commit e0a42b5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"root": true,
33
"parser": "babel-eslint",
4-
"extends": ["airbnb", "prettier"],
4+
"extends": ["airbnb", "prettier", "plugin:react-hooks/recommended"],
55
"env": {
66
"browser": true
77
},

src/modules/Accordion/AccordionAccordion.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const AccordionAccordion = React.forwardRef(function (props, ref) {
6464
})
6565

6666
if (process.env.NODE_ENV !== 'production') {
67+
// Following eslint error is ignored because process.env.NODE_ENV does not change during runtime,
68+
// so it is not actually a problem because the useEffect will be called either always or never
69+
// eslint-disable-next-line react-hooks/rules-of-hooks
6770
React.useEffect(() => {
6871
/* eslint-disable no-console */
6972
if (exclusive && typeof activeIndex !== 'number') {

0 commit comments

Comments
 (0)