Skip to content

Commit

Permalink
chore(eslint): enable react-hooks/recommended (#4498)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dominikdosoudil authored Nov 22, 2024
1 parent a7e8c69 commit e0a42b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"parser": "babel-eslint",
"extends": ["airbnb", "prettier"],
"extends": ["airbnb", "prettier", "plugin:react-hooks/recommended"],
"env": {
"browser": true
},
Expand Down
3 changes: 3 additions & 0 deletions src/modules/Accordion/AccordionAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit e0a42b5

Please sign in to comment.