From 5196a27db51dc8e58209214bd12eb190e17bc406 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 11 Apr 2023 14:46:12 -0600 Subject: [PATCH 1/2] Fix eslint warnings for valid-typeof We were comparing to undefined (literal) instead of 'undefined' (string). `typeof` will always return a string, so `'undefined' !== undefined` would always return `true`. Signed-off-by: Taylor Smock --- frontend/src/components/editor.js | 2 +- frontend/src/components/rapidEditor.js | 2 +- frontend/src/components/teamsAndOrgs/teams.js | 6 ++++-- frontend/src/components/user/content.js | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/editor.js b/frontend/src/components/editor.js index 80dcc5d651..7bde3726b8 100644 --- a/frontend/src/components/editor.js +++ b/frontend/src/components/editor.js @@ -11,7 +11,7 @@ export default function Editor({ setDisable, comment, presets, imagery, gpxUrl } const iDContext = useSelector((state) => state.editor.context); const locale = useSelector((state) => state.preferences.locale); const [customImageryIsSet, setCustomImageryIsSet] = useState(false); - const windowInit = typeof window !== undefined; + const windowInit = typeof window !== 'undefined'; const customSource = iDContext && iDContext.background() && iDContext.background().findSource('custom'); diff --git a/frontend/src/components/rapidEditor.js b/frontend/src/components/rapidEditor.js index 52fe67aacd..c16e013db5 100644 --- a/frontend/src/components/rapidEditor.js +++ b/frontend/src/components/rapidEditor.js @@ -18,7 +18,7 @@ export default function RapidEditor({ const RapiDContext = useSelector((state) => state.editor.rapidContext); const locale = useSelector((state) => state.preferences.locale); const [customImageryIsSet, setCustomImageryIsSet] = useState(false); - const windowInit = typeof window !== undefined; + const windowInit = typeof window !== 'undefined'; const customSource = RapiDContext && RapiDContext.background() && RapiDContext.background().findSource('custom'); diff --git a/frontend/src/components/teamsAndOrgs/teams.js b/frontend/src/components/teamsAndOrgs/teams.js index 5b57a54586..f23f5ad400 100644 --- a/frontend/src/components/teamsAndOrgs/teams.js +++ b/frontend/src/components/teamsAndOrgs/teams.js @@ -310,6 +310,8 @@ export function TeamSideBar({ team, members, managers, requestedToJoin }: Object return member.username.toLowerCase().includes(searchQuery.toLowerCase()); }) : members; + const organisations = useSelector((state) => state.auth.organisations); + const pmTeams = useSelector((state) => state.auth.pmTeams); return (
diff --git a/frontend/src/components/user/content.js b/frontend/src/components/user/content.js index 9b758152ae..f785beedfb 100644 --- a/frontend/src/components/user/content.js +++ b/frontend/src/components/user/content.js @@ -57,7 +57,7 @@ export function OSMCard({ username }: Object) { showLoadingAnimation={true} rows={1} delay={100} - ready={typeof osmUserInfo !== undefined} + ready={typeof osmUserInfo !== 'undefined'} > @@ -72,7 +72,7 @@ export function OSMCard({ username }: Object) { showLoadingAnimation={true} rows={1} delay={100} - ready={typeof osmUserInfo !== undefined} + ready={typeof osmUserInfo !== 'undefined'} > From 102227e10d0dca8b7ab72782734be58725f68ebe Mon Sep 17 00:00:00 2001 From: Hel Nershing Thapa Date: Fri, 9 Jun 2023 13:44:08 +0545 Subject: [PATCH 2/2] Remove ununsed variables in TeamSideBar The useSelector calls for `organisations` and `pmTeams` have been removed as they are not utilized in this component. The ready condition now checks only for the existence of `team.teamId` as a `number`." --- frontend/src/components/teamsAndOrgs/teams.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/frontend/src/components/teamsAndOrgs/teams.js b/frontend/src/components/teamsAndOrgs/teams.js index f23f5ad400..7ec2f241e8 100644 --- a/frontend/src/components/teamsAndOrgs/teams.js +++ b/frontend/src/components/teamsAndOrgs/teams.js @@ -310,19 +310,13 @@ export function TeamSideBar({ team, members, managers, requestedToJoin }: Object return member.username.toLowerCase().includes(searchQuery.toLowerCase()); }) : members; - const organisations = useSelector((state) => state.auth.organisations); - const pmTeams = useSelector((state) => state.auth.pmTeams); return (