From 64e8e85aacb49d93da3d8ad368c6aad0c71e3143 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 06:10:26 +0000 Subject: [PATCH] refactor: Replace short hand type conversions with function calls Prefer using explicit casts by calling `Number`, `Boolean`, or `String` over using operators like `+`, `!!` or `"" +`. This is considered best practice as it improves readability. --- src/components/Dashboard/Views/DashboardView.tsx | 2 +- src/hooks/widgets/dashDot/api.ts | 2 +- src/widgets/weather/useWeatherForCity.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Dashboard/Views/DashboardView.tsx b/src/components/Dashboard/Views/DashboardView.tsx index 194098857..202232e45 100644 --- a/src/components/Dashboard/Views/DashboardView.tsx +++ b/src/components/Dashboard/Views/DashboardView.tsx @@ -60,7 +60,7 @@ const usePrepareGridstack = () => { }, [width]); return { - isReady: !!mainAreaWidth, + isReady: Boolean(mainAreaWidth), mainAreaRef, }; }; diff --git a/src/hooks/widgets/dashDot/api.ts b/src/hooks/widgets/dashDot/api.ts index 34a290475..fd9af4209 100644 --- a/src/hooks/widgets/dashDot/api.ts +++ b/src/hooks/widgets/dashDot/api.ts @@ -29,7 +29,7 @@ export const useGetUsenetInfo = (params: UsenetInfoRequestParams) => refetchInterval: POLLING_INTERVAL, keepPreviousData: true, retry: 2, - enabled: !!params.appId, + enabled: Boolean(params.appId), } ); diff --git a/src/widgets/weather/useWeatherForCity.ts b/src/widgets/weather/useWeatherForCity.ts index 3f21ebad6..be7a28ac0 100644 --- a/src/widgets/weather/useWeatherForCity.ts +++ b/src/widgets/weather/useWeatherForCity.ts @@ -20,7 +20,7 @@ export const useWeatherForCity = (cityName: string) => { const weatherQuery = useQuery({ queryKey: ['weather', { cityName }], queryFn: () => fetchWeather(city?.results[0]), - enabled: !!city, + enabled: Boolean(city), cacheTime: 1000 * 60 * 60 * 6, // the weather is cached for 6 hours staleTime: 1000 * 60 * 5, // the weather is considered stale after 5 minutes });