From 45a5c65b2f210e16cf03ff78bf934c9e5aa707ab Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Tue, 15 Oct 2024 14:12:47 +0000
Subject: [PATCH] chore(lint): fix leaked rendering

---
 .eslintrc.js                                                  | 1 +
 src/components/Charts/Bar.tsx                                 | 4 +---
 .../Options/ProfileTypeOptions/ProfileTypeOptions.tsx         | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index 2cbc020ed..7195bf9c0 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -78,6 +78,7 @@ module.exports = {
         '@eslint-react/dom/no-dangerously-set-innerhtml': 0, // used for for injecting html tags
         '@eslint-react/no-array-index-key': 0,
         '@eslint-react/no-unused-class-component-members': 0, // disabled for ".d.ts" files
+        '@eslint-react/no-leaked-conditional-rendering': 'error', // important ! avoids rendering 0
       },
     },
     {
diff --git a/src/components/Charts/Bar.tsx b/src/components/Charts/Bar.tsx
index 0df625082..bb1ae9fa3 100644
--- a/src/components/Charts/Bar.tsx
+++ b/src/components/Charts/Bar.tsx
@@ -293,9 +293,7 @@ const Bar = ({
           />
         </g>
       ) : (
-        height > 0 &&
-        dataload.value &&
-        dataload.value >= 0 && (
+        Boolean(height > 0 && dataload.value && dataload.value >= 0) && (
           // default colored bar
           <g
             className="barValue"
diff --git a/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.tsx b/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.tsx
index 604c35735..7ab2149c8 100644
--- a/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.tsx
+++ b/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.tsx
@@ -97,7 +97,7 @@ const ProfileTypeOptions = () => {
                   <div className="value">
                     {t(`profile_type.housing_type.${profileType.housingType}`)}
                   </div>
-                  {profileType.constructionYear && (
+                  {Boolean(profileType.constructionYear) && (
                     <div className="value">
                       {t(
                         `profile_type.construction_year.${
-- 
GitLab