Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: add eslint rules for no-else-return and curly (#10070)

Ashwin Bhatkale1c8b68cd21b
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 86a1ca3fd9..d4b76612a4 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -55,11 +55,10 @@ module.exports = {
// Code quality rules
'prefer-const': 'error', // Enforces const for variables never reassigned
'no-var': 'error', // Disallows var, enforces let/const
- // TODO: Enable after fixing ~50 violations (auto-fixable)
- // 'no-else-return': ['error', { allowElseIf: false }], // Reduces nesting by disallowing else after return
+ 'no-else-return': ['error', { allowElseIf: false }], // Reduces nesting by disallowing else after return
'no-cond-assign': 'error', // Prevents accidental assignment in conditions (if (x = 1) instead of if (x === 1))
'no-debugger': 'error', // Disallows debugger statements in production code
- // curly: 'error', // Requires curly braces for all control statements
+ curly: 'error', // Requires curly braces for all control statements
eqeqeq: ['error', 'always', { null: 'ignore' }], // Enforces === and !== (allows == null for null/undefined check)
// TODO: Enable after fixing ~15 console.log statements
// 'no-console': ['error', { allow: ['warn', 'error'] }], // Warns on console.log, allows console.warn/error
diff --git a/frontend/src/api/infraMonitoring/getK8sClustersList.ts b/frontend/src/api/infraMonitoring/getK8sClustersList.ts
index b08090ed2a..f56d21bd81 100644
--- a/frontend/src/api/infraMonitoring/getK8sClustersList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sClustersList.ts
@@ -75,7 +75,9 @@ export const getK8sClustersList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts b/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts
index a35f8871ec..75ea41f64d 100644
--- a/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts
@@ -83,7 +83,9 @@ export const getK8sDaemonSetsList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts b/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts
index f39c62c88b..4dd19b3dd4 100644
--- a/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts
@@ -82,7 +82,9 @@ export const getK8sDeploymentsList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sJobsList.ts b/frontend/src/api/infraMonitoring/getK8sJobsList.ts
index 828e42a79d..592ee8df3f 100644
--- a/frontend/src/api/infraMonitoring/getK8sJobsList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sJobsList.ts
@@ -82,7 +82,9 @@ export const getK8sJobsList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts b/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts
index a492aac045..86e7c28adf 100644
--- a/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts
@@ -73,7 +73,9 @@ export const getK8sNamespacesList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sNodesList.ts b/frontend/src/api/infraMonitoring/getK8sNodesList.ts
index d0045f4820..9d61ebb3cc 100644
--- a/frontend/src/api/infraMonitoring/getK8sNodesList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sNodesList.ts
@@ -77,7 +77,9 @@ export const getK8sNodesList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sPodsList.ts b/frontend/src/api/infraMonitoring/getK8sPodsList.ts
index 560788285f..57fadbbb0b 100644
--- a/frontend/src/api/infraMonitoring/getK8sPodsList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sPodsList.ts
@@ -113,7 +113,9 @@ export const getK8sPodsList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getK8sVolumesList.ts b/frontend/src/api/infraMonitoring/getK8sVolumesList.ts
index 2089e5cd59..c36eb60257 100644
--- a/frontend/src/api/infraMonitoring/getK8sVolumesList.ts
+++ b/frontend/src/api/infraMonitoring/getK8sVolumesList.ts
@@ -98,7 +98,9 @@ export const getK8sVolumesList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts b/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts
index 2544c0cfe3..681eac80f6 100644
--- a/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts
+++ b/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts
@@ -81,7 +81,9 @@ export const getK8sStatefulSetsList = async (
...props.filters,
items: props.filters.items.reduce<typeof props.filters.items>(
(acc, item) => {
- if (item.value === undefined) return acc;
+ if (item.value === undefined) {
+ return acc;
+ }
if (
item.key &&
typeof item.key === 'object' &&
diff --git a/frontend/src/api/v5/queryRange/prepareQueryRangePayloadV5.ts b/frontend/src/api/v5/queryRange/prepareQueryRangePayloadV5.ts
index d30051716f..664176426a 100644
--- a/frontend/src/api/v5/queryRange/prepareQueryRangePayloadV5.ts
+++ b/frontend/src/api/v5/queryRange/prepareQueryRangePayloadV5.ts
@@ -68,8 +68,12 @@ export function mapPanelTypeToRequestType(panelType: PANEL_TYPES): RequestType {
* Gets signal type from data source
*/
function getSignalType(dataSource: string): 'traces' | 'logs' | 'metrics' {
- if (dataSource === 'traces') return 'traces';
- if (dataSource === 'logs') return 'logs';
+ if (dataSource === 'traces') {
+ return 'traces';
+ }
+ if (dataSource === 'logs') {
+ return 'logs';
+ }
return 'metrics';
}
@@ -509,7 +513,9 @@ function reduceQueriesToObject(
// eslint-disable-line @typescript-eslint/no-explicit-any
const legends: Record<string, string> = {};
const queries = queryArray.reduce((acc, queryItem) => {
- if (!queryItem.query) return acc;
+ if (!queryItem.query) {
+ return acc;
+ }
acc[queryItem.name] = queryItem;
legends[queryItem.name] = queryItem.legend;
return acc;
diff --git a/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.tsx b/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.tsx
index d4c34bdf0a..f05944f0d0 100644
--- a/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.tsx
+++ b/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.tsx
@@ -20,7 +20,6 @@ import {
getQueueOverview,
QueueOverviewResponse,
} from 'api/messagingQueues/celery/getQueueOverview';
-import { isNumber } from 'chart.js/helpers';
import { ResizeTable } from 'components/ResizeTable';
import { LOCALSTORAGE } from 'constants/localStorage';
import { QueryParams } from 'constants/query';
@@ -33,6 +32,7 @@ import { useMutation } from 'react-query';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
import { GlobalReducer } from 'types/reducer/globalTime';
+import { formatNumericValue } from 'utils/numericUtils';
const INITIAL_PAGE_SIZE = 20;
@@ -60,8 +60,12 @@ function ProgressRender(item: string | number): JSX.Element {
size="small"
strokeColor={((): string => {
const cpuPercent = percent;
- if (cpuPercent >= 90) return Color.BG_SAKURA_500;
- if (cpuPercent >= 60) return Color.BG_AMBER_500;
+ if (cpuPercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (cpuPercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
@@ -239,10 +243,7 @@ function getColumns(data: RowData[]): TableColumnsType<RowData> {
const bValue = Number(b.p95_latency);
return aValue - bValue;
},
- render: (value: number | string): string => {
- if (!isNumber(value)) return value.toString();
- return (typeof value === 'string' ? parseFloat(value) : value).toFixed(3);
- },
+ render: formatNumericValue,
},
{
title: 'THROUGHPUT (ops/s)',
@@ -257,10 +258,7 @@ function getColumns(data: RowData[]): TableColumnsType<RowData> {
const bValue = Number(b.throughput);
return aValue - bValue;
},
- render: (value: number | string): string => {
- if (!isNumber(value)) return value.toString();
- return (typeof value === 'string' ? parseFloat(value) : value).toFixed(3);
- },
+ render: formatNumericValue,
},
];
}
@@ -337,7 +335,9 @@ function makeFilters(urlQuery: URLSearchParams): Filter[] {
return filterConfigs
.map(({ paramName, operator, key }) => {
const value = urlQuery.get(paramName);
- if (!value) return null;
+ if (!value) {
+ return null;
+ }
return {
key: {
@@ -464,7 +464,9 @@ export default function CeleryOverviewTable({
const getFilteredData = useCallback(
(data: RowData[]): RowData[] => {
- if (!searchText) return data;
+ if (!searchText) {
+ return data;
+ }
const searchLower = searchText.toLowerCase();
return data.filter((record) =>
diff --git a/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/useGetCeleryFilters.ts b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/useGetCeleryFilters.ts
index 640ddd0cab..4f6ffd378d 100644
--- a/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/useGetCeleryFilters.ts
+++ b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/useGetCeleryFilters.ts
@@ -69,7 +69,9 @@ export function useGetAllFilters(props: Filters): GetAllFiltersResponse {
const uniqueValues = [
...new Set(
responses.flatMap(({ payload }) => {
- if (!payload) return [];
+ if (!payload) {
+ return [];
+ }
const dataType = filterAttributeKeyDataType || DataTypes.String;
const key = DATA_TYPE_VS_ATTRIBUTE_VALUES_KEY[dataType];
diff --git a/frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphUtils.ts b/frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphUtils.ts
index a289d155bc..0d5f8713cd 100644
--- a/frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphUtils.ts
+++ b/frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphUtils.ts
@@ -11,12 +11,24 @@ import { v4 as uuidv4 } from 'uuid';
export const getStepInterval = (startTime: number, endTime: number): number => {
const diffInMinutes = (endTime - startTime) / 1000000 / (60 * 1000); // Convert to minutes
- if (diffInMinutes <= 15) return 60; // 15 min or less
- if (diffInMinutes <= 30) return 60; // 30 min or less
- if (diffInMinutes <= 60) return 120; // 1 hour or less
- if (diffInMinutes <= 360) return 520; // 6 hours or less
- if (diffInMinutes <= 1440) return 2440; // 1 day or less
- if (diffInMinutes <= 10080) return 10080; // 1 week or less
+ if (diffInMinutes <= 15) {
+ return 60;
+ } // 15 min or less
+ if (diffInMinutes <= 30) {
+ return 60;
+ } // 30 min or less
+ if (diffInMinutes <= 60) {
+ return 120;
+ } // 1 hour or less
+ if (diffInMinutes <= 360) {
+ return 520;
+ } // 6 hours or less
+ if (diffInMinutes <= 1440) {
+ return 2440;
+ } // 1 day or less
+ if (diffInMinutes <= 10080) {
+ return 10080;
+ } // 1 week or less
return 54000; // More than a week (use monthly interval)
};
diff --git a/frontend/src/components/CeleryTask/CeleryTaskGraph/useGetValueFromWidget.ts b/frontend/src/components/CeleryTask/CeleryTaskGraph/useGetValueFromWidget.ts
index 87f1c4f343..376d71325b 100644
--- a/frontend/src/components/CeleryTask/CeleryTaskGraph/useGetValueFromWidget.ts
+++ b/frontend/src/components/CeleryTask/CeleryTaskGraph/useGetValueFromWidget.ts
@@ -49,8 +49,12 @@ export const useGetValueFromWidget = (
const isError = queries.some((query) => query.isError);
const values = queries.map((query) => {
- if (query.isLoading) return 'Loading...';
- if (query.isError) return 'Error';
+ if (query.isLoading) {
+ return 'Loading...';
+ }
+ if (query.isError) {
+ return 'Error';
+ }
const value = parseFloat(
query.data?.payload?.data?.newResult?.data?.result?.[0]?.series?.[0]
diff --git a/frontend/src/components/CeleryTask/useNavigateToExplorer.ts b/frontend/src/components/CeleryTask/useNavigateToExplorer.ts
index bae077887d..9ec2c4af6c 100644
--- a/frontend/src/components/CeleryTask/useNavigateToExplorer.ts
+++ b/frontend/src/components/CeleryTask/useNavigateToExplorer.ts
@@ -49,7 +49,9 @@ export function useNavigateToExplorer(): (
...(item.filters?.items || []),
...selectedFilters,
].filter((item) => {
- if (seen.has(item.id)) return false;
+ if (seen.has(item.id)) {
+ return false;
+ }
seen.add(item.id);
return true;
});
diff --git a/frontend/src/components/ClientSideQBSearch/ClientSideQBSearch.tsx b/frontend/src/components/ClientSideQBSearch/ClientSideQBSearch.tsx
index 9cb6733c8d..8bfa9b947a 100644
--- a/frontend/src/components/ClientSideQBSearch/ClientSideQBSearch.tsx
+++ b/frontend/src/components/ClientSideQBSearch/ClientSideQBSearch.tsx
@@ -440,9 +440,12 @@ function ClientSideQBSearch(
const values: Array<string | number | boolean> = [];
const { tagValue } = getTagToken(searchValue);
if (isArray(tagValue)) {
- if (!isEmpty(tagValue[tagValue.length - 1]))
+ if (!isEmpty(tagValue[tagValue.length - 1])) {
values.push(tagValue[tagValue.length - 1]);
- } else if (!isEmpty(tagValue)) values.push(tagValue);
+ }
+ } else if (!isEmpty(tagValue)) {
+ values.push(tagValue);
+ }
const currentAttributeValues =
attributeValues?.stringAttributeValues ||
@@ -556,7 +559,9 @@ function ClientSideQBSearch(
disabled={isDisabled}
$isEnabled={!!searchValue}
onClick={(): void => {
- if (!isDisabled) tagEditHandler(value);
+ if (!isDisabled) {
+ tagEditHandler(value);
+ }
}}
>
{chipValue}
diff --git a/frontend/src/components/CustomTimePicker/timezoneUtils.ts b/frontend/src/components/CustomTimePicker/timezoneUtils.ts
index bca511e497..724488c818 100644
--- a/frontend/src/components/CustomTimePicker/timezoneUtils.ts
+++ b/frontend/src/components/CustomTimePicker/timezoneUtils.ts
@@ -38,7 +38,9 @@ const normalizeTimezoneName = (timezone: string): string => {
};
const formatOffset = (offsetMinutes: number): string => {
- if (offsetMinutes === 0) return 'UTC';
+ if (offsetMinutes === 0) {
+ return 'UTC';
+ }
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
const minutes = Math.abs(offsetMinutes) % 60;
diff --git a/frontend/src/components/DraggableTableRow/index.tsx b/frontend/src/components/DraggableTableRow/index.tsx
index 7c4a48336b..005da6cc69 100644
--- a/frontend/src/components/DraggableTableRow/index.tsx
+++ b/frontend/src/components/DraggableTableRow/index.tsx
@@ -16,7 +16,9 @@ function DraggableTableRow({
const handleDrop = useCallback(
(item: { index: number }) => {
- if (moveRow) moveRow(item.index, index);
+ if (moveRow) {
+ moveRow(item.index, index);
+ }
},
[moveRow, index],
);
diff --git a/frontend/src/components/Editor/index.tsx b/frontend/src/components/Editor/index.tsx
index 5f70d92c41..432bbcdebb 100644
--- a/frontend/src/components/Editor/index.tsx
+++ b/frontend/src/components/Editor/index.tsx
@@ -13,9 +13,13 @@ function Editor({
const isDarkMode = useIsDarkMode();
const onChangeHandler = (newValue?: string): void => {
- if (readOnly) return;
+ if (readOnly) {
+ return;
+ }
- if (typeof newValue === 'string' && onChange) onChange(newValue);
+ if (typeof newValue === 'string' && onChange) {
+ onChange(newValue);
+ }
};
const editorOptions = useMemo(
diff --git a/frontend/src/components/ExplorerCard/MenuItemGenerator.tsx b/frontend/src/components/ExplorerCard/MenuItemGenerator.tsx
index 0c77dc638a..86e088b8cf 100644
--- a/frontend/src/components/ExplorerCard/MenuItemGenerator.tsx
+++ b/frontend/src/components/ExplorerCard/MenuItemGenerator.tsx
@@ -52,7 +52,9 @@ function MenuItemGenerator({
const onMenuItemSelectHandler = useCallback(
({ key }: { key: string }): void => {
const currentViewDetails = getViewDetailsUsingViewKey(key, viewData);
- if (!currentViewDetails) return;
+ if (!currentViewDetails) {
+ return;
+ }
const { query, name, id, panelType: currentPanelType } = currentViewDetails;
handleExplorerTabChange(currentPanelType, {
diff --git a/frontend/src/components/Graph/yAxisConfig.ts b/frontend/src/components/Graph/yAxisConfig.ts
index 01dd962363..8e16fc09f3 100644
--- a/frontend/src/components/Graph/yAxisConfig.ts
+++ b/frontend/src/components/Graph/yAxisConfig.ts
@@ -28,9 +28,15 @@ export const getYAxisFormattedValue = (
const numValue = parseFloat(value);
// Handle non-numeric or special values first.
- if (isNaN(numValue)) return 'NaN';
- if (numValue === Infinity) return '∞';
- if (numValue === -Infinity) return '-∞';
+ if (isNaN(numValue)) {
+ return 'NaN';
+ }
+ if (numValue === Infinity) {
+ return '∞';
+ }
+ if (numValue === -Infinity) {
+ return '-∞';
+ }
// For all other standard formats, delegate to grafana/data's built-in formatter.
const computeDecimals = (): number | undefined => {
@@ -41,8 +47,12 @@ export const getYAxisFormattedValue = (
};
const fallbackFormat = (): string => {
- if (precision === PrecisionOptionsEnum.FULL) return numValue.toString();
- if (precision === 0) return Math.round(numValue).toString();
+ if (precision === PrecisionOptionsEnum.FULL) {
+ return numValue.toString();
+ }
+ if (precision === 0) {
+ return Math.round(numValue).toString();
+ }
return precision !== undefined
? numValue
.toFixed(precision)
diff --git a/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx b/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx
index d1384d7681..5f3d33ec62 100644
--- a/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx
+++ b/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx
@@ -450,8 +450,12 @@ function HostMetricsDetails({
size="small"
strokeColor={((): string => {
const cpuPercent = Number((host.cpu * 100).toFixed(1));
- if (cpuPercent >= 90) return Color.BG_SAKURA_500;
- if (cpuPercent >= 60) return Color.BG_AMBER_500;
+ if (cpuPercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (cpuPercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
@@ -463,8 +467,12 @@ function HostMetricsDetails({
size="small"
strokeColor={((): string => {
const memoryPercent = Number((host.memory * 100).toFixed(1));
- if (memoryPercent >= 90) return Color.BG_CHERRY_500;
- if (memoryPercent >= 60) return Color.BG_AMBER_500;
+ if (memoryPercent >= 90) {
+ return Color.BG_CHERRY_500;
+ }
+ if (memoryPercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
diff --git a/frontend/src/components/HostMetricsDetail/WaitlistFragment/WaitlistFragment.tsx b/frontend/src/components/HostMetricsDetail/WaitlistFragment/WaitlistFragment.tsx
index a3fae06b44..a17e4bc7e5 100644
--- a/frontend/src/components/HostMetricsDetail/WaitlistFragment/WaitlistFragment.tsx
+++ b/frontend/src/components/HostMetricsDetail/WaitlistFragment/WaitlistFragment.tsx
@@ -22,7 +22,9 @@ export default function WaitlistFragment({
const [isSuccess, setIsSuccess] = useState(false);
const handleJoinWaitlist = (): void => {
- if (!user || !user.email) return;
+ if (!user || !user.email) {
+ return;
+ }
setIsSubmitting(true);
diff --git a/frontend/src/components/LogDetail/QueryBuilderSearchWrapper.tsx b/frontend/src/components/LogDetail/QueryBuilderSearchWrapper.tsx
index 72d18b7e12..de8987cc18 100644
--- a/frontend/src/components/LogDetail/QueryBuilderSearchWrapper.tsx
+++ b/frontend/src/components/LogDetail/QueryBuilderSearchWrapper.tsx
@@ -29,8 +29,9 @@ function QueryBuilderSearchWrapper({
(!tagFiltersLength && (!filters || !filters.items.length)) ||
tagFiltersLength === filters?.items.length ||
!contextQuery
- )
+ ) {
return;
+ }
const nextQuery: Query = {
...contextQuery,
@@ -48,7 +49,9 @@ function QueryBuilderSearchWrapper({
};
// eslint-disable-next-line react/jsx-no-useless-fragment
- if (!contextQuery || !isEdit) return <></>;
+ if (!contextQuery || !isEdit) {
+ return <></>;
+ }
return (
<QueryBuilderSearch
diff --git a/frontend/src/components/LogDetail/index.tsx b/frontend/src/components/LogDetail/index.tsx
index 192b2a7589..3bb6be0fdc 100644
--- a/frontend/src/components/LogDetail/index.tsx
+++ b/frontend/src/components/LogDetail/index.tsx
@@ -75,7 +75,9 @@ function LogDetailInner({
const { stagedQuery, updateAllQueriesOperators } = useQueryBuilder();
const listQuery = useMemo(() => {
- if (!stagedQuery || stagedQuery.builder.queryData.length < 1) return null;
+ if (!stagedQuery || stagedQuery.builder.queryData.length < 1) {
+ return null;
+ }
return stagedQuery.builder.queryData.find((item) => !item.disabled) || null;
}, [stagedQuery]);
@@ -153,7 +155,9 @@ function LogDetailInner({
(value: string, queryIndex: number) => {
// update the query at the given index
setContextQuery((prev) => {
- if (!prev) return prev;
+ if (!prev) {
+ return prev;
+ }
return {
...prev,
diff --git a/frontend/src/components/Logs/RawLogView/index.tsx b/frontend/src/components/Logs/RawLogView/index.tsx
index d19888a2cd..a6a227ca1c 100644
--- a/frontend/src/components/Logs/RawLogView/index.tsx
+++ b/frontend/src/components/Logs/RawLogView/index.tsx
@@ -127,7 +127,9 @@ function RawLogView({
const handleClickExpand = useCallback(
(event: MouseEvent) => {
- if (isReadOnly) return;
+ if (isReadOnly) {
+ return;
+ }
// Use custom click handler if provided, otherwise use default behavior
if (onLogClick) {
diff --git a/frontend/src/components/LogsFormatOptionsMenu/LogsFormatOptionsMenu.tsx b/frontend/src/components/LogsFormatOptionsMenu/LogsFormatOptionsMenu.tsx
index dbe60b1ace..efbd09dd14 100644
--- a/frontend/src/components/LogsFormatOptionsMenu/LogsFormatOptionsMenu.tsx
+++ b/frontend/src/components/LogsFormatOptionsMenu/LogsFormatOptionsMenu.tsx
@@ -52,7 +52,9 @@ function OptionsMenu({
const onChange = useCallback(
(key: LogViewMode) => {
- if (!format) return;
+ if (!format) {
+ return;
+ }
format.onChange(key);
},
@@ -148,7 +150,9 @@ function OptionsMenu({
}
const handleKeyDown = (e: KeyboardEvent): void => {
- if (!selectedValue) return;
+ if (!selectedValue) {
+ return;
+ }
const optionsData = addColumn?.options || [];
diff --git a/frontend/src/components/MessageTip/index.tsx b/frontend/src/components/MessageTip/index.tsx
index 23c740395e..ce2a01fc58 100644
--- a/frontend/src/components/MessageTip/index.tsx
+++ b/frontend/src/components/MessageTip/index.tsx
@@ -13,7 +13,9 @@ function MessageTip({
message,
action,
}: MessageTipProps): JSX.Element | null {
- if (!show) return null;
+ if (!show) {
+ return null;
+ }
return (
<StyledAlert showIcon description={message} type="info" action={action} />
diff --git a/frontend/src/components/NewSelect/CustomMultiSelect.tsx b/frontend/src/components/NewSelect/CustomMultiSelect.tsx
index 1050cc253b..2400701d5a 100644
--- a/frontend/src/components/NewSelect/CustomMultiSelect.tsx
+++ b/frontend/src/components/NewSelect/CustomMultiSelect.tsx
@@ -165,7 +165,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
return;
}
- if (!onChange) return;
+ if (!onChange) {
+ return;
+ }
// Case 1: Cleared (empty array or undefined)
if (!newValue || currentNewValue.length === 0) {
@@ -327,7 +329,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
* Selects all chips
*/
const selectAllChips = useCallback((): void => {
- if (selectedValues.length === 0) return;
+ if (selectedValues.length === 0) {
+ return;
+ }
// When maxTagCount is set, only select visible chips
const visibleCount =
@@ -394,7 +398,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
* Handle copy event
*/
const handleCopy = useCallback((): void => {
- if (selectedChips.length === 0) return;
+ if (selectedChips.length === 0) {
+ return;
+ }
const selectedTexts = selectedChips
.sort((a, b) => a - b)
@@ -409,7 +415,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
* Handle cut event
*/
const handleCut = useCallback((): void => {
- if (selectedChips.length === 0) return;
+ if (selectedChips.length === 0) {
+ return;
+ }
// First copy the content
handleCopy();
@@ -577,7 +585,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
}
}
- if (onSearch) onSearch(trimmedValue);
+ if (onSearch) {
+ onSearch(trimmedValue);
+ }
},
[
onSearch,
@@ -596,7 +606,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
*/
const highlightMatchedText = useCallback(
(text: string, searchQuery: string): React.ReactNode => {
- if (!searchQuery || !highlightSearch) return text;
+ if (!searchQuery || !highlightSearch) {
+ return text;
+ }
try {
const parts = text.split(
@@ -632,7 +644,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
// Adjusted handleSelectAll for internal change handler
const handleSelectAll = useCallback((): void => {
- if (!options) return;
+ if (!options) {
+ return;
+ }
if (isAllSelected) {
// If all are selected, deselect all
@@ -658,7 +672,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
const handleItemSelection = (source?: string): void => {
// Special handling for ALL option is done by the caller
- if (!option.value) return;
+ if (!option.value) {
+ return;
+ }
if (source === 'option') {
if (
@@ -792,7 +808,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
// Helper function to get visible chip indices
const getVisibleChipIndices = useCallback((): number[] => {
// If no values, return empty array
- if (selectedValues.length === 0) return [];
+ if (selectedValues.length === 0) {
+ return [];
+ }
// If maxTagCount is set and greater than 0, only return the first maxTagCount indices
const visibleCount =
@@ -836,7 +854,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
// Get flattened list of all selectable options
const getFlatOptions = (): OptionData[] => {
- if (!visibleOptions) return [];
+ if (!visibleOptions) {
+ return [];
+ }
const flatList: OptionData[] = [];
const hasAll = enableAllSelection && !searchText;
@@ -1845,7 +1865,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
// but base indices/visibility on the original `selectedValues`
if (!isAllSelected) {
const index = selectedValues.indexOf(value);
- if (index === -1) return <div style={{ display: 'none' }} />; // Should not happen if value comes from displayValue
+ if (index === -1) {
+ return <div style={{ display: 'none' }} />;
+ } // Should not happen if value comes from displayValue
const isActive = index === activeChipIndex;
const isSelected = selectedChips.includes(index);
@@ -1931,7 +1953,9 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
// Normal clear behavior
handleInternalChange([], true);
- if (onClear) onClear();
+ if (onClear) {
+ onClear();
+ }
}, [onClear, handleInternalChange, allOptionShown, isAllSelected]);
// ===== Component Rendering =====
diff --git a/frontend/src/components/NewSelect/CustomSelect.tsx b/frontend/src/components/NewSelect/CustomSelect.tsx
index f3ff021dbc..c13e775506 100644
--- a/frontend/src/components/NewSelect/CustomSelect.tsx
+++ b/frontend/src/components/NewSelect/CustomSelect.tsx
@@ -147,7 +147,9 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
*/
const highlightMatchedText = useCallback(
(text: string, searchQuery: string): React.ReactNode => {
- if (!searchQuery || !highlightSearch) return text;
+ if (!searchQuery || !highlightSearch) {
+ return text;
+ }
try {
const parts = text.split(
@@ -257,8 +259,12 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
<CloseOutlined
onClick={(e): void => {
e.stopPropagation();
- if (onChange) onChange(undefined, []);
- if (onClear) onClear();
+ if (onChange) {
+ onChange(undefined, []);
+ }
+ if (onClear) {
+ onClear();
+ }
}}
/>
),
@@ -280,7 +286,9 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
setActiveOptionIndex(0);
}
- if (onSearch) onSearch(trimmedValue);
+ if (onSearch) {
+ onSearch(trimmedValue);
+ }
},
[onSearch, isOpen],
);
@@ -301,7 +309,9 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
if (isOpen) {
// Get flattened list of all selectable options
const getFlatOptions = (): OptionData[] => {
- if (!filteredOptions) return [];
+ if (!filteredOptions) {
+ return [];
+ }
const flatList: OptionData[] = [];
diff --git a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx
index 0a457f9d6b..2fdcb15fc9 100644
--- a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx
+++ b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx
@@ -204,7 +204,9 @@ describe('CustomMultiSelect Component', () => {
options.forEach((option) => {
const text = option.textContent || '';
- if (text.includes('Option 2')) foundOption2 = true;
+ if (text.includes('Option 2')) {
+ foundOption2 = true;
+ }
});
expect(foundOption2).toBe(true);
diff --git a/frontend/src/components/NewSelect/utils.ts b/frontend/src/components/NewSelect/utils.ts
index 819aec2ae8..8e2aed7f1a 100644
--- a/frontend/src/components/NewSelect/utils.ts
+++ b/frontend/src/components/NewSelect/utils.ts
@@ -26,7 +26,9 @@ export const prioritizeOrAddOptionForSingleSelect = (
(subOption) => subOption.value === value,
);
- if (extractedOption) foundOption = extractedOption;
+ if (extractedOption) {
+ foundOption = extractedOption;
+ }
// Keep the group if it still has remaining options
return remainingSubOptions.length > 0
@@ -115,7 +117,9 @@ export const filterOptionsBySearch = (
options: OptionData[],
searchText: string,
): OptionData[] => {
- if (!searchText.trim()) return options;
+ if (!searchText.trim()) {
+ return options;
+ }
const lowerSearchText = searchText.toLowerCase();
diff --git a/frontend/src/components/OverflowInputToolTip/OverflowInputToolTip.test.tsx b/frontend/src/components/OverflowInputToolTip/OverflowInputToolTip.test.tsx
index a3b49e53dd..334b74fc9a 100644
--- a/frontend/src/components/OverflowInputToolTip/OverflowInputToolTip.test.tsx
+++ b/frontend/src/components/OverflowInputToolTip/OverflowInputToolTip.test.tsx
@@ -25,10 +25,14 @@ function mockOverflow(clientWidth: number, scrollWidth: number): void {
function queryTooltipInner(): HTMLElement | null {
// find element that has role="tooltip" (could be the inner itself)
const tooltip = document.querySelector<HTMLElement>('[role="tooltip"]');
- if (!tooltip) return document.querySelector(TOOLTIP_INNER_SELECTOR);
+ if (!tooltip) {
+ return document.querySelector(TOOLTIP_INNER_SELECTOR);
+ }
// if the role element is already the inner, return it; otherwise return its descendant
- if (tooltip.classList.contains('ant-tooltip-inner')) return tooltip;
+ if (tooltip.classList.contains('ant-tooltip-inner')) {
+ return tooltip;
+ }
return (
(tooltip.querySelector(TOOLTIP_INNER_SELECTOR) as HTMLElement) ??
document.querySelector(TOOLTIP_INNER_SELECTOR)
@@ -52,7 +56,9 @@ describe('OverflowInputToolTip', () => {
});
const tooltipInner = queryTooltipInner();
- if (!tooltipInner) throw new Error('Tooltip inner not found');
+ if (!tooltipInner) {
+ throw new Error('Tooltip inner not found');
+ }
expect(
within(tooltipInner).getByText('Very long overflowing text'),
).toBeInTheDocument();
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/QueryAddOns/HavingFilter/HavingFilter.tsx b/frontend/src/components/QueryBuilderV2/QueryV2/QueryAddOns/HavingFilter/HavingFilter.tsx
index 61427211cd..949a8a0436 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/QueryAddOns/HavingFilter/HavingFilter.tsx
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/QueryAddOns/HavingFilter/HavingFilter.tsx
@@ -157,7 +157,9 @@ function HavingFilter({
// Helper to check if we're after an operator
const isAfterOperator = (tokens: string[]): boolean => {
- if (tokens.length === 0) return false;
+ if (tokens.length === 0) {
+ return false;
+ }
const lastToken = tokens[tokens.length - 1];
// Check if the last token is exactly an operator or ends with an operator and space
return havingOperators.some((op) => {
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/QueryAggregation/QueryAggregationSelect.tsx b/frontend/src/components/QueryBuilderV2/QueryV2/QueryAggregation/QueryAggregationSelect.tsx
index 57d2182756..c056a97cc9 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/QueryAggregation/QueryAggregationSelect.tsx
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/QueryAggregation/QueryAggregationSelect.tsx
@@ -84,25 +84,33 @@ function getFunctionContextAtCursor(
let funcName: string | null = null;
let parenStack = 0;
for (let i = cursorPos - 1; i >= 0; i--) {
- if (text[i] === ')') parenStack++;
- else if (text[i] === '(') {
+ if (text[i] === ')') {
+ parenStack++;
+ } else if (text[i] === '(') {
if (parenStack === 0) {
openParenIndex = i;
const before = text.slice(0, i);
const match = before.match(/(\w+)\s*$/);
- if (match) funcName = match[1].toLowerCase();
+ if (match) {
+ funcName = match[1].toLowerCase();
+ }
break;
}
parenStack--;
}
}
- if (openParenIndex === -1 || !funcName) return null;
+ if (openParenIndex === -1 || !funcName) {
+ return null;
+ }
// Scan forwards to find the matching closing parenthesis
let closeParenIndex = -1;
let depth = 1;
for (let j = openParenIndex + 1; j < text.length; j++) {
- if (text[j] === '(') depth++;
- else if (text[j] === ')') depth--;
+ if (text[j] === '(') {
+ depth++;
+ } else if (text[j] === ')') {
+ depth--;
+ }
if (depth === 0) {
closeParenIndex = j;
break;
@@ -277,10 +285,14 @@ function QueryAggregationSelect({
// Transaction filter to limit aggregations
const transactionFilterExtension = useMemo(() => {
- if (maxAggregations === undefined) return [];
+ if (maxAggregations === undefined) {
+ return [];
+ }
return EditorState.transactionFilter.of((tr: Transaction) => {
- if (!tr.docChanged) return tr;
+ if (!tr.docChanged) {
+ return tr;
+ }
const regex = /([a-zA-Z_][\w]*)\s*\(([^)]*)\)/g;
const oldMatches = [
@@ -425,7 +437,9 @@ function QueryAggregationSelect({
() =>
Object.keys(aggregateAttributeData?.data.data.keys || {}).flatMap((key) => {
const attributeKeys = aggregateAttributeData?.data.data.keys[key];
- if (!attributeKeys) return [];
+ if (!attributeKeys) {
+ return [];
+ }
return attributeKeys.map((attributeKey) => ({
label: attributeKey.name,
@@ -482,7 +496,9 @@ function QueryAggregationSelect({
const start = match.index ?? 0;
return cursorPos >= start && cursorPos <= start + match[0].length;
});
- if (!isEditing) return null;
+ if (!isEditing) {
+ return null;
+ }
}
}
@@ -523,7 +539,9 @@ function QueryAggregationSelect({
const argsString = doc.slice(lastOpenParen + 1, cursorPos);
argsString.split(',').forEach((arg) => {
const trimmed = arg.trim();
- if (trimmed) usedArgs.add(trimmed);
+ if (trimmed) {
+ usedArgs.add(trimmed);
+ }
});
}
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/QueryFooter/QueryFooter.tsx b/frontend/src/components/QueryBuilderV2/QueryV2/QueryFooter/QueryFooter.tsx
index 3f50471623..e7c6526a9e 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/QueryFooter/QueryFooter.tsx
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/QueryFooter/QueryFooter.tsx
@@ -31,7 +31,9 @@ function TraceOperatorSection({
]);
const traceOperatorWarning = useMemo(() => {
- if (currentQuery.builder.queryData.length === 0) return '';
+ if (currentQuery.builder.queryData.length === 0) {
+ return '';
+ }
const firstQuery = currentQuery.builder.queryData[0];
return `Currently, you are only seeing results from query ${firstQuery.queryName}. Add a trace operator to combine results of multiple queries.`;
}, [currentQuery]);
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx b/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx
index b4c1104554..2548ffc04a 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx
@@ -135,10 +135,14 @@ function QuerySearch({
const updateEditorValue = useCallback(
(value: string, options: { skipOnChange?: boolean } = {}): void => {
const view = editorRef.current;
- if (!view) return;
+ if (!view) {
+ return;
+ }
const currentValue = view.state.doc.toString();
- if (currentValue === value) return;
+ if (currentValue === value) {
+ return;
+ }
if (options.skipOnChange) {
isProgrammaticChangeRef.current = true;
@@ -165,7 +169,9 @@ function QuerySearch({
useEffect(
() => {
- if (!isEditorReady) return;
+ if (!isEditorReady) {
+ return;
+ }
const newExpression = queryData.filter?.expression || '';
const currentExpression = getCurrentExpression();
@@ -236,7 +242,9 @@ function QuerySearch({
const toggleSuggestions = useCallback(
(timeout?: number) => {
const timeoutId = setTimeout(() => {
- if (!editorRef.current) return;
+ if (!editorRef.current) {
+ return;
+ }
if (isFocused) {
startCompletion(editorRef.current);
} else {
@@ -281,7 +289,9 @@ function QuerySearch({
options.forEach((opt) => merged.set(opt.label, opt));
if (searchText && lastKeyRef.current !== searchText) {
(keySuggestions || []).forEach((opt) => {
- if (!merged.has(opt.label)) merged.set(opt.label, opt);
+ if (!merged.has(opt.label)) {
+ merged.set(opt.label, opt);
+ }
});
}
setKeySuggestions(Array.from(merged.values()));
@@ -346,7 +356,9 @@ function QuerySearch({
// Helper function to check if operator is for list operations (IN, NOT IN, etc.)
const isListOperator = (op: string | undefined): boolean => {
- if (!op) return false;
+ if (!op) {
+ return false;
+ }
return op.toUpperCase() === 'IN' || op.toUpperCase() === 'NOT IN';
};
@@ -400,8 +412,9 @@ function QuerySearch({
!key ||
(key === activeKey && !isLoadingSuggestions && !fetchingComplete) ||
!isMountedRef.current
- )
+ ) {
return;
+ }
// Set loading state and store the key we're fetching for
setIsLoadingSuggestions(true);
@@ -538,7 +551,9 @@ function QuerySearch({
);
const handleUpdate = useCallback((viewUpdate: { view: EditorView }): void => {
- if (!isMountedRef.current) return;
+ if (!isMountedRef.current) {
+ return;
+ }
if (!editorRef.current) {
editorRef.current = viewUpdate.view;
@@ -582,13 +597,21 @@ function QuerySearch({
| 'bracketList'
| null = null;
- if (context.isInKey) newContextType = 'key';
- else if (context.isInOperator) newContextType = 'operator';
- else if (context.isInValue) newContextType = 'value';
- else if (context.isInConjunction) newContextType = 'conjunction';
- else if (context.isInFunction) newContextType = 'function';
- else if (context.isInParenthesis) newContextType = 'parenthesis';
- else if (context.isInBracketList) newContextType = 'bracketList';
+ if (context.isInKey) {
+ newContextType = 'key';
+ } else if (context.isInOperator) {
+ newContextType = 'operator';
+ } else if (context.isInValue) {
+ newContextType = 'value';
+ } else if (context.isInConjunction) {
+ newContextType = 'conjunction';
+ } else if (context.isInFunction) {
+ newContextType = 'function';
+ } else if (context.isInParenthesis) {
+ newContextType = 'parenthesis';
+ } else if (context.isInBracketList) {
+ newContextType = 'bracketList';
+ }
setQueryContext(context);
@@ -637,7 +660,9 @@ function QuerySearch({
// Helper function to render a badge for the current context mode
const renderContextBadge = (): JSX.Element => {
- if (!editingMode) return <Tag>Unknown</Tag>;
+ if (!editingMode) {
+ return <Tag>Unknown</Tag>;
+ }
switch (editingMode) {
case 'key':
@@ -665,7 +690,9 @@ function QuerySearch({
// This matches words before the cursor position
// eslint-disable-next-line no-useless-escape
const word = context.matchBefore(/[a-zA-Z0-9_.:/?&=#%\-\[\]]*/);
- if (word?.from === word?.to && !context.explicit) return null;
+ if (word?.from === word?.to && !context.explicit) {
+ return null;
+ }
// Get current query from editor
const currentExpression = getCurrentExpression();
@@ -1228,7 +1255,9 @@ function QuerySearch({
}, [isFocused, toggleSuggestions]);
useEffect(() => {
- if (!queryContext) return;
+ if (!queryContext) {
+ return;
+ }
// Trigger suggestions based on context
if (editorRef.current) {
toggleSuggestions(10);
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/TraceOperatorEditor.tsx b/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/TraceOperatorEditor.tsx
index 9177a2b0a3..f8abeac6c5 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/TraceOperatorEditor.tsx
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/TraceOperatorEditor.tsx
@@ -104,7 +104,9 @@ function TraceOperatorEditor({
const toggleSuggestions = useCallback(
(timeout?: number) => {
const timeoutId = setTimeout(() => {
- if (!editorRef.current) return;
+ if (!editorRef.current) {
+ return;
+ }
if (isFocused) {
startCompletion(editorRef.current);
} else {
@@ -152,7 +154,9 @@ function TraceOperatorEditor({
// This matches words before the cursor position
// eslint-disable-next-line no-useless-escape
const word = context.matchBefore(/[a-zA-Z0-9_.:/?&=#%\-\[\]]*/);
- if (word?.from === word?.to && !context.explicit) return null;
+ if (word?.from === word?.to && !context.explicit) {
+ return null;
+ }
// Get the trace operator context at the cursor position
const queryContext = getTraceOperatorContextAtCursor(value, cursorPos.ch);
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/traceOperatorContextUtils.ts b/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/traceOperatorContextUtils.ts
index 90b49d52f6..a372c0b407 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/traceOperatorContextUtils.ts
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/traceOperatorContextUtils.ts
@@ -375,7 +375,9 @@ export function getTraceOperatorContextAtCursor(
let lastTokenBeforeCursor: IToken | null = null;
for (let i = 0; i < allTokens.length; i++) {
const token = allTokens[i];
- if (token.type === TraceOperatorGrammarLexer.EOF) continue;
+ if (token.type === TraceOperatorGrammarLexer.EOF) {
+ continue;
+ }
if (token.stop < cursorIndex || token.stop + 1 === cursorIndex) {
lastTokenBeforeCursor = token;
@@ -390,7 +392,9 @@ export function getTraceOperatorContextAtCursor(
let exactToken: IToken | null = null;
for (let i = 0; i < allTokens.length; i++) {
const token = allTokens[i];
- if (token.type === TraceOperatorGrammarLexer.EOF) continue;
+ if (token.type === TraceOperatorGrammarLexer.EOF) {
+ continue;
+ }
if (token.start <= cursorIndex && cursorIndex <= token.stop + 1) {
exactToken = token;
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/utils.ts b/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/utils.ts
index 4ebf1c6bbe..39796f7a78 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/utils.ts
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/TraceOperator/utils/utils.ts
@@ -7,8 +7,9 @@ export const getInvolvedQueriesInTraceOperator = (
!traceOperators ||
traceOperators.length === 0 ||
traceOperators.length > 1
- )
+ ) {
return [];
+ }
const currentTraceOperator = traceOperators[0];
diff --git a/frontend/src/components/QueryBuilderV2/utils.ts b/frontend/src/components/QueryBuilderV2/utils.ts
index 581761b5dd..13adb20ff8 100644
--- a/frontend/src/components/QueryBuilderV2/utils.ts
+++ b/frontend/src/components/QueryBuilderV2/utils.ts
@@ -190,7 +190,9 @@ const formatValuesForFilter = (
export const convertExpressionToFilters = (
expression: string,
): TagFilterItem[] => {
- if (!expression) return [];
+ if (!expression) {
+ return [];
+ }
const queryPairs = extractQueryPairs(expression);
const filters: TagFilterItem[] = [];
@@ -271,7 +273,9 @@ export const convertFiltersToExpressionWithExistingQuery = (
const { key, op, value } = filter;
// Skip invalid filters with no key
- if (!key) return;
+ if (!key) {
+ return;
+ }
let shouldAddToNonExisting = true; // Flag to decide if the filter should be added to non-existing filters
const sanitizedOperator = op.trim().toUpperCase();
@@ -545,7 +549,9 @@ export const removeKeysFromExpression = (
? existingQueryPairs.filter((pair) => {
const pairKey = pair.key?.trim().toLowerCase();
const matchesKey = pairKey === `${key}`.trim().toLowerCase();
- if (!matchesKey) return false;
+ if (!matchesKey) {
+ return false;
+ }
const value = pair.value?.toString().trim();
return value && value.includes('$');
})
diff --git a/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx b/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx
index da8f247f5d..8e29b9c95c 100644
--- a/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx
+++ b/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx
@@ -95,10 +95,14 @@ export default function CheckboxFilter(props: ICheckboxProps): JSX.Element {
// Derive isOpen from filter state + user action
const isOpen = useMemo(() => {
// If user explicitly toggled, respect that
- if (userToggleState !== null) return userToggleState;
+ if (userToggleState !== null) {
+ return userToggleState;
+ }
// Auto-open if this filter has active filters in the query
- if (isSomeFilterPresentForCurrentAttribute) return true;
+ if (isSomeFilterPresentForCurrentAttribute) {
+ return true;
+ }
// Otherwise use default behavior (first 2 filters open)
return filter.defaultOpen;
diff --git a/frontend/src/components/QuickFilters/QuickFilters.tsx b/frontend/src/components/QuickFilters/QuickFilters.tsx
index 638c942958..31bbd4f175 100644
--- a/frontend/src/components/QuickFilters/QuickFilters.tsx
+++ b/frontend/src/components/QuickFilters/QuickFilters.tsx
@@ -87,7 +87,9 @@ export default function QuickFilters(props: IQuickFiltersProps): JSX.Element {
// Generate query options based on available queries
const queryOptions = useMemo(() => {
- if (!currentQuery?.builder?.queryData) return [];
+ if (!currentQuery?.builder?.queryData) {
+ return [];
+ }
return currentQuery.builder.queryData.map((query, index) => ({
label: query.queryName || String.fromCharCode(65 + index),
diff --git a/frontend/src/components/QuickFilters/QuickFiltersSettings/OtherFilters.tsx b/frontend/src/components/QuickFilters/QuickFiltersSettings/OtherFilters.tsx
index 1d09df70de..e7bd67f333 100644
--- a/frontend/src/components/QuickFilters/QuickFiltersSettings/OtherFilters.tsx
+++ b/frontend/src/components/QuickFilters/QuickFiltersSettings/OtherFilters.tsx
@@ -141,9 +141,12 @@ function OtherFilters({
const renderFilters = (): React.ReactNode => {
const isLoading =
isFetchingSuggestions || isFetchingAggregateKeys || isLoadingFieldKeys;
- if (isLoading) return <OtherFiltersSkeleton />;
- if (!otherFilters?.length)
+ if (isLoading) {
+ return <OtherFiltersSkeleton />;
+ }
+ if (!otherFilters?.length) {
return <div className="no-values-found">No values found</div>;
+ }
return otherFilters.map((filter) => (
<div key={filter.key} className="qf-filter-item other-filters-item">
diff --git a/frontend/src/components/ResizeTable/ResizeTable.tsx b/frontend/src/components/ResizeTable/ResizeTable.tsx
index e426512cc4..f9e72b65b2 100644
--- a/frontend/src/components/ResizeTable/ResizeTable.tsx
+++ b/frontend/src/components/ResizeTable/ResizeTable.tsx
@@ -43,7 +43,9 @@ function ResizeTable({
const updateAllColumnWidths = useRef(
debounce((widthsConfig: Record<string, number>) => {
- if (!widgetId || !shouldPersistColumnWidths) return;
+ if (!widgetId || !shouldPersistColumnWidths) {
+ return;
+ }
setColumnWidths?.((prev) => ({
...prev,
[widgetId]: widthsConfig,
@@ -127,7 +129,9 @@ function ResizeTable({
}, [columns, columnWidths]);
useEffect(() => {
- if (!shouldPersistColumnWidths) return;
+ if (!shouldPersistColumnWidths) {
+ return;
+ }
// Collect all column widths in a single object
const newColumnWidths: Record<string, number> = {};
diff --git a/frontend/src/components/ShiftOverlay/formatShortcut.tsx b/frontend/src/components/ShiftOverlay/formatShortcut.tsx
index ad3500ca61..ccff762980 100644
--- a/frontend/src/components/ShiftOverlay/formatShortcut.tsx
+++ b/frontend/src/components/ShiftOverlay/formatShortcut.tsx
@@ -4,10 +4,14 @@ import { ArrowUp, ChevronUp, Command, Option } from 'lucide-react';
import { ReactNode } from 'react';
export function formatShortcut(shortcut?: string[]): ReactNode {
- if (!shortcut || shortcut.length === 0) return null;
+ if (!shortcut || shortcut.length === 0) {
+ return null;
+ }
const combo = shortcut.find((s) => typeof s === 'string' && s.trim());
- if (!combo) return null;
+ if (!combo) {
+ return null;
+ }
return combo.split('+').map((key) => {
const k = key.trim().toLowerCase();
diff --git a/frontend/src/components/ShiftOverlay/useShiftHoldOverlay.ts b/frontend/src/components/ShiftOverlay/useShiftHoldOverlay.ts
index 941686f999..3650690387 100644
--- a/frontend/src/components/ShiftOverlay/useShiftHoldOverlay.ts
+++ b/frontend/src/components/ShiftOverlay/useShiftHoldOverlay.ts
@@ -3,7 +3,9 @@ import { useEffect, useRef, useState } from 'react';
const HOLD_DELAY_MS = 500;
function isTypingContext(target: EventTarget | null): boolean {
- if (!(target instanceof HTMLElement)) return false;
+ if (!(target instanceof HTMLElement)) {
+ return false;
+ }
const tag = target.tagName;
return tag === 'INPUT' || tag === 'TEXTAREA' || target.isContentEditable;
@@ -24,7 +26,9 @@ export function useShiftHoldOverlay({
const isHoldingRef = useRef<boolean>(false);
useEffect((): (() => void) | void => {
- if (disabled) return;
+ if (disabled) {
+ return;
+ }
function cleanup(): void {
isHoldingRef.current = false;
@@ -38,8 +42,12 @@ export function useShiftHoldOverlay({
}
function onKeyDown(e: KeyboardEvent): void {
- if (e.key !== 'Shift') return;
- if (e.repeat) return;
+ if (e.key !== 'Shift') {
+ return;
+ }
+ if (e.repeat) {
+ return;
+ }
// Suppress in bad contexts
if (
@@ -62,7 +70,9 @@ export function useShiftHoldOverlay({
}
function onKeyUp(e: KeyboardEvent): void {
- if (e.key !== 'Shift') return;
+ if (e.key !== 'Shift') {
+ return;
+ }
cleanup();
}
diff --git a/frontend/src/components/Uplot/Uplot.tsx b/frontend/src/components/Uplot/Uplot.tsx
index 8bb044552a..b009d6df06 100644
--- a/frontend/src/components/Uplot/Uplot.tsx
+++ b/frontend/src/components/Uplot/Uplot.tsx
@@ -93,7 +93,9 @@ const Uplot = forwardRef<ToggleGraphProps | undefined, UplotProps>(
}, []);
const create = useCallback(() => {
- if (targetRef.current === null) return;
+ if (targetRef.current === null) {
+ return;
+ }
// If data is empty, hide cursor
if (data && data[0] && data[0]?.length === 0) {
diff --git a/frontend/src/components/ValueGraph/index.tsx b/frontend/src/components/ValueGraph/index.tsx
index 4c7ed3f34a..7da4a0f5d5 100644
--- a/frontend/src/components/ValueGraph/index.tsx
+++ b/frontend/src/components/ValueGraph/index.tsx
@@ -59,7 +59,9 @@ function ValueGraph({
// Adjust font size based on container size
useEffect(() => {
const updateFontSize = (): void => {
- if (!containerRef.current) return;
+ if (!containerRef.current) {
+ return;
+ }
const { width, height } = containerRef.current.getBoundingClientRect();
const minDimension = Math.min(width, height);
diff --git a/frontend/src/components/YAxisUnitSelector/YAxisUnitSelector.tsx b/frontend/src/components/YAxisUnitSelector/YAxisUnitSelector.tsx
index 5f1e8b7ab1..2f4625b8aa 100644
--- a/frontend/src/components/YAxisUnitSelector/YAxisUnitSelector.tsx
+++ b/frontend/src/components/YAxisUnitSelector/YAxisUnitSelector.tsx
@@ -26,7 +26,9 @@ function YAxisUnitSelector({
const universalUnit = mapMetricUnitToUniversalUnit(value);
const incompatibleUnitMessage = useMemo(() => {
- if (!initialValue || !value || loading) return '';
+ if (!initialValue || !value || loading) {
+ return '';
+ }
const initialUniversalUnit = mapMetricUnitToUniversalUnit(initialValue);
const currentUniversalUnit = mapMetricUnitToUniversalUnit(value);
if (initialUniversalUnit !== currentUniversalUnit) {
@@ -43,14 +45,18 @@ function YAxisUnitSelector({
searchTerm: string,
currentOption: DefaultOptionType | undefined,
): boolean => {
- if (!currentOption?.value) return false;
+ if (!currentOption?.value) {
+ return false;
+ }
const search = searchTerm.toLowerCase();
const unitId = currentOption.value.toString().toLowerCase();
const unitLabel = currentOption.children?.toString().toLowerCase() || '';
// Check label and id
- if (unitId.includes(search) || unitLabel.includes(search)) return true;
+ if (unitId.includes(search) || unitLabel.includes(search)) {
+ return true;
+ }
// Check aliases (from the mapping) using array iteration
const aliases = Array.from(
diff --git a/frontend/src/container/AlertHistory/Statistics/StatsCard/utils.ts b/frontend/src/container/AlertHistory/Statistics/StatsCard/utils.ts
index a2584aad37..dc0992bf9c 100644
--- a/frontend/src/container/AlertHistory/Statistics/StatsCard/utils.ts
+++ b/frontend/src/container/AlertHistory/Statistics/StatsCard/utils.ts
@@ -1,5 +1,7 @@
export const extractDayFromTimestamp = (timestamp: string | null): string => {
- if (!timestamp) return '';
+ if (!timestamp) {
+ return '';
+ }
const date = new Date(parseInt(timestamp, 10));
return date.getDate().toString();
};
@@ -7,6 +9,8 @@ export const extractDayFromTimestamp = (timestamp: string | null): string => {
export const convertTimestampToLocaleDateString = (
timestamp: string | null,
): string => {
- if (!timestamp) return '';
+ if (!timestamp) {
+ return '';
+ }
return new Date(parseInt(timestamp, 10)).toLocaleString();
};
diff --git a/frontend/src/container/AllError/tests/constants.ts b/frontend/src/container/AllError/tests/constants.ts
index 551885c77b..9f7e14e864 100644
--- a/frontend/src/container/AllError/tests/constants.ts
+++ b/frontend/src/container/AllError/tests/constants.ts
@@ -56,7 +56,9 @@ export const extractCompositeQueryObject = (
const urlObj = new URL(`http://dummy-base${url}`); // Add dummy base to parse relative URL
const encodedParam = urlObj.searchParams.get('compositeQuery');
- if (!encodedParam) return null;
+ if (!encodedParam) {
+ return null;
+ }
// Decode twice
const firstDecode = decodeURIComponent(encodedParam);
diff --git a/frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx b/frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx
index 4c3a78f3e7..d674d933fe 100644
--- a/frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx
+++ b/frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx
@@ -101,7 +101,9 @@ function AnomalyAlertEvaluationView({
hooks: {
draw: [
(u: any): void => {
- if (!selectedSeries) return;
+ if (!selectedSeries) {
+ return;
+ }
const { ctx } = u;
const upperBandIdx = 3;
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.tsx
index 0411e0437e..bce77f7b7f 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/DomainMetrics.tsx
@@ -157,8 +157,12 @@ function DomainMetrics({
const errorRatePercent = Number(
Number(formattedDomainMetricsData.errorRate).toFixed(2),
);
- if (errorRatePercent >= 90) return Color.BG_SAKURA_500;
- if (errorRatePercent >= 60) return Color.BG_AMBER_500;
+ if (errorRatePercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (errorRatePercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.tsx
index 1b176e420a..e23fbba1c7 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/EndPointMetrics.tsx
@@ -104,8 +104,12 @@ function EndPointMetrics({
const errorRatePercent = Number(
Number(metricsData?.errorRate ?? 0).toFixed(2),
);
- if (errorRatePercent >= 90) return Color.BG_SAKURA_500;
- if (errorRatePercent >= 60) return Color.BG_AMBER_500;
+ if (errorRatePercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (errorRatePercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/ExpandedRow.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/ExpandedRow.tsx
index 03001fdd3d..1ea07ba5b7 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/ExpandedRow.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/components/ExpandedRow.tsx
@@ -42,7 +42,9 @@ function ExpandedRow({
(state) => state.globalTime,
);
const groupedByRowDataQueryPayload = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData);
diff --git a/frontend/src/container/ApiMonitoring/queryParams.ts b/frontend/src/container/ApiMonitoring/queryParams.ts
index ed1ae8dc1e..74de35632b 100644
--- a/frontend/src/container/ApiMonitoring/queryParams.ts
+++ b/frontend/src/container/ApiMonitoring/queryParams.ts
@@ -35,7 +35,9 @@ function encodeParams(params: ApiMonitoringParams): string {
}
function decodeParams(value: string | null): ApiMonitoringParams {
- if (!value) return DEFAULT_PARAMS;
+ if (!value) {
+ return DEFAULT_PARAMS;
+ }
try {
return JSON.parse(decodeURIComponent(value));
} catch {
diff --git a/frontend/src/container/ApiMonitoring/utils.tsx b/frontend/src/container/ApiMonitoring/utils.tsx
index 188354b918..6f28fc54ec 100644
--- a/frontend/src/container/ApiMonitoring/utils.tsx
+++ b/frontend/src/container/ApiMonitoring/utils.tsx
@@ -208,9 +208,15 @@ export const columnsConfig: ColumnType<APIDomainsRowData>[] = [
: rowB.endpointCount;
// Handle cases where one or both values are empty
- if (!endpointA && !endpointB) return 0;
- if (!endpointA) return 1;
- if (!endpointB) return -1;
+ if (!endpointA && !endpointB) {
+ return 0;
+ }
+ if (!endpointA) {
+ return 1;
+ }
+ if (!endpointB) {
+ return -1;
+ }
return Number(endpointA) - Number(endpointB);
},
@@ -288,8 +294,12 @@ export const columnsConfig: ColumnType<APIDomainsRowData>[] = [
size="small"
strokeColor={((): string => {
const errorRatePercent = Number((errorRateValue as number).toFixed(2));
- if (errorRatePercent >= 90) return Color.BG_SAKURA_500;
- if (errorRatePercent >= 60) return Color.BG_AMBER_500;
+ if (errorRatePercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (errorRatePercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar error-rate"
@@ -992,7 +1002,9 @@ export const getEndPointsColumnsConfig = (
return (
<div className="endpoint-name-value">
{((): React.ReactNode => {
- if (!isGroupedByAttribute) return null;
+ if (!isGroupedByAttribute) {
+ return null;
+ }
return expandedRowKeys.includes(record.key) ? (
<ChevronDown size={14} />
) : (
@@ -1065,8 +1077,12 @@ export const getEndPointsColumnsConfig = (
strokeColor={((): // eslint-disable-next-line sonarjs/no-identical-functions
string => {
const errorRatePercent = Number((errorRate as number).toFixed(1));
- if (errorRatePercent >= 90) return Color.BG_SAKURA_500;
- if (errorRatePercent >= 60) return Color.BG_AMBER_500;
+ if (errorRatePercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (errorRatePercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar error-rate"
@@ -1108,7 +1124,9 @@ export const formatEndPointsDataForTable = (
orderBy?: OrderByPayload | null,
// eslint-disable-next-line sonarjs/cognitive-complexity
): EndPointsTableRowData[] => {
- if (!data) return [];
+ if (!data) {
+ return [];
+ }
const isGroupedByAttribute = groupBy.length > 0;
let formattedData: EndPointsTableRowData[] = [];
@@ -1229,7 +1247,9 @@ export interface TopErrorsTableRowData {
export const formatTopErrorsDataForTable = (
scalarResult: TopErrorsResponseRow | undefined,
): TopErrorsTableRowData[] => {
- if (!scalarResult?.data) return [];
+ if (!scalarResult?.data) {
+ return [];
+ }
const columns = scalarResult.columns || [];
const rows = scalarResult.data || [];
@@ -1368,7 +1388,9 @@ export const createFiltersForSelectedRowData = (
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta = {} } = selectedRowData;
@@ -2313,7 +2335,9 @@ export const getFormattedEndPointMetricsData = (
export const getFormattedEndPointStatusCodeData = (
data: EndPointStatusCodeResponseRow[],
): EndPointStatusCodeData[] => {
- if (!data) return [];
+ if (!data) {
+ return [];
+ }
return data.map((row) => ({
key: v4(),
statusCode: getDisplayValue(row.data.response_status_code),
@@ -2410,7 +2434,9 @@ interface EndPointDropDownData {
export const getFormattedEndPointDropDownData = (
data: EndPointDropDownResponseRow[],
): EndPointDropDownData[] => {
- if (!data) return [];
+ if (!data) {
+ return [];
+ }
return data.map((row) => ({
key: v4(),
label: row.data[SPAN_ATTRIBUTES.URL_PATH] || row.data['url.full'] || '-',
@@ -2447,7 +2473,9 @@ export const getFormattedDependentServicesData = (
data: DependentServicesResponseRow[],
// eslint-disable-next-line sonarjs/cognitive-complexity
): DependentServicesData[] => {
- if (!data) return [];
+ if (!data) {
+ return [];
+ }
const totalCount = data?.reduce((acc, row) => acc + Number(row.data.A), 0);
return data?.map((row) => ({
key: v4(),
@@ -2548,8 +2576,12 @@ export const dependentServicesColumns: ColumnType<DependentServicesData>[] = [
const errorPercentagePercent = Number(
(errorPercentage as number).toFixed(2),
);
- if (errorPercentagePercent >= 90) return Color.BG_SAKURA_500;
- if (errorPercentagePercent >= 60) return Color.BG_AMBER_500;
+ if (errorPercentagePercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (errorPercentagePercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar error-rate"
@@ -2651,7 +2683,9 @@ export const groupStatusCodes = (
// First pass: collect all series and timestamps
result.forEach((series) => {
const statusCode = series.metric?.response_status_code;
- if (!statusCode) return;
+ if (!statusCode) {
+ return;
+ }
const statusClass = getStatusCodeClass(statusCode);
@@ -2691,7 +2725,9 @@ export const groupStatusCodes = (
// Second pass: aggregate values by status class and timestamp
result.forEach((series) => {
const statusCode = series.metric?.response_status_code;
- if (!statusCode) return;
+ if (!statusCode) {
+ return;
+ }
const statusClass = getStatusCodeClass(statusCode);
@@ -3082,8 +3118,12 @@ export const getAllEndpointsWidgetData = (
? 0
: errorRate) as number).toFixed(2),
);
- if (errorRatePercent >= 90) return Color.BG_SAKURA_500;
- if (errorRatePercent >= 60) return Color.BG_AMBER_500;
+ if (errorRatePercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (errorRatePercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar error-rate"
diff --git a/frontend/src/container/CloudIntegrationPage/ServicesSection/S3BucketsSelector.tsx b/frontend/src/container/CloudIntegrationPage/ServicesSection/S3BucketsSelector.tsx
index 11a82ca87f..df9c9062b3 100644
--- a/frontend/src/container/CloudIntegrationPage/ServicesSection/S3BucketsSelector.tsx
+++ b/frontend/src/container/CloudIntegrationPage/ServicesSection/S3BucketsSelector.tsx
@@ -33,7 +33,9 @@ function S3BucketsSelector({
// Get all regions to display (union of account regions and initialBucketsByRegion regions)
const allRegions = useMemo(() => {
- if (!activeAccount) return [];
+ if (!activeAccount) {
+ return [];
+ }
// Get unique regions from both sources
const initialRegions = Object.keys(initialBucketsByRegion);
diff --git a/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesList.tsx b/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesList.tsx
index 7e9a323418..b8b13cabc4 100644
--- a/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesList.tsx
+++ b/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesList.tsx
@@ -32,7 +32,9 @@ function ServicesList({
);
const filteredServices = useMemo(() => {
- if (filter === 'all_services') return services;
+ if (filter === 'all_services') {
+ return services;
+ }
return services.filter((service) => {
const isEnabled =
@@ -42,13 +44,19 @@ function ServicesList({
}, [services, filter]);
useEffect(() => {
- if (activeService || !services?.length) return;
+ if (activeService || !services?.length) {
+ return;
+ }
handleActiveService(services[0].id);
}, [services, activeService, handleActiveService]);
- if (isLoading) return <Spinner size="large" height="25vh" />;
- if (!services) return <div>No services found</div>;
+ if (isLoading) {
+ return <Spinner size="large" height="25vh" />;
+ }
+ if (!services) {
+ return <div>No services found</div>;
+ }
return (
<div className="services-list">
diff --git a/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesTabs.tsx b/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesTabs.tsx
index 6c027a4b56..b0e22dfe90 100644
--- a/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesTabs.tsx
+++ b/frontend/src/container/CloudIntegrationPage/ServicesSection/ServicesTabs.tsx
@@ -34,7 +34,9 @@ function ServicesFilter({
);
const { enabledCount, availableCount } = useMemo(() => {
- if (!services) return { enabledCount: 0, availableCount: 0 };
+ if (!services) {
+ return { enabledCount: 0, availableCount: 0 };
+ }
return services.reduce(
(acc, service) => {
@@ -58,8 +60,12 @@ function ServicesFilter({
[services, enabledCount, availableCount],
);
- if (isLoading) return null;
- if (!services?.length) return null;
+ if (isLoading) {
+ return null;
+ }
+ if (!services?.length) {
+ return null;
+ }
return (
<div className="services-filter">
diff --git a/frontend/src/container/CreateAlertChannels/index.tsx b/frontend/src/container/CreateAlertChannels/index.tsx
index 3796efce74..0485ed9e1e 100644
--- a/frontend/src/container/CreateAlertChannels/index.tsx
+++ b/frontend/src/container/CreateAlertChannels/index.tsx
@@ -476,7 +476,9 @@ function CreateAlertChannels({
break;
case ChannelType.Pagerduty:
request = preparePagerRequest();
- if (request) await testPagerApi(request);
+ if (request) {
+ await testPagerApi(request);
+ }
break;
case ChannelType.MsTeams:
request = prepareMsTeamsRequest();
diff --git a/frontend/src/container/CreateAlertV2/EvaluationSettings/EvaluationWindowPopover/useKeyboardNavigation.ts b/frontend/src/container/CreateAlertV2/EvaluationSettings/EvaluationWindowPopover/useKeyboardNavigation.ts
index 66eabe57aa..a8c39aaca6 100644
--- a/frontend/src/container/CreateAlertV2/EvaluationSettings/EvaluationWindowPopover/useKeyboardNavigation.ts
+++ b/frontend/src/container/CreateAlertV2/EvaluationSettings/EvaluationWindowPopover/useKeyboardNavigation.ts
@@ -16,7 +16,9 @@ export const useKeyboardNavigationForEvaluationWindowPopover = ({
const firstItemRef = useRef<HTMLDivElement>(null);
const getFocusableItems = useCallback((): HTMLElement[] => {
- if (!containerRef.current) return [];
+ if (!containerRef.current) {
+ return [];
+ }
return Array.from(
containerRef.current.querySelectorAll(
@@ -26,12 +28,16 @@ export const useKeyboardNavigationForEvaluationWindowPopover = ({
}, []);
const getInteractiveElements = useCallback((): HTMLElement[] => {
- if (!containerRef.current) return [];
+ if (!containerRef.current) {
+ return [];
+ }
const detailsSection = containerRef.current.querySelector(
'.evaluation-window-details',
);
- if (!detailsSection) return [];
+ if (!detailsSection) {
+ return [];
+ }
return Array.from(
detailsSection.querySelectorAll(
@@ -48,7 +54,9 @@ export const useKeyboardNavigationForEvaluationWindowPopover = ({
const navigateWithinSection = useCallback(
(direction: 'up' | 'down'): void => {
const items = getFocusableItems();
- if (items.length === 0) return;
+ if (items.length === 0) {
+ return;
+ }
const currentIndex = getCurrentIndex(items);
let nextIndex: number;
@@ -84,7 +92,9 @@ export const useKeyboardNavigationForEvaluationWindowPopover = ({
}
const items = getFocusableItems();
- if (items.length === 0) return;
+ if (items.length === 0) {
+ return;
+ }
const currentIndex = getCurrentIndex(items);
const DATA_ATTR = 'data-section-id';
@@ -114,7 +124,9 @@ export const useKeyboardNavigationForEvaluationWindowPopover = ({
const handleSelection = useCallback((): void => {
const activeElement = document.activeElement as HTMLElement;
- if (!activeElement || !onSelect) return;
+ if (!activeElement || !onSelect) {
+ return;
+ }
const value = activeElement.getAttribute('data-value');
const sectionId = activeElement.getAttribute('data-section-id');
@@ -161,7 +173,9 @@ export const useKeyboardNavigationForEvaluationWindowPopover = ({
useEffect((): (() => void) | undefined => {
const container = containerRef.current;
- if (!container) return undefined;
+ if (!container) {
+ return undefined;
+ }
container.addEventListener('keydown', handleKeyDown);
return (): void => container.removeEventListener('keydown', handleKeyDown);
diff --git a/frontend/src/container/CreateAlertV2/EvaluationSettings/__tests__/utils.test.ts b/frontend/src/container/CreateAlertV2/EvaluationSettings/__tests__/utils.test.ts
index 32eb21cd1c..67b3ebd196 100644
--- a/frontend/src/container/CreateAlertV2/EvaluationSettings/__tests__/utils.test.ts
+++ b/frontend/src/container/CreateAlertV2/EvaluationSettings/__tests__/utils.test.ts
@@ -492,7 +492,9 @@ describe('utils', () => {
jest.doMock('dayjs', () => {
const originalDayjs = jest.requireActual('dayjs');
const mockDayjs = (date?: string | Date): Dayjs => {
- if (date) return originalDayjs(date);
+ if (date) {
+ return originalDayjs(date);
+ }
return originalDayjs(MOCK_DATE_STRING_NON_LEAP_YEAR);
};
Object.assign(mockDayjs, originalDayjs);
@@ -599,7 +601,9 @@ describe('utils', () => {
jest.doMock('dayjs', () => {
const originalDayjs = jest.requireActual('dayjs');
const mockDayjs = (date?: string | Date): Dayjs => {
- if (date) return originalDayjs(date);
+ if (date) {
+ return originalDayjs(date);
+ }
return originalDayjs(MOCK_DATE_STRING_SPANS_MONTHS);
};
Object.assign(mockDayjs, originalDayjs);
diff --git a/frontend/src/container/CreateAlertV2/EvaluationSettings/utils.tsx b/frontend/src/container/CreateAlertV2/EvaluationSettings/utils.tsx
index 4788c4aee1..d8a9034801 100644
--- a/frontend/src/container/CreateAlertV2/EvaluationSettings/utils.tsx
+++ b/frontend/src/container/CreateAlertV2/EvaluationSettings/utils.tsx
@@ -94,14 +94,18 @@ export function buildAlertScheduleFromRRule(
maxOccurrences = 10,
): Date[] | null {
try {
- if (!rruleString) return null;
+ if (!rruleString) {
+ return null;
+ }
// Handle literal \n in string
let finalRRuleString = rruleString.replace(/\\n/g, '\n');
if (date) {
const dt = dayjs(date);
- if (!dt.isValid()) throw new Error('Invalid date provided');
+ if (!dt.isValid()) {
+ throw new Error('Invalid date provided');
+ }
const [hours = 0, minutes = 0, seconds = 0] = startAt.split(':').map(Number);
@@ -124,7 +128,9 @@ export function buildAlertScheduleFromRRule(
const rruleObj = rrulestr(finalRRuleString);
const occurrences: Date[] = [];
rruleObj.all((date, index) => {
- if (index >= maxOccurrences) return false;
+ if (index >= maxOccurrences) {
+ return false;
+ }
occurrences.push(date);
return true;
});
@@ -151,7 +157,9 @@ function generateMonthlyOccurrences(
for (let monthOffset = 0; monthOffset < scanMonths; monthOffset++) {
const monthDate = currentMonth.add(monthOffset, 'month');
targetDays.forEach((day) => {
- if (occurrences.length >= maxOccurrences) return;
+ if (occurrences.length >= maxOccurrences) {
+ return;
+ }
const daysInMonth = monthDate.daysInMonth();
if (day <= daysInMonth) {
@@ -185,7 +193,9 @@ function generateWeeklyOccurrences(
for (let weekOffset = 0; weekOffset < maxOccurrences; weekOffset++) {
const weekDate = currentWeek.add(weekOffset, 'week');
targetWeekdays.forEach((weekday) => {
- if (occurrences.length >= maxOccurrences) return;
+ if (occurrences.length >= maxOccurrences) {
+ return;
+ }
const targetDate = weekDate
.day(weekday)
diff --git a/frontend/src/container/CreateAlertV2/utils.tsx b/frontend/src/container/CreateAlertV2/utils.tsx
index 2788d4a938..4daf35405b 100644
--- a/frontend/src/container/CreateAlertV2/utils.tsx
+++ b/frontend/src/container/CreateAlertV2/utils.tsx
@@ -30,7 +30,9 @@ import { GetCreateAlertLocalStateFromAlertDefReturn } from './types';
export function Spinner(): JSX.Element | null {
const { isCreatingAlertRule, isUpdatingAlertRule } = useCreateAlertState();
- if (!isCreatingAlertRule && !isUpdatingAlertRule) return null;
+ if (!isCreatingAlertRule && !isUpdatingAlertRule) {
+ return null;
+ }
return createPortal(
<div className="sticky-page-spinner">
diff --git a/frontend/src/container/DashboardContainer/DashboardDescription/index.tsx b/frontend/src/container/DashboardContainer/DashboardDescription/index.tsx
index b0473f8fa9..37e6e91997 100644
--- a/frontend/src/container/DashboardContainer/DashboardDescription/index.tsx
+++ b/frontend/src/container/DashboardContainer/DashboardDescription/index.tsx
@@ -200,7 +200,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
message: 'Dashboard renamed successfully',
});
setIsRenameDashboardOpen(false);
- if (updatedDashboard.data) setSelectedDashboard(updatedDashboard.data);
+ if (updatedDashboard.data) {
+ setSelectedDashboard(updatedDashboard.data);
+ }
},
onError: () => {
setIsRenameDashboardOpen(true);
@@ -240,7 +242,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
}, [state.error, state.value, t, notifications]);
function handleAddRow(): void {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
const id = uuid();
const newRowWidgetMap: { widgets: Layout[]; collapsed: boolean } = {
@@ -291,8 +295,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
// eslint-disable-next-line sonarjs/no-identical-functions
onSuccess: (updatedDashboard) => {
if (updatedDashboard.data) {
- if (updatedDashboard.data.data.layout)
+ if (updatedDashboard.data.data.layout) {
setLayouts(sortLayout(updatedDashboard.data.data.layout));
+ }
setSelectedDashboard(updatedDashboard.data);
setPanelMap(updatedDashboard.data?.data?.panelMap || {});
}
diff --git a/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx b/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx
index 73f0df3b4e..8cc84b5dd4 100644
--- a/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx
+++ b/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx
@@ -143,9 +143,15 @@ describe('DynamicVariable Component', () => {
options.forEach((option) => {
const text = option.textContent?.trim();
- if (text === 'service.name') foundServiceName = true;
- if (text === 'http.status_code') foundHttpStatusCode = true;
- if (text === 'duration') foundDuration = true;
+ if (text === 'service.name') {
+ foundServiceName = true;
+ }
+ if (text === 'http.status_code') {
+ foundHttpStatusCode = true;
+ }
+ if (text === 'duration') {
+ foundDuration = true;
+ }
});
expect(foundServiceName).toBe(true);
diff --git a/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx b/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx
index c5c89f3fe7..e30aad43d1 100644
--- a/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx
+++ b/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx
@@ -127,7 +127,9 @@ function VariablesSettings({
};
useEffect(() => {
- if (!variablesSettingsTabHandle) return;
+ if (!variablesSettingsTabHandle) {
+ return;
+ }
// eslint-disable-next-line no-param-reassign
variablesSettingsTabHandle.current = {
diff --git a/frontend/src/container/DashboardContainer/DashboardSettings/General/index.tsx b/frontend/src/container/DashboardContainer/DashboardSettings/General/index.tsx
index f090c6ef9d..11026e7286 100644
--- a/frontend/src/container/DashboardContainer/DashboardSettings/General/index.tsx
+++ b/frontend/src/container/DashboardContainer/DashboardSettings/General/index.tsx
@@ -37,7 +37,9 @@ function GeneralDashboardSettings(): JSX.Element {
const { t } = useTranslation('common');
const onSaveHandler = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
updateDashboardMutation.mutate(
{
diff --git a/frontend/src/container/DashboardContainer/DashboardSettings/PublicDashboard/index.tsx b/frontend/src/container/DashboardContainer/DashboardSettings/PublicDashboard/index.tsx
index ea01b024d4..359fafce96 100644
--- a/frontend/src/container/DashboardContainer/DashboardSettings/PublicDashboard/index.tsx
+++ b/frontend/src/container/DashboardContainer/DashboardSettings/PublicDashboard/index.tsx
@@ -155,7 +155,9 @@ function PublicDashboardSetting(): JSX.Element {
});
const handleCreatePublicDashboard = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
createPublicDashboard({
dashboardId: selectedDashboard.id,
@@ -165,7 +167,9 @@ function PublicDashboardSetting(): JSX.Element {
};
const handleUpdatePublicDashboard = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
updatePublicDashboard({
dashboardId: selectedDashboard.id,
@@ -175,7 +179,9 @@ function PublicDashboardSetting(): JSX.Element {
};
const handleRevokePublicDashboardAccess = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
revokePublicDashboardAccess({
id: selectedDashboard.id,
@@ -201,7 +207,9 @@ function PublicDashboardSetting(): JSX.Element {
]);
const handleCopyPublicDashboardURL = (): void => {
- if (!publicDashboardResponse?.data?.publicPath) return;
+ if (!publicDashboardResponse?.data?.publicPath) {
+ return;
+ }
try {
setCopyPublicDashboardURL(
diff --git a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DynamicVariableSelection.tsx b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DynamicVariableSelection.tsx
index 6919d41ca0..cc2fe8a343 100644
--- a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DynamicVariableSelection.tsx
+++ b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DynamicVariableSelection.tsx
@@ -73,7 +73,9 @@ function DynamicVariableSelection({
// Create a dependency key from all dynamic variables
const dynamicVariablesKey = useMemo(() => {
- if (!existingVariables) return 'no_variables';
+ if (!existingVariables) {
+ return 'no_variables';
+ }
const dynamicVars = Object.values(existingVariables)
.filter((v) => v.type === 'DYNAMIC')
@@ -380,7 +382,9 @@ function DynamicVariableSelection({
// Helper function to check if arrays have the same elements regardless of order
const areArraysEqualIgnoreOrder = (a: any[], b: any[]): boolean => {
- if (a.length !== b.length) return false;
+ if (a.length !== b.length) {
+ return false;
+ }
const sortedA = [...a].sort();
const sortedB = [...b].sort();
return areArraysEqual(sortedA, sortedB);
diff --git a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts
index bcc2dadfcf..9a44f7ad44 100644
--- a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts
+++ b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts
@@ -141,7 +141,9 @@ const collectCyclePath = (
while (current !== end) {
const parent = findParent(current);
- if (!parent) break;
+ if (!parent) {
+ break;
+ }
path.push(parent);
current = parent;
}
@@ -194,10 +196,16 @@ export const buildDependencyGraph = (
// Initialize in-degree and adjacency list
Object.keys(dependencies).forEach((node) => {
- if (!inDegree[node]) inDegree[node] = 0;
- if (!adjList[node]) adjList[node] = [];
+ if (!inDegree[node]) {
+ inDegree[node] = 0;
+ }
+ if (!adjList[node]) {
+ adjList[node] = [];
+ }
dependencies[node]?.forEach((child) => {
- if (!inDegree[child]) inDegree[child] = 0;
+ if (!inDegree[child]) {
+ inDegree[child] = 0;
+ }
inDegree[child]++;
adjList[node].push(child);
});
@@ -234,7 +242,9 @@ export const buildDependencyGraph = (
adjList[current]?.forEach((neighbor) => {
inDegree[neighbor]--;
- if (inDegree[neighbor] === 0) queue.push(neighbor);
+ if (inDegree[neighbor] === 0) {
+ queue.push(neighbor);
+ }
});
}
diff --git a/frontend/src/container/EditAlertChannels/index.tsx b/frontend/src/container/EditAlertChannels/index.tsx
index 5077e83588..f45d37b5cb 100644
--- a/frontend/src/container/EditAlertChannels/index.tsx
+++ b/frontend/src/container/EditAlertChannels/index.tsx
@@ -420,19 +420,27 @@ function EditAlertChannels({
break;
case ChannelType.Pagerduty:
request = preparePagerRequest();
- if (request) await testPagerApi(request);
+ if (request) {
+ await testPagerApi(request);
+ }
break;
case ChannelType.MsTeams:
request = prepareMsTeamsRequest();
- if (request) await testMsTeamsApi(request);
+ if (request) {
+ await testMsTeamsApi(request);
+ }
break;
case ChannelType.Opsgenie:
request = prepareOpsgenieRequest();
- if (request) await testOpsgenie(request);
+ if (request) {
+ await testOpsgenie(request);
+ }
break;
case ChannelType.Email:
request = prepareEmailRequest();
- if (request) await testEmail(request);
+ if (request) {
+ await testEmail(request);
+ }
break;
default:
notifications.error({
diff --git a/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx b/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
index 115de3ab40..1458628efe 100644
--- a/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
+++ b/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
@@ -417,7 +417,9 @@ function ExplorerOptions({
key,
viewsData?.data?.data,
);
- if (!currentViewDetails) return;
+ if (!currentViewDetails) {
+ return;
+ }
const { query, name, id, panelType: currentPanelType } = currentViewDetails;
if (handleChangeSelectedView) {
diff --git a/frontend/src/container/ExplorerOptions/__tests__/ExplorerOptionWrapper.test.tsx b/frontend/src/container/ExplorerOptions/__tests__/ExplorerOptionWrapper.test.tsx
index 83fceb25d0..ae25d01d61 100644
--- a/frontend/src/container/ExplorerOptions/__tests__/ExplorerOptionWrapper.test.tsx
+++ b/frontend/src/container/ExplorerOptions/__tests__/ExplorerOptionWrapper.test.tsx
@@ -257,7 +257,9 @@ describe('ExplorerOptionWrapper', () => {
// Create a real handleExport function similar to LogsExplorerViews
// This should NOT call useUpdateDashboard (as per PR #8029)
const handleExport = (dashboard: Dashboard | null): void => {
- if (!dashboard) return;
+ if (!dashboard) {
+ return;
+ }
// Call the actual generateExportToDashboardLink function (not mocked)
const dashboardEditView = generateExportToDashboardLink({
diff --git a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
index fffdb6326b..73ce1fa372 100644
--- a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
+++ b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
@@ -199,7 +199,9 @@ function ChartPreview({
useEffect((): void => {
const { startTime, endTime } = getTimeRange(queryResponse);
- if (setQueryStatus) setQueryStatus(queryResponse.status);
+ if (setQueryStatus) {
+ setQueryStatus(queryResponse.status);
+ }
setMinTimeScale(startTime);
setMaxTimeScale(endTime);
}, [maxTime, minTime, globalSelectedInterval, queryResponse, setQueryStatus]);
diff --git a/frontend/src/container/FormAlertRules/RuleOptions.tsx b/frontend/src/container/FormAlertRules/RuleOptions.tsx
index 61cdb0bd41..f2d66e0c5f 100644
--- a/frontend/src/container/FormAlertRules/RuleOptions.tsx
+++ b/frontend/src/container/FormAlertRules/RuleOptions.tsx
@@ -61,7 +61,9 @@ function RuleOptions({
};
const onChangeSelectedQueryName = (value: string | unknown): void => {
- if (typeof value !== 'string') return;
+ if (typeof value !== 'string') {
+ return;
+ }
setAlertDef({
...alertDef,
diff --git a/frontend/src/container/FormAlertRules/index.tsx b/frontend/src/container/FormAlertRules/index.tsx
index c8e2e934f1..5f394fe7b0 100644
--- a/frontend/src/container/FormAlertRules/index.tsx
+++ b/frontend/src/container/FormAlertRules/index.tsx
@@ -364,7 +364,9 @@ function FormAlertRules({
const validatePromParams = useCallback((): boolean => {
let retval = true;
- if (currentQuery.queryType !== EQueryType.PROM) return retval;
+ if (currentQuery.queryType !== EQueryType.PROM) {
+ return retval;
+ }
if (!currentQuery.promql || currentQuery.promql.length === 0) {
notifications.error({
@@ -389,7 +391,9 @@ function FormAlertRules({
const validateChQueryParams = useCallback((): boolean => {
let retval = true;
- if (currentQuery.queryType !== EQueryType.CLICKHOUSE) return retval;
+ if (currentQuery.queryType !== EQueryType.CLICKHOUSE) {
+ return retval;
+ }
if (
!currentQuery.clickhouse_sql ||
@@ -416,7 +420,9 @@ function FormAlertRules({
}, [t, currentQuery, notifications]);
const validateQBParams = useCallback((): boolean => {
- if (currentQuery.queryType !== EQueryType.QUERY_BUILDER) return true;
+ if (currentQuery.queryType !== EQueryType.QUERY_BUILDER) {
+ return true;
+ }
if (
!currentQuery.builder.queryData ||
diff --git a/frontend/src/container/FormAlertRules/labels/index.tsx b/frontend/src/container/FormAlertRules/labels/index.tsx
index 5b0d7f5243..3192401a9f 100644
--- a/frontend/src/container/FormAlertRules/labels/index.tsx
+++ b/frontend/src/container/FormAlertRules/labels/index.tsx
@@ -114,9 +114,12 @@ function LabelSelect({
});
};
const renderPlaceholder = useCallback((): string => {
- if (state.value === 'LabelKey') return 'Enter a label key then press ENTER.';
- if (state.value === 'LabelValue')
+ if (state.value === 'LabelKey') {
+ return 'Enter a label key then press ENTER.';
+ }
+ if (state.value === 'LabelValue') {
return `Enter a value for label key(${staging[0]}) then press ENTER.`;
+ }
return t('placeholder_label_key_pair');
}, [t, state, staging]);
return (
diff --git a/frontend/src/container/FormAlertRules/usePrefillAlertConditions.ts b/frontend/src/container/FormAlertRules/usePrefillAlertConditions.ts
index 6f1f8c2a5a..221dcbae6d 100644
--- a/frontend/src/container/FormAlertRules/usePrefillAlertConditions.ts
+++ b/frontend/src/container/FormAlertRules/usePrefillAlertConditions.ts
@@ -17,7 +17,9 @@ export const usePrefillAlertConditions = (
// Extract and set match type
const reduceTo = useMemo(() => {
- if (!stagedQuery) return null;
+ if (!stagedQuery) {
+ return null;
+ }
const isSameTimeAggregation = stagedQuery.builder.queryData.every(
(queryData) =>
queryData?.reduceTo === stagedQuery.builder.queryData[0]?.reduceTo,
@@ -45,7 +47,9 @@ export const usePrefillAlertConditions = (
}) || {
thresholds: null,
};
- if (!thresholds || thresholds.length === 0) return null;
+ if (!thresholds || thresholds.length === 0) {
+ return null;
+ }
const sortedThresholds = thresholds.sort((a, b) => {
const aIndex = THRESHOLD_COLORS_SORTING_ORDER.indexOf(
a.thresholdColor || '',
diff --git a/frontend/src/container/GantChart/utils.ts b/frontend/src/container/GantChart/utils.ts
index 7b3e1115e7..4aebf8cfb9 100644
--- a/frontend/src/container/GantChart/utils.ts
+++ b/frontend/src/container/GantChart/utils.ts
@@ -93,12 +93,13 @@ export const getNodeById = (
value: ITraceTree,
): ITraceForest => set(newtreeData, path, [value]);
- if (treesData?.spanTree)
+ if (treesData?.spanTree) {
treesData.spanTree.forEach((tree) => {
traverse(tree, (value) => spanTreeSetCallback(['spanTree'], value), 1);
});
+ }
- if (treesData?.missingSpanTree)
+ if (treesData?.missingSpanTree) {
treesData.missingSpanTree.forEach((tree) => {
traverse(
tree,
@@ -106,6 +107,7 @@ export const getNodeById = (
1,
);
});
+ }
return newtreeData;
};
@@ -186,7 +188,9 @@ export const getSpanPath = (tree: ITraceTree, spanId: string): string[] => {
let foundInChild = false;
treeNode.children.forEach((childNode) => {
- if (traverse(childNode)) foundInChild = true;
+ if (traverse(childNode)) {
+ foundInChild = true;
+ }
});
if (!foundInChild) {
spanPath.pop();
diff --git a/frontend/src/container/GeneralSettings/GeneralSettings.tsx b/frontend/src/container/GeneralSettings/GeneralSettings.tsx
index 5951013d12..b9bb32f601 100644
--- a/frontend/src/container/GeneralSettings/GeneralSettings.tsx
+++ b/frontend/src/container/GeneralSettings/GeneralSettings.tsx
@@ -174,14 +174,26 @@ function GeneralSettings({
const { notifications } = useNotifications();
const onModalToggleHandler = (type: TTTLType): void => {
- if (type === 'metrics') setModalMetrics((modal) => !modal);
- if (type === 'traces') setModalTraces((modal) => !modal);
- if (type === 'logs') setModalLogs((modal) => !modal);
+ if (type === 'metrics') {
+ setModalMetrics((modal) => !modal);
+ }
+ if (type === 'traces') {
+ setModalTraces((modal) => !modal);
+ }
+ if (type === 'logs') {
+ setModalLogs((modal) => !modal);
+ }
};
const onPostApiLoadingHandler = (type: TTTLType): void => {
- if (type === 'metrics') setPostApiLoadingMetrics((modal) => !modal);
- if (type === 'traces') setPostApiLoadingTraces((modal) => !modal);
- if (type === 'logs') setPostApiLoadingLogs((modal) => !modal);
+ if (type === 'metrics') {
+ setPostApiLoadingMetrics((modal) => !modal);
+ }
+ if (type === 'traces') {
+ setPostApiLoadingTraces((modal) => !modal);
+ }
+ if (type === 'logs') {
+ setPostApiLoadingLogs((modal) => !modal);
+ }
};
const onClickSaveHandler = useCallback(
@@ -282,23 +294,26 @@ function GeneralSettings({
metricsTotalRetentionPeriod &&
metricsCurrentTTLValues.metrics_move_ttl_duration_hrs ===
metricsS3RetentionPeriod
- )
+ ) {
isMetricsSaveDisabled = true;
+ }
if (
tracesCurrentTTLValues.traces_ttl_duration_hrs ===
tracesTotalRetentionPeriod &&
tracesCurrentTTLValues.traces_move_ttl_duration_hrs ===
tracesS3RetentionPeriod
- )
+ ) {
isTracesSaveDisabled = true;
+ }
if (
logsCurrentTTLValues.default_ttl_days * 24 === logsTotalRetentionPeriod &&
logsCurrentTTLValues.cold_storage_ttl_days &&
logsCurrentTTLValues.cold_storage_ttl_days * 24 === logsS3RetentionPeriod
- )
+ ) {
isLogsSaveDisabled = true;
+ }
return [
isMetricsSaveDisabled,
@@ -395,26 +410,28 @@ function GeneralSettings({
if (type === 'metrics') {
metricsTtlValuesRefetch();
- if (!hasSetTTLFailed)
+ if (!hasSetTTLFailed) {
// Updates the currentTTL Values in order to avoid pushing the same values.
setMetricsCurrentTTLValues({
metrics_ttl_duration_hrs: metricsTotalRetentionPeriod || -1,
metrics_move_ttl_duration_hrs: metricsS3RetentionPeriod || -1,
status: '',
});
+ }
} else if (type === 'traces') {
tracesTtlValuesRefetch();
- if (!hasSetTTLFailed)
+ if (!hasSetTTLFailed) {
// Updates the currentTTL Values in order to avoid pushing the same values.
setTracesCurrentTTLValues({
traces_ttl_duration_hrs: tracesTotalRetentionPeriod || -1,
traces_move_ttl_duration_hrs: tracesS3RetentionPeriod || -1,
status: '',
});
+ }
} else if (type === 'logs') {
logsTtlValuesRefetch();
- if (!hasSetTTLFailed)
+ if (!hasSetTTLFailed) {
// Updates the currentTTL Values in order to avoid pushing the same values.
setLogsCurrentTTLValues((prev) => ({
...prev,
@@ -425,6 +442,7 @@ function GeneralSettings({
? logsTotalRetentionPeriod / 24 // convert Hours to days
: -1,
}));
+ }
}
} catch (error) {
notifications.error({
diff --git a/frontend/src/container/GeneralSettings/Retention.tsx b/frontend/src/container/GeneralSettings/Retention.tsx
index 30e24c42bf..10d0921568 100644
--- a/frontend/src/container/GeneralSettings/Retention.tsx
+++ b/frontend/src/container/GeneralSettings/Retention.tsx
@@ -67,11 +67,15 @@ function Retention({
const { isCloudUser: isCloudUserVal } = useGetTenantLicense();
useEffect(() => {
- if (!interacted.current) setSelectedValue(initialValue);
+ if (!interacted.current) {
+ setSelectedValue(initialValue);
+ }
}, [initialValue]);
useEffect(() => {
- if (!interacted.current) setSelectTimeUnit(initialTimeUnitValue);
+ if (!interacted.current) {
+ setSelectTimeUnit(initialTimeUnitValue);
+ }
}, [initialTimeUnitValue]);
const menuItems = availableUnits.map((option) => (
@@ -82,7 +86,9 @@ function Retention({
const currentSelectedOption = (option: SettingPeriod): void => {
const selectedValue = find(availableUnits, (e) => e.value === option)?.value;
- if (selectedValue) setSelectTimeUnit(selectedValue);
+ if (selectedValue) {
+ setSelectTimeUnit(selectedValue);
+ }
};
useEffect(() => {
@@ -90,7 +96,9 @@ function Retention({
availableUnits,
(timeUnit) => timeUnit.value === selectedTimeUnit,
)?.multiplier;
- if (!selectedValue) setRetentionValue(null);
+ if (!selectedValue) {
+ setRetentionValue(null);
+ }
if (selectedValue && inverseMultiplier) {
setRetentionValue(selectedValue * (1 / inverseMultiplier));
}
diff --git a/frontend/src/container/GeneralSettings/StatusMessage.tsx b/frontend/src/container/GeneralSettings/StatusMessage.tsx
index 7c037a3851..3690a46ee7 100644
--- a/frontend/src/container/GeneralSettings/StatusMessage.tsx
+++ b/frontend/src/container/GeneralSettings/StatusMessage.tsx
@@ -15,9 +15,15 @@ function StatusMessage({
const { t } = useTranslation(['generalSettings']);
const messageColor = useMemo((): string => {
- if (status === 'success') return green[6];
- if (status === 'pending') return orange[6];
- if (status === 'failed') return volcano[6];
+ if (status === 'success') {
+ return green[6];
+ }
+ if (status === 'pending') {
+ return orange[6];
+ }
+ if (status === 'failed') {
+ return volcano[6];
+ }
return 'inherit';
}, [status]);
if (!status) {
diff --git a/frontend/src/container/GeneralSettings/utils.ts b/frontend/src/container/GeneralSettings/utils.ts
index cf2948d431..44631a48de 100644
--- a/frontend/src/container/GeneralSettings/utils.ts
+++ b/frontend/src/container/GeneralSettings/utils.ts
@@ -67,7 +67,9 @@ export const convertHoursValueToRelevantUnit = (
export const convertHoursValueToRelevantUnitString = (
value: number,
): string => {
- if (!value) return '';
+ if (!value) {
+ return '';
+ }
const convertedTimeUnit = convertHoursValueToRelevantUnit(value);
return `${convertedTimeUnit.value} ${convertedTimeUnit.timeUnitValue}${
convertedTimeUnit.value >= 2 ? 's' : ''
diff --git a/frontend/src/container/GoToTop/index.tsx b/frontend/src/container/GoToTop/index.tsx
index c1cc57973c..4bb90250eb 100644
--- a/frontend/src/container/GoToTop/index.tsx
+++ b/frontend/src/container/GoToTop/index.tsx
@@ -10,7 +10,9 @@ function GoToTop(): JSX.Element | null {
const { panelType } = useQueryBuilder();
- if (!isVisible) return null;
+ if (!isVisible) {
+ return null;
+ }
if (panelType === PANEL_TYPES.LIST) {
return (
diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx
index c93a4f7e9d..a116a42785 100644
--- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx
+++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx
@@ -86,7 +86,9 @@ function WidgetGraphComponent({
] = useState<RefObject<HTMLDivElement> | null>(graphRef);
useEffect(() => {
- if (!lineChartRef.current) return;
+ if (!lineChartRef.current) {
+ return;
+ }
graphVisibility.forEach((state, index) => {
lineChartRef.current?.toggleGraph(index, state);
@@ -110,7 +112,9 @@ function WidgetGraphComponent({
const updateDashboardMutation = useUpdateDashboard();
const onDeleteHandler = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
const updatedWidgets = selectedDashboard?.data?.widgets?.filter(
(e) => e.id !== widget.id,
@@ -130,7 +134,9 @@ function WidgetGraphComponent({
updateDashboardMutation.mutateAsync(updatedSelectedDashboard, {
onSuccess: (updatedDashboard) => {
- if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []);
+ if (setLayouts) {
+ setLayouts(updatedDashboard.data?.data?.layout || []);
+ }
if (setSelectedDashboard && updatedDashboard.data) {
setSelectedDashboard(updatedDashboard.data);
}
@@ -140,7 +146,9 @@ function WidgetGraphComponent({
};
const onCloneHandler = async (): Promise<void> => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
const uuid = v4();
@@ -178,7 +186,9 @@ function WidgetGraphComponent({
},
{
onSuccess: (updatedDashboard) => {
- if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []);
+ if (setLayouts) {
+ setLayouts(updatedDashboard.data?.data?.layout || []);
+ }
if (setSelectedDashboard && updatedDashboard.data) {
setSelectedDashboard(updatedDashboard.data);
}
diff --git a/frontend/src/container/GridCardLayout/GridCardLayout.tsx b/frontend/src/container/GridCardLayout/GridCardLayout.tsx
index f1eaaf9476..86a2baf247 100644
--- a/frontend/src/container/GridCardLayout/GridCardLayout.tsx
+++ b/frontend/src/container/GridCardLayout/GridCardLayout.tsx
@@ -185,7 +185,9 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
}, [data, selectedDashboard?.id]);
const onSaveHandler = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
const updatedDashboard: Props = {
id: selectedDashboard.id,
@@ -209,8 +211,9 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
onSuccess: (updatedDashboard) => {
setSelectedRowWidgetId(null);
if (updatedDashboard.data) {
- if (updatedDashboard.data.data.layout)
+ if (updatedDashboard.data.data.layout) {
setLayouts(sortLayout(updatedDashboard.data.data.layout));
+ }
setSelectedDashboard(updatedDashboard.data);
setPanelMap(updatedDashboard.data?.data?.panelMap || {});
}
@@ -280,15 +283,21 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
const onSettingsModalSubmit = (): void => {
const newTitle = form.getFieldValue('title');
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
- if (!currentSelectRowId) return;
+ if (!currentSelectRowId) {
+ return;
+ }
const currentWidget = selectedDashboard?.data?.widgets?.find(
(e) => e.id === currentSelectRowId,
);
- if (!currentWidget) return;
+ if (!currentWidget) {
+ return;
+ }
currentWidget.title = newTitle;
const updatedWidgets = selectedDashboard?.data?.widgets?.filter(
@@ -307,11 +316,15 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
updateDashboardMutation.mutateAsync(updatedSelectedDashboard, {
onSuccess: (updatedDashboard) => {
- if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []);
+ if (setLayouts) {
+ setLayouts(updatedDashboard.data?.data?.layout || []);
+ }
if (setSelectedDashboard && updatedDashboard.data) {
setSelectedDashboard(updatedDashboard.data);
}
- if (setPanelMap) setPanelMap(updatedDashboard.data?.data?.panelMap || {});
+ if (setPanelMap) {
+ setPanelMap(updatedDashboard.data?.data?.panelMap || {});
+ }
form.setFieldValue('title', '');
setIsSettingsModalOpen(false);
setCurrentSelectRowId(null);
@@ -320,7 +333,9 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
};
useEffect(() => {
- if (!currentSelectRowId) return;
+ if (!currentSelectRowId) {
+ return;
+ }
form.setFieldValue(
'title',
(widgets?.find((widget) => widget.id === currentSelectRowId)
@@ -330,7 +345,9 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
// eslint-disable-next-line sonarjs/cognitive-complexity
const handleRowCollapse = (id: string): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
const rowProperties = { ...currentPanelMap[id] };
const updatedPanelMap = { ...currentPanelMap };
@@ -437,9 +454,13 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
};
const handleRowDelete = (): void => {
- if (!selectedDashboard) return;
+ if (!selectedDashboard) {
+ return;
+ }
- if (!currentSelectRowId) return;
+ if (!currentSelectRowId) {
+ return;
+ }
const updatedWidgets = selectedDashboard?.data?.widgets?.filter(
(e) => e.id !== currentSelectRowId,
@@ -464,11 +485,15 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
updateDashboardMutation.mutateAsync(updatedSelectedDashboard, {
onSuccess: (updatedDashboard) => {
- if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []);
+ if (setLayouts) {
+ setLayouts(updatedDashboard.data?.data?.layout || []);
+ }
if (setSelectedDashboard && updatedDashboard.data) {
setSelectedDashboard(updatedDashboard.data);
}
- if (setPanelMap) setPanelMap(updatedDashboard.data?.data?.panelMap || {});
+ if (setPanelMap) {
+ setPanelMap(updatedDashboard.data?.data?.panelMap || {});
+ }
setIsDeleteModalOpen(false);
setCurrentSelectRowId(null);
},
diff --git a/frontend/src/container/GridCardLayout/useGraphClickToShowButton.ts b/frontend/src/container/GridCardLayout/useGraphClickToShowButton.ts
index 69d8f06f54..c64890527d 100644
--- a/frontend/src/container/GridCardLayout/useGraphClickToShowButton.ts
+++ b/frontend/src/container/GridCardLayout/useGraphClickToShowButton.ts
@@ -92,7 +92,9 @@ export const useGraphClickToShowButton = ({
menuList.style.zIndex = '9999';
const graphBounds = graphRef.current?.getBoundingClientRect();
- if (!graphBounds) return;
+ if (!graphBounds) {
+ return;
+ }
graphRef.current?.appendChild(menuList);
diff --git a/frontend/src/container/GridCardLayout/useNavigateToExplorerPages.ts b/frontend/src/container/GridCardLayout/useNavigateToExplorerPages.ts
index f6ee23815d..a80bffa730 100644
--- a/frontend/src/container/GridCardLayout/useNavigateToExplorerPages.ts
+++ b/frontend/src/container/GridCardLayout/useNavigateToExplorerPages.ts
@@ -88,7 +88,9 @@ export const buildFilters = (
(q) => q.queryName === requestData.queryName,
);
- if (!formulaQuery) return {};
+ if (!formulaQuery) {
+ return {};
+ }
const queryNames = extractQueryNamesFromExpression(formulaQuery.expression);
const filteredQueryData = query.builder.queryData.filter((q) =>
diff --git a/frontend/src/container/GridCardLayout/utils.ts b/frontend/src/container/GridCardLayout/utils.ts
index 6c8bb7ffc3..6024648286 100644
--- a/frontend/src/container/GridCardLayout/utils.ts
+++ b/frontend/src/container/GridCardLayout/utils.ts
@@ -19,7 +19,9 @@ export const isFormula = (queryName: string): boolean =>
* Specifically targets capital letters A-Z as query names, as after Z we dont have any query names
*/
export function extractQueryNamesFromExpression(expression: string): string[] {
- if (!expression) return [];
+ if (!expression) {
+ return [];
+ }
// Use regex to match standalone capital letters
// Uses word boundaries to ensure we only get standalone letters
@@ -34,7 +36,9 @@ export const hasColumnWidthsChanged = (
selectedDashboard?: Dashboard,
): boolean => {
// If no column widths stored, no changes
- if (isEmpty(columnWidths) || !selectedDashboard) return false;
+ if (isEmpty(columnWidths) || !selectedDashboard) {
+ return false;
+ }
// Check each widget's column widths
return Object.keys(columnWidths).some((widgetId) => {
@@ -46,7 +50,9 @@ export const hasColumnWidthsChanged = (
const existingWidths = dashboardWidget?.columnWidths;
// If both are empty/undefined, no change
- if (isEmpty(newWidths) || isEmpty(existingWidths)) return false;
+ if (isEmpty(newWidths) || isEmpty(existingWidths)) {
+ return false;
+ }
// Compare stored column widths with dashboard widget's column widths
return !isEqual(newWidths, existingWidths);
diff --git a/frontend/src/container/GridPanelSwitch/index.tsx b/frontend/src/container/GridPanelSwitch/index.tsx
index 24fbde3c85..48189647b6 100644
--- a/frontend/src/container/GridPanelSwitch/index.tsx
+++ b/frontend/src/container/GridPanelSwitch/index.tsx
@@ -65,7 +65,9 @@ const GridPanelSwitch = forwardRef<
currentProps,
]);
- if (!Component || !componentProps) return null;
+ if (!Component || !componentProps) {
+ return null;
+ }
// eslint-disable-next-line react/jsx-props-no-spreading
return <Component {...componentProps} />;
},
diff --git a/frontend/src/container/GridValueComponent/index.tsx b/frontend/src/container/GridValueComponent/index.tsx
index 54f4fdd9d9..effd6bd50d 100644
--- a/frontend/src/container/GridValueComponent/index.tsx
+++ b/frontend/src/container/GridValueComponent/index.tsx
@@ -83,7 +83,9 @@ function GridValueComponent({
const queryName = (queryResponse?.data?.params as any)?.compositeQuery
?.queries[0]?.spec?.name;
- if (!enableDrillDown || !queryName || !isQueryTypeBuilder) return;
+ if (!enableDrillDown || !queryName || !isQueryTypeBuilder) {
+ return;
+ }
// when multiple queries are present, we need to get the query name from the queryResponse
// since value panel shows result for the first query
diff --git a/frontend/src/container/Home/AlertRules/AlertRules.tsx b/frontend/src/container/Home/AlertRules/AlertRules.tsx
index 7092acab80..626b69ee99 100644
--- a/frontend/src/container/Home/AlertRules/AlertRules.tsx
+++ b/frontend/src/container/Home/AlertRules/AlertRules.tsx
@@ -41,8 +41,12 @@ export default function AlertRules({
const sortedRules = rules.sort((a, b) => {
// First, prioritize firing alerts
- if (a.state === 'firing' && b.state !== 'firing') return -1;
- if (a.state !== 'firing' && b.state === 'firing') return 1;
+ if (a.state === 'firing' && b.state !== 'firing') {
+ return -1;
+ }
+ if (a.state !== 'firing' && b.state === 'firing') {
+ return 1;
+ }
// Then sort by updateAt timestamp
const aUpdateAt = new Date(a.updateAt).getTime();
diff --git a/frontend/src/container/Home/Dashboards/Dashboards.tsx b/frontend/src/container/Home/Dashboards/Dashboards.tsx
index b08b6f6e06..1233f5d07d 100644
--- a/frontend/src/container/Home/Dashboards/Dashboards.tsx
+++ b/frontend/src/container/Home/Dashboards/Dashboards.tsx
@@ -31,7 +31,9 @@ export default function Dashboards({
} = useGetAllDashboard();
useEffect(() => {
- if (!dashboardsList) return;
+ if (!dashboardsList) {
+ return;
+ }
const sortedDashboards = dashboardsList.data.sort((a, b) => {
const aUpdateAt = new Date(a.updatedAt).getTime();
diff --git a/frontend/src/container/Home/SavedViews/SavedViews.tsx b/frontend/src/container/Home/SavedViews/SavedViews.tsx
index 0e3272fc36..3c318003b4 100644
--- a/frontend/src/container/Home/SavedViews/SavedViews.tsx
+++ b/frontend/src/container/Home/SavedViews/SavedViews.tsx
@@ -96,7 +96,9 @@ export default function SavedViews({
}
const currentViewDetails = getViewDetailsUsingViewKey(view.id, currentViews);
- if (!currentViewDetails) return;
+ if (!currentViewDetails) {
+ return;
+ }
const { query, name, id, panelType: currentPanelType } = currentViewDetails;
if (selectedEntity) {
diff --git a/frontend/src/container/InfraMonitoringHosts/HostsList.tsx b/frontend/src/container/InfraMonitoringHosts/HostsList.tsx
index f352cc759e..34c5a5f0d4 100644
--- a/frontend/src/container/InfraMonitoringHosts/HostsList.tsx
+++ b/frontend/src/container/InfraMonitoringHosts/HostsList.tsx
@@ -184,7 +184,9 @@ function HostsList(): JSX.Element {
}, [data?.payload?.data?.total]);
const selectedHostData = useMemo(() => {
- if (!selectedHostName) return null;
+ if (!selectedHostName) {
+ return null;
+ }
return (
hostMetricsData.find((host) => host.hostName === selectedHostName) || null
);
diff --git a/frontend/src/container/InfraMonitoringHosts/utils.tsx b/frontend/src/container/InfraMonitoringHosts/utils.tsx
index 786eab89a3..7bcc382f11 100644
--- a/frontend/src/container/InfraMonitoringHosts/utils.tsx
+++ b/frontend/src/container/InfraMonitoringHosts/utils.tsx
@@ -146,8 +146,12 @@ export const formatDataForTable = (data: HostData[]): HostRowData[] =>
size="small"
strokeColor={((): string => {
const cpuPercent = Number((host.cpu * 100).toFixed(1));
- if (cpuPercent >= 90) return Color.BG_SAKURA_500;
- if (cpuPercent >= 60) return Color.BG_AMBER_500;
+ if (cpuPercent >= 90) {
+ return Color.BG_SAKURA_500;
+ }
+ if (cpuPercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
@@ -162,8 +166,12 @@ export const formatDataForTable = (data: HostData[]): HostRowData[] =>
size="small"
strokeColor={((): string => {
const memoryPercent = Number((host.memory * 100).toFixed(1));
- if (memoryPercent >= 90) return Color.BG_CHERRY_500;
- if (memoryPercent >= 60) return Color.BG_AMBER_500;
+ if (memoryPercent >= 90) {
+ return Color.BG_CHERRY_500;
+ }
+ if (memoryPercent >= 60) {
+ return Color.BG_AMBER_500;
+ }
return Color.BG_FOREST_500;
})()}
className="progress-bar"
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx
index 37507bdbcd..34109844aa 100644
--- a/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx
@@ -151,7 +151,9 @@ function K8sClustersList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -171,7 +173,9 @@ function K8sClustersList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sClustersListQuery();
@@ -276,7 +280,9 @@ function K8sClustersList({
);
const nestedClustersData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -426,7 +432,9 @@ function K8sClustersList({
}, [data?.payload?.data?.total]);
const selectedClusterData = useMemo(() => {
- if (!selectedClusterName) return null;
+ if (!selectedClusterName) {
+ return null;
+ }
if (groupBy.length > 0) {
// If grouped by, return the cluster from the formatted grouped by clusters data
return (
@@ -467,7 +475,9 @@ function K8sClustersList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx b/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx
index 43c56594dd..0c7baf3ae1 100644
--- a/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx
@@ -153,7 +153,9 @@ function K8sDaemonSetsList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -173,7 +175,9 @@ function K8sDaemonSetsList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sDaemonSetsListQuery();
@@ -331,7 +335,9 @@ function K8sDaemonSetsList({
);
const nestedDaemonSetsData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -475,7 +481,9 @@ function K8sDaemonSetsList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx
index 36940775c6..5f95983a0c 100644
--- a/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx
@@ -154,7 +154,9 @@ function K8sDeploymentsList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -174,7 +176,9 @@ function K8sDeploymentsList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sDeploymentsListQuery();
@@ -332,7 +336,9 @@ function K8sDeploymentsList({
);
const nestedDeploymentsData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -433,7 +439,9 @@ function K8sDeploymentsList({
}, [data?.payload?.data?.total]);
const selectedDeploymentData = useMemo(() => {
- if (!selectedDeploymentUID) return null;
+ if (!selectedDeploymentUID) {
+ return null;
+ }
if (groupBy.length > 0) {
// If grouped by, return the deployment from the formatted grouped by deployments data
return (
@@ -479,7 +487,9 @@ function K8sDeploymentsList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
index be12fd243f..c5bee3b569 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
@@ -199,12 +199,16 @@ export default function Events({
);
const handlePrev = (): void => {
- if (!formattedEntityEvents.length) return;
+ if (!formattedEntityEvents.length) {
+ return;
+ }
setPage(page - 1);
};
const handleNext = (): void => {
- if (!formattedEntityEvents.length) return;
+ if (!formattedEntityEvents.length) {
+ return;
+ }
setPage(page + 1);
};
diff --git a/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx b/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx
index d70115896d..dc018fe6f4 100644
--- a/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx
@@ -148,7 +148,9 @@ function K8sJobsList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -168,7 +170,9 @@ function K8sJobsList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sJobsListQuery();
@@ -266,7 +270,9 @@ function K8sJobsList({
);
const nestedJobsData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -446,7 +452,9 @@ function K8sJobsList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx
index 9197944723..249a1dddf1 100644
--- a/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx
@@ -152,7 +152,9 @@ function K8sNamespacesList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -172,7 +174,9 @@ function K8sNamespacesList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sNamespacesListQuery();
@@ -330,7 +334,9 @@ function K8sNamespacesList({
);
const nestedNamespacesData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -429,7 +435,9 @@ function K8sNamespacesList({
}, [data?.payload?.data?.total]);
const selectedNamespaceData = useMemo(() => {
- if (!selectedNamespaceUID) return null;
+ if (!selectedNamespaceUID) {
+ return null;
+ }
if (groupBy.length > 0) {
// If grouped by, return the namespace from the formatted grouped by namespaces data
return (
@@ -475,7 +483,9 @@ function K8sNamespacesList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
index 64b55f9107..fc4dc36e3e 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
@@ -146,7 +146,9 @@ function K8sNodesList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -166,7 +168,9 @@ function K8sNodesList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sNodesListQuery();
@@ -265,7 +269,9 @@ function K8sNodesList({
}, [pageSize, currentPage, queryFilters, minTime, maxTime, orderBy, groupBy]);
const nestedNodesData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -419,7 +425,9 @@ function K8sNodesList({
}, [data?.payload?.data?.total]);
const selectedNodeData = useMemo(() => {
- if (!selectedNodeUID) return null;
+ if (!selectedNodeUID) {
+ return null;
+ }
if (groupBy.length > 0) {
// If grouped by, return the node from the formatted grouped by nodes data
return (
@@ -454,7 +462,9 @@ function K8sNodesList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx
index 97d3ac4f05..6991c83186 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx
@@ -256,7 +256,9 @@ function K8sPodsList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -276,7 +278,9 @@ function K8sPodsList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sPodsListQuery();
@@ -333,7 +337,9 @@ function K8sPodsList({
const totalCount = data?.payload?.data?.total || 0;
const nestedPodsData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -462,7 +468,9 @@ function K8sPodsList({
}, [data?.payload?.data?.total]);
const selectedPodData = useMemo(() => {
- if (!selectedPodUID) return null;
+ if (!selectedPodUID) {
+ return null;
+ }
if (groupBy.length > 0) {
// If grouped by, return the pod from the formatted grouped by pods data
return nestedPodsData.find((pod) => pod.podUID === selectedPodUID) || null;
@@ -567,7 +575,9 @@ function K8sPodsList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData);
diff --git a/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx b/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx
index 4dd0b5511e..37d64663a5 100644
--- a/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx
@@ -153,7 +153,9 @@ function K8sStatefulSetsList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -173,7 +175,9 @@ function K8sStatefulSetsList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sStatefulSetsListQuery();
@@ -278,7 +282,9 @@ function K8sStatefulSetsList({
);
const nestedStatefulSetsData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -432,7 +438,9 @@ function K8sStatefulSetsList({
}, [data?.payload?.data?.total]);
const selectedStatefulSetData = useMemo(() => {
- if (!selectedStatefulSetUID) return null;
+ if (!selectedStatefulSetUID) {
+ return null;
+ }
if (groupBy.length > 0) {
return (
nestedStatefulSetsData.find(
@@ -476,7 +484,9 @@ function K8sStatefulSetsList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx b/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx
index d647591818..cd37770c9b 100644
--- a/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx
@@ -153,7 +153,9 @@ function K8sVolumesList({
op: 'and',
};
- if (!selectedRowData) return baseFilters;
+ if (!selectedRowData) {
+ return baseFilters;
+ }
const { groupedByMeta } = selectedRowData;
@@ -173,7 +175,9 @@ function K8sVolumesList({
};
const fetchGroupedByRowDataQuery = useMemo(() => {
- if (!selectedRowData) return null;
+ if (!selectedRowData) {
+ return null;
+ }
const baseQuery = getK8sVolumesListQuery();
@@ -252,7 +256,9 @@ function K8sVolumesList({
);
const nestedVolumesData = useMemo(() => {
- if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
+ if (!selectedRowData || !groupedByRowData?.payload?.data.records) {
+ return [];
+ }
return groupedByRowData?.payload?.data?.records || [];
}, [groupedByRowData, selectedRowData]);
@@ -367,7 +373,9 @@ function K8sVolumesList({
}, [data?.payload?.data?.total]);
const selectedVolumeData = useMemo(() => {
- if (!selectedVolumeUID) return null;
+ if (!selectedVolumeUID) {
+ return null;
+ }
if (groupBy.length > 0) {
return (
nestedVolumesData.find(
@@ -406,7 +414,9 @@ function K8sVolumesList({
const isGroupedByAttribute = groupBy.length > 0;
const handleExpandedRowViewAllClick = (): void => {
- if (!selectedRowData) return;
+ if (!selectedRowData) {
+ return;
+ }
const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
diff --git a/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx b/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx
index 06e051ed66..ce3d95cc2d 100644
--- a/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx
@@ -27,7 +27,9 @@ import {
* Converts size in bytes to a human-readable string with appropriate units
*/
export function formatBytes(bytes: number, decimals = 2): string {
- if (bytes === 0) return '0 Bytes';
+ if (bytes === 0) {
+ return '0 Bytes';
+ }
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
diff --git a/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx b/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx
index cd7d3f5999..8cc155dae6 100644
--- a/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx
+++ b/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx
@@ -508,7 +508,9 @@ function MultiIngestionSettings(): JSX.Element {
};
const signalCfg = SIGNALS_CONFIG.find((cfg) => cfg.name === signalName);
- if (!signalCfg) return;
+ if (!signalCfg) {
+ return;
+ }
// Only set size if usesSize is true
if (signalCfg.usesSize) {
@@ -597,7 +599,9 @@ function MultiIngestionSettings(): JSX.Element {
};
const signalCfg = SIGNALS_CONFIG.find((cfg) => cfg.name === signal.signal);
- if (!signalCfg) return;
+ if (!signalCfg) {
+ return;
+ }
const noSizeProvided =
isUndefined(dailyLimit) && isUndefined(secondsLimit) && signalCfg.usesSize;
diff --git a/frontend/src/container/ListAlertRules/utils.ts b/frontend/src/container/ListAlertRules/utils.ts
index 89b52dbffa..76342f3c42 100644
--- a/frontend/src/container/ListAlertRules/utils.ts
+++ b/frontend/src/container/ListAlertRules/utils.ts
@@ -7,7 +7,9 @@ export const filterAlerts = (
allAlertRules: GettableAlert[],
filter: string,
): GettableAlert[] => {
- if (!filter.trim()) return allAlertRules;
+ if (!filter.trim()) {
+ return allAlertRules;
+ }
const value = filter.trim().toLowerCase();
return allAlertRules.filter((alert) => {
diff --git a/frontend/src/container/ListOfDashboard/DashboardsList.tsx b/frontend/src/container/ListOfDashboard/DashboardsList.tsx
index fd5337e401..18b4d621c7 100644
--- a/frontend/src/container/ListOfDashboard/DashboardsList.tsx
+++ b/frontend/src/container/ListOfDashboard/DashboardsList.tsx
@@ -202,7 +202,9 @@ function DashboardsList(): JSX.Element {
};
const sortHandle = (key: string): void => {
- if (!dashboards) return;
+ if (!dashboards) {
+ return;
+ }
if (key === 'createdAt') {
sortDashboardsByCreatedAt(dashboards);
setSortOrder({
diff --git a/frontend/src/container/ListOfDashboard/SearchFilter/index.tsx b/frontend/src/container/ListOfDashboard/SearchFilter/index.tsx
index eeddb1b6f3..9be00eddaf 100644
--- a/frontend/src/container/ListOfDashboard/SearchFilter/index.tsx
+++ b/frontend/src/container/ListOfDashboard/SearchFilter/index.tsx
@@ -46,8 +46,9 @@ function SearchFilter({
const searchQueryString = new URLSearchParams(history.location.search).get(
'search',
);
- if (searchQueryString)
+ if (searchQueryString) {
setQueries(convertURLQueryStringToQuery(searchQueryString) || []);
+ }
}, []);
useEffect(() => {
filterDashboards(executeSearchQueries(queries, searchData));
diff --git a/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts b/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts
index d2b8b5f55e..609e248182 100644
--- a/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts
+++ b/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts
@@ -55,16 +55,18 @@ export const executeSearchQueries = (
try {
const searchSpace =
flattenDeep([searchPayload[categoryLowercase]]).filter(Boolean) || null;
- if (!searchSpace || !searchSpace.length)
+ if (!searchSpace || !searchSpace.length) {
return resolveOperator(false, operator);
+ }
for (const searchSpaceItem of searchSpace) {
- if (searchSpaceItem)
+ if (searchSpaceItem) {
for (const queryValue of value) {
if (searchSpaceItem.match(escapeRegExp(queryValue))) {
return resolveOperator(true, operator);
}
}
+ }
}
} catch (error) {
console.error(error);
diff --git a/frontend/src/container/LiveLogs/BackButton/index.tsx b/frontend/src/container/LiveLogs/BackButton/index.tsx
index 5dee8d9546..9bcde5434f 100644
--- a/frontend/src/container/LiveLogs/BackButton/index.tsx
+++ b/frontend/src/container/LiveLogs/BackButton/index.tsx
@@ -22,7 +22,9 @@ function BackButton(): JSX.Element {
const compositeQuery = useGetCompositeQueryParam();
const handleBack = useCallback(() => {
- if (!compositeQuery) return;
+ if (!compositeQuery) {
+ return;
+ }
const nextCompositeQuery = constructCompositeQuery({
query: compositeQuery,
diff --git a/frontend/src/container/LiveLogs/FiltersInput/index.tsx b/frontend/src/container/LiveLogs/FiltersInput/index.tsx
index 6acd638d5f..b899bfb1de 100644
--- a/frontend/src/container/LiveLogs/FiltersInput/index.tsx
+++ b/frontend/src/container/LiveLogs/FiltersInput/index.tsx
@@ -30,7 +30,9 @@ function FiltersInput(): JSX.Element {
(filters: TagFilter) => {
const listQueryData = stagedQuery?.builder.queryData[0];
- if (!listQueryData) return;
+ if (!listQueryData) {
+ return;
+ }
const queryData: IBuilderQuery = {
...listQueryData,
diff --git a/frontend/src/container/LiveLogs/ListViewPanel/index.tsx b/frontend/src/container/LiveLogs/ListViewPanel/index.tsx
index 777a0e82b7..c6a5f53a67 100644
--- a/frontend/src/container/LiveLogs/ListViewPanel/index.tsx
+++ b/frontend/src/container/LiveLogs/ListViewPanel/index.tsx
@@ -27,7 +27,9 @@ function ListViewPanel(): JSX.Element {
const isFormatButtonVisible = logsOptions.includes(config.format?.value);
const renderPopoverContent = useCallback(() => {
- if (!config.maxLines) return null;
+ if (!config.maxLines) {
+ return null;
+ }
const linedPerRow = config.maxLines.value as number;
const handleLinesPerRowChange = config.maxLines.onChange as (
value: unknown,
diff --git a/frontend/src/container/LiveLogs/LiveLogsContainer/index.tsx b/frontend/src/container/LiveLogs/LiveLogsContainer/index.tsx
index 23d0e5e390..daf1173f58 100644
--- a/frontend/src/container/LiveLogs/LiveLogsContainer/index.tsx
+++ b/frontend/src/container/LiveLogs/LiveLogsContainer/index.tsx
@@ -37,7 +37,9 @@ function LiveLogsContainer({
);
const listQuery = useMemo(() => {
- if (!stagedQuery || stagedQuery.builder.queryData.length < 1) return null;
+ if (!stagedQuery || stagedQuery.builder.queryData.length < 1) {
+ return null;
+ }
return stagedQuery.builder.queryData.find((item) => !item.disabled) || null;
}, [stagedQuery]);
diff --git a/frontend/src/container/LiveLogs/LiveLogsList/index.tsx b/frontend/src/container/LiveLogs/LiveLogsList/index.tsx
index 354aa214d2..76d533dbd6 100644
--- a/frontend/src/container/LiveLogs/LiveLogsList/index.tsx
+++ b/frontend/src/container/LiveLogs/LiveLogsList/index.tsx
@@ -105,7 +105,9 @@ function LiveLogsList({
);
useEffect(() => {
- if (!activeLogId || activeLogIndex < 0) return;
+ if (!activeLogId || activeLogIndex < 0) {
+ return;
+ }
ref?.current?.scrollToIndex({
index: activeLogIndex,
diff --git a/frontend/src/container/LiveLogs/LiveLogsListChart/index.tsx b/frontend/src/container/LiveLogs/LiveLogsListChart/index.tsx
index 7dc726b11e..0e8eb0e2ab 100644
--- a/frontend/src/container/LiveLogs/LiveLogsListChart/index.tsx
+++ b/frontend/src/container/LiveLogs/LiveLogsListChart/index.tsx
@@ -22,14 +22,18 @@ function LiveLogsListChart({
const { isConnectionOpen } = useEventSource();
const listChartQuery: Query | null = useMemo(() => {
- if (!currentQuery) return null;
+ if (!currentQuery) {
+ return null;
+ }
const currentFilterExpression =
currentQuery?.builder.queryData[0]?.filter?.expression?.trim() || '';
const validationResult = validateQuery(currentFilterExpression || '');
- if (!validationResult.isValid) return null;
+ if (!validationResult.isValid) {
+ return null;
+ }
return {
...currentQuery,
@@ -63,9 +67,13 @@ function LiveLogsListChart({
);
const chartData: QueryData[] = useMemo(() => {
- if (initialData) return initialData;
+ if (initialData) {
+ return initialData;
+ }
- if (!data) return [];
+ if (!data) {
+ return [];
+ }
return data.payload.data.result;
}, [data, initialData]);
diff --git a/frontend/src/container/LogDetailedView/ContextView/ContextLogRenderer.tsx b/frontend/src/container/LogDetailedView/ContextView/ContextLogRenderer.tsx
index 4522ff446c..43674eb868 100644
--- a/frontend/src/container/LogDetailedView/ContextView/ContextLogRenderer.tsx
+++ b/frontend/src/container/LogDetailedView/ContextView/ContextLogRenderer.tsx
@@ -35,7 +35,9 @@ function ContextLogRenderer({
const { stagedQuery } = useQueryBuilder();
const listQuery = useMemo(() => {
- if (!stagedQuery || stagedQuery.builder.queryData.length < 1) return null;
+ if (!stagedQuery || stagedQuery.builder.queryData.length < 1) {
+ return null;
+ }
return stagedQuery.builder.queryData.find((item) => !item.disabled) || null;
}, [stagedQuery]);
diff --git a/frontend/src/container/LogDetailedView/ContextView/ContextView.tsx b/frontend/src/container/LogDetailedView/ContextView/ContextView.tsx
index fbb3f611f3..f462875455 100644
--- a/frontend/src/container/LogDetailedView/ContextView/ContextView.tsx
+++ b/frontend/src/container/LogDetailedView/ContextView/ContextView.tsx
@@ -19,7 +19,9 @@ function ContextView({
isEdit,
}: LogContextProps): JSX.Element {
// eslint-disable-next-line react/jsx-no-useless-fragment
- if (!contextQuery) return <></>;
+ if (!contextQuery) {
+ return <></>;
+ }
return (
<div className="log-context-container">
diff --git a/frontend/src/container/LogDetailedView/ContextView/useContextLogData.ts b/frontend/src/container/LogDetailedView/ContextView/useContextLogData.ts
index afbd7bb7cc..e2998545c7 100644
--- a/frontend/src/container/LogDetailedView/ContextView/useContextLogData.ts
+++ b/frontend/src/container/LogDetailedView/ContextView/useContextLogData.ts
@@ -73,7 +73,9 @@ export const useContextLogData = ({
]);
const currentStagedQueryData = useMemo(() => {
- if (!query || query.builder.queryData.length !== 1) return null;
+ if (!query || query.builder.queryData.length !== 1) {
+ return null;
+ }
return query.builder.queryData[0];
}, [query]);
@@ -165,7 +167,9 @@ export const useContextLogData = ({
]);
useEffect(() => {
- if (!isEdit) return;
+ if (!isEdit) {
+ return;
+ }
const newRequestData = getRequestData({
stagedQueryData: currentStagedQueryData,
diff --git a/frontend/src/container/LogDetailedView/LogContext.tsx b/frontend/src/container/LogDetailedView/LogContext.tsx
index 6997c65171..314fbda8f6 100644
--- a/frontend/src/container/LogDetailedView/LogContext.tsx
+++ b/frontend/src/container/LogDetailedView/LogContext.tsx
@@ -21,7 +21,9 @@ function LogContext({
isEdit,
}: LogContextProps): JSX.Element {
// eslint-disable-next-line react/jsx-no-useless-fragment
- if (!contextQuery) return <></>;
+ if (!contextQuery) {
+ return <></>;
+ }
return (
<div className="log-context-container">
diff --git a/frontend/src/container/LogDetailedView/TableView.tsx b/frontend/src/container/LogDetailedView/TableView.tsx
index d644c5e4cb..911b12d166 100644
--- a/frontend/src/container/LogDetailedView/TableView.tsx
+++ b/frontend/src/container/LogDetailedView/TableView.tsx
@@ -164,7 +164,9 @@ function TableView({
record: DataType,
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
): void => {
- if (flattenLogData === null) return;
+ if (flattenLogData === null) {
+ return;
+ }
const traceId = flattenLogData[record.field];
diff --git a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx
index 70b61cd92b..f280cd7b6d 100644
--- a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx
+++ b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx
@@ -147,7 +147,9 @@ export default function TableViewActions(
// Memoize bodyHtml computation
const bodyHtml = useMemo(() => {
- if (record.field !== 'body') return { __html: '' };
+ if (record.field !== 'body') {
+ return { __html: '' };
+ }
return {
__html: getSanitizedLogBody(record.value, { shouldEscapeHtml: true }),
@@ -157,7 +159,9 @@ export default function TableViewActions(
const fieldFilterKey = filterKeyForField(fieldData.field);
const handleGroupByAttribute = useCallback((): void => {
- if (!stagedQuery) return;
+ if (!stagedQuery) {
+ return;
+ }
const normalizedDataType: DataTypes | undefined =
dataType && Object.values(DataTypes).includes(dataType as DataTypes)
? (dataType as DataTypes)
@@ -217,7 +221,9 @@ export default function TableViewActions(
// Memoize cleanTimestamp computation
const cleanTimestamp = useMemo(() => {
- if (record.field !== 'timestamp') return '';
+ if (record.field !== 'timestamp') {
+ return '';
+ }
return fieldData.value.replace(/^["']|["']$/g, '');
}, [record.field, fieldData.value]);
diff --git a/frontend/src/container/Login/index.tsx b/frontend/src/container/Login/index.tsx
index 2386fa4f9e..ac0680b70f 100644
--- a/frontend/src/container/Login/index.tsx
+++ b/frontend/src/container/Login/index.tsx
@@ -268,7 +268,9 @@ function Login(): JSX.Element {
isEmailValid && !versionLoading && !sessionsContextLoading;
const isSubmitButtonEnabled = useMemo((): boolean => {
- if (!isEmailValid || isSubmitting) return false;
+ if (!isEmailValid || isSubmitting) {
+ return false;
+ }
const hasMultipleOrgs = (sessionsContext?.orgs.length ?? 0) > 1;
if (hasMultipleOrgs && !orgId) {
return false;
diff --git a/frontend/src/container/LogsContextList/index.tsx b/frontend/src/container/LogsContextList/index.tsx
index d215386c03..1277aa0403 100644
--- a/frontend/src/container/LogsContextList/index.tsx
+++ b/frontend/src/container/LogsContextList/index.tsx
@@ -63,7 +63,9 @@ function LogsContextList({
]);
const currentStagedQueryData = useMemo(() => {
- if (!query || query.builder.queryData.length !== 1) return null;
+ if (!query || query.builder.queryData.length !== 1) {
+ return null;
+ }
return query.builder.queryData[0];
}, [query]);
@@ -117,7 +119,9 @@ function LogsContextList({
);
const handleShowNextLines = useCallback(() => {
- if (isDisabledFetch) return;
+ if (isDisabledFetch) {
+ return;
+ }
const log = order === ORDERBY_FILTERS.ASC ? firstLog : lastLog;
@@ -144,7 +148,9 @@ function LogsContextList({
]);
useEffect(() => {
- if (!isEdit) return;
+ if (!isEdit) {
+ return;
+ }
const newRequestData = getRequestData({
stagedQueryData: currentStagedQueryData,
diff --git a/frontend/src/container/LogsContextList/utils.ts b/frontend/src/container/LogsContextList/utils.ts
index 50b90cabc0..fdc8c28f44 100644
--- a/frontend/src/container/LogsContextList/utils.ts
+++ b/frontend/src/container/LogsContextList/utils.ts
@@ -36,7 +36,9 @@ export const getRequestData = ({
page,
pageSize = INITIAL_PAGE_SIZE,
}: GetRequestDataProps): Query | null => {
- if (!query) return null;
+ if (!query) {
+ return null;
+ }
const paginateData = getPaginationQueryData({
filters: stagedQueryData?.filters || initialFilters,
diff --git a/frontend/src/container/LogsExplorerContext/index.tsx b/frontend/src/container/LogsExplorerContext/index.tsx
index 32075097e5..5048098b96 100644
--- a/frontend/src/container/LogsExplorerContext/index.tsx
+++ b/frontend/src/container/LogsExplorerContext/index.tsx
@@ -37,8 +37,9 @@ function LogsExplorerContext({
if (
(!tagFiltersLength && (!filters || !filters.items.length)) ||
tagFiltersLength === filters?.items.length
- )
+ ) {
return;
+ }
const nextQuery: Query = {
...contextQuery,
diff --git a/frontend/src/container/LogsExplorerContext/utils.ts b/frontend/src/container/LogsExplorerContext/utils.ts
index 18d49e5d52..bbab0fa01c 100644
--- a/frontend/src/container/LogsExplorerContext/utils.ts
+++ b/frontend/src/container/LogsExplorerContext/utils.ts
@@ -67,7 +67,9 @@ export const findFirstPriorityItem = (
export const getFallbackItems = (items: TagFilterItem[]): TagFilterItem[] =>
items.filter((item) => {
- if (!item.key?.key) return false;
+ if (!item.key?.key) {
+ return false;
+ }
const { key } = item.key;
diff --git a/frontend/src/container/LogsExplorerList/ColumnView/ColumnView.tsx b/frontend/src/container/LogsExplorerList/ColumnView/ColumnView.tsx
index c7ba48fcb6..45dfaef7c9 100644
--- a/frontend/src/container/LogsExplorerList/ColumnView/ColumnView.tsx
+++ b/frontend/src/container/LogsExplorerList/ColumnView/ColumnView.tsx
@@ -207,7 +207,9 @@ function ColumnView({
);
const handleColumnOrderChange = (newColumns: ColumnDef<any>[]): void => {
- if (isEmpty(newColumns) || isEqual(newColumns, selectedColumns)) return;
+ if (isEmpty(newColumns) || isEqual(newColumns, selectedColumns)) {
+ return;
+ }
const formattedColumns = newColumns.map((column) => ({
id: column.id,
diff --git a/frontend/src/container/LogsExplorerList/InfinityTableView/TableRow.tsx b/frontend/src/container/LogsExplorerList/InfinityTableView/TableRow.tsx
index ddb68aa88f..c794d1a962 100644
--- a/frontend/src/container/LogsExplorerList/InfinityTableView/TableRow.tsx
+++ b/frontend/src/container/LogsExplorerList/InfinityTableView/TableRow.tsx
@@ -52,7 +52,9 @@ export default function TableRow({
(event) => {
event.preventDefault();
event.stopPropagation();
- if (!handleSetActiveContextLog || !currentLog) return;
+ if (!handleSetActiveContextLog || !currentLog) {
+ return;
+ }
handleSetActiveContextLog(currentLog);
},
@@ -60,7 +62,9 @@ export default function TableRow({
);
const handleShowLogDetails = useCallback(() => {
- if (!onShowLogDetails || !currentLog) return;
+ if (!onShowLogDetails || !currentLog) {
+ return;
+ }
onShowLogDetails(currentLog);
}, [currentLog, onShowLogDetails]);
@@ -71,9 +75,13 @@ export default function TableRow({
return (
<>
{tableColumns.map((column) => {
- if (!column.render) return <td>Empty</td>;
+ if (!column.key) {
+ return null;
+ }
- if (!column.key) return null;
+ if (!column.render) {
+ return <td key={column.key}>Empty</td>;
+ }
const element: ColumnTypeRender<Record<string, unknown>> = column.render(
log[column.key as keyof Record<string, unknown>],
diff --git a/frontend/src/container/LogsExplorerList/index.tsx b/frontend/src/container/LogsExplorerList/index.tsx
index 2385fefd16..1833392630 100644
--- a/frontend/src/container/LogsExplorerList/index.tsx
+++ b/frontend/src/container/LogsExplorerList/index.tsx
@@ -202,7 +202,9 @@ function LogsExplorerList({
]);
const isTraceToLogsNavigation = useMemo(() => {
- if (!currentStagedQueryData) return false;
+ if (!currentStagedQueryData) {
+ return false;
+ }
return isTraceToLogsQuery(currentStagedQueryData);
}, [currentStagedQueryData]);
@@ -210,7 +212,9 @@ function LogsExplorerList({
const queryIndex = lastUsedQuery ?? 0;
const updatedQuery = currentQuery?.builder.queryData?.[queryIndex];
- if (!updatedQuery) return;
+ if (!updatedQuery) {
+ return;
+ }
if (updatedQuery?.filters?.items) {
updatedQuery.filters.items = [];
@@ -235,7 +239,9 @@ function LogsExplorerList({
}, [currentQuery, lastUsedQuery, redirectWithQueryBuilderData]);
const getEmptyStateMessage = useMemo(() => {
- if (!isTraceToLogsNavigation) return;
+ if (!isTraceToLogsNavigation) {
+ return;
+ }
return getEmptyLogsListConfig(handleClearFilters);
}, [isTraceToLogsNavigation, handleClearFilters]);
diff --git a/frontend/src/container/LogsExplorerList/utils.ts b/frontend/src/container/LogsExplorerList/utils.ts
index 3cb62c39bf..d92e31c3a3 100644
--- a/frontend/src/container/LogsExplorerList/utils.ts
+++ b/frontend/src/container/LogsExplorerList/utils.ts
@@ -22,7 +22,9 @@ export const convertKeysToColumnFields = (
*/
export const isTraceToLogsQuery = (queryData: IBuilderQuery): boolean => {
// Check if this is a trace-to-logs query by looking for trace_id filter
- if (!queryData?.filters?.items) return false;
+ if (!queryData?.filters?.items) {
+ return false;
+ }
const traceIdFilter = queryData.filters.items.find(
(item: TagFilterItem) => item.key?.key === 'trace_id',
diff --git a/frontend/src/container/LogsExplorerViews/explorerUtils.ts b/frontend/src/container/LogsExplorerViews/explorerUtils.ts
index 81897002c7..4eaabe179d 100644
--- a/frontend/src/container/LogsExplorerViews/explorerUtils.ts
+++ b/frontend/src/container/LogsExplorerViews/explorerUtils.ts
@@ -17,7 +17,9 @@ import { v4 } from 'uuid';
export const getListQuery = (
stagedQuery: Query | null,
): IBuilderQuery | null => {
- if (!stagedQuery || stagedQuery.builder.queryData.length < 1) return null;
+ if (!stagedQuery || stagedQuery.builder.queryData.length < 1) {
+ return null;
+ }
return stagedQuery.builder.queryData[0] ?? null;
};
@@ -105,7 +107,9 @@ export const getQueryByPanelType = (
orderBy?: string;
},
): Query | null => {
- if (!query) return null;
+ if (!query) {
+ return null;
+ }
let queryData: IBuilderQuery[] = query.builder.queryData.map((item) => ({
...item,
@@ -181,11 +185,15 @@ export const getExportQueryData = (
query: Query | null,
panelType: PANEL_TYPES,
): Query | null => {
- if (!query) return null;
+ if (!query) {
+ return null;
+ }
if (panelType === PANEL_TYPES.LIST) {
const listQuery = getListQuery(query);
- if (!listQuery) return null;
+ if (!listQuery) {
+ return null;
+ }
return {
...query,
diff --git a/frontend/src/container/LogsExplorerViews/index.tsx b/frontend/src/container/LogsExplorerViews/index.tsx
index 09cb87b45e..ef5f523a33 100644
--- a/frontend/src/container/LogsExplorerViews/index.tsx
+++ b/frontend/src/container/LogsExplorerViews/index.tsx
@@ -118,8 +118,12 @@ function LogsExplorerViewsContainer({
]);
const isLimit: boolean = useMemo(() => {
- if (!listQuery) return false;
- if (!listQuery.limit) return false;
+ if (!listQuery) {
+ return false;
+ }
+ if (!listQuery.limit) {
+ return false;
+ }
return logs.length >= listQuery.limit;
}, [logs.length, listQuery]);
@@ -213,10 +217,16 @@ function LogsExplorerViewsContainer({
}, [data?.payload, data?.warning]);
const handleEndReached = useCallback(() => {
- if (!listQuery) return;
+ if (!listQuery) {
+ return;
+ }
- if (isLimit) return;
- if (logs.length < pageSize) return;
+ if (isLimit) {
+ return;
+ }
+ if (logs.length < pageSize) {
+ return;
+ }
const { limit, filters, filter } = listQuery;
@@ -225,7 +235,9 @@ function LogsExplorerViewsContainer({
const nextPageSize =
limit && nextLogsLength >= limit ? limit - logs.length : pageSize;
- if (!stagedQuery) return;
+ if (!stagedQuery) {
+ return;
+ }
const newRequestData = getRequestData(stagedQuery, {
filters: filters || { items: [], op: 'AND' },
@@ -258,7 +270,9 @@ function LogsExplorerViewsContainer({
const handleExport = useCallback(
(dashboard: Dashboard | null, isNewDashboard?: boolean): void => {
- if (!dashboard || !selectedPanelType) return;
+ if (!dashboard || !selectedPanelType) {
+ return;
+ }
const panelTypeParam = AVAILABLE_EXPORT_PANEL_TYPES.includes(
selectedPanelType,
@@ -268,7 +282,9 @@ function LogsExplorerViewsContainer({
const widgetId = v4();
- if (!exportDefaultQuery) return;
+ if (!exportDefaultQuery) {
+ return;
+ }
logEvent('Logs Explorer: Add to dashboard successful', {
panelType: selectedPanelType,
@@ -358,7 +374,9 @@ function LogsExplorerViewsContainer({
}, []);
const chartData = useMemo(() => {
- if (!stagedQuery) return [];
+ if (!stagedQuery) {
+ return [];
+ }
if (selectedPanelType === PANEL_TYPES.LIST) {
if (listChartData && listChartData.payload.data?.result.length > 0) {
@@ -367,7 +385,9 @@ function LogsExplorerViewsContainer({
return [];
}
- if (!data || data.payload.data?.result.length === 0) return [];
+ if (!data || data.payload.data?.result.length === 0) {
+ return [];
+ }
const isGroupByExist = stagedQuery.builder.queryData.some(
(queryData) => queryData.groupBy.length > 0,
diff --git a/frontend/src/container/LogsFilters/FieldItem.tsx b/frontend/src/container/LogsFilters/FieldItem.tsx
index dd788e8671..0cf9c9af40 100644
--- a/frontend/src/container/LogsFilters/FieldItem.tsx
+++ b/frontend/src/container/LogsFilters/FieldItem.tsx
@@ -24,7 +24,9 @@ function FieldItem({
const isDarkMode = useIsDarkMode();
const onClickHandler = useCallback(() => {
- if (!isLoading && buttonOnClick) buttonOnClick({ fieldData, fieldIndex });
+ if (!isLoading && buttonOnClick) {
+ buttonOnClick({ fieldData, fieldIndex });
+ }
}, [buttonOnClick, fieldData, fieldIndex, isLoading]);
const renderContent = useMemo(() => {
diff --git a/frontend/src/container/LogsFilters/utils.ts b/frontend/src/container/LogsFilters/utils.ts
index ab3bd68f81..7bf54eaa25 100644
--- a/frontend/src/container/LogsFilters/utils.ts
+++ b/frontend/src/container/LogsFilters/utils.ts
@@ -64,7 +64,9 @@ export const onHandleRemoveInterest = async ({
fieldData,
fieldIndex,
}: OnHandleRemoveInterestProps): Promise<void> => {
- if (RESTRICTED_SELECTED_FIELDS.includes(fieldData.name)) return;
+ if (RESTRICTED_SELECTED_FIELDS.includes(fieldData.name)) {
+ return;
+ }
const { dispatch } = store;
diff --git a/frontend/src/container/LogsPanelTable/LogsPanelComponent.tsx b/frontend/src/container/LogsPanelTable/LogsPanelComponent.tsx
index b3a68f11b9..78eebad5c5 100644
--- a/frontend/src/container/LogsPanelTable/LogsPanelComponent.tsx
+++ b/frontend/src/container/LogsPanelTable/LogsPanelComponent.tsx
@@ -95,7 +95,9 @@ function LogsPanelComponent({
(record: RowData): HTMLAttributes<RowData> => ({
onClick: (): void => {
const log = logs.find((item) => item.id === record.id);
- if (log) onSetActiveLog(log);
+ if (log) {
+ onSetActiveLog(log);
+ }
},
}),
[logs, onSetActiveLog],
diff --git a/frontend/src/container/LogsSearchFilter/SearchFields/QueryBuilder/QueryBuilder.tsx b/frontend/src/container/LogsSearchFilter/SearchFields/QueryBuilder/QueryBuilder.tsx
index 1a16349fb9..853aa1925d 100644
--- a/frontend/src/container/LogsSearchFilter/SearchFields/QueryBuilder/QueryBuilder.tsx
+++ b/frontend/src/container/LogsSearchFilter/SearchFields/QueryBuilder/QueryBuilder.tsx
@@ -198,8 +198,11 @@ function QueryBuilder({
const handleDelete = (queryIndex: number): void => {
const updated = [...fieldsQuery];
- if (queryIndex !== 0) updated.splice(queryIndex - 1, 2);
- else updated.splice(queryIndex, 2);
+ if (queryIndex !== 0) {
+ updated.splice(queryIndex - 1, 2);
+ } else {
+ updated.splice(queryIndex, 2);
+ }
setFieldsQuery(updated);
diff --git a/frontend/src/container/LogsTopNav/index.tsx b/frontend/src/container/LogsTopNav/index.tsx
index e80483484d..9239fc87f5 100644
--- a/frontend/src/container/LogsTopNav/index.tsx
+++ b/frontend/src/container/LogsTopNav/index.tsx
@@ -28,7 +28,9 @@ function LogsTopNav(): JSX.Element {
const { stagedQuery, panelType } = useQueryBuilder();
const handleGoLive = useCallback(() => {
- if (!stagedQuery) return;
+ if (!stagedQuery) {
+ return;
+ }
let queryHistoryState: QueryHistoryState | null = null;
diff --git a/frontend/src/container/MeterExplorer/Explorer/Explorer.tsx b/frontend/src/container/MeterExplorer/Explorer/Explorer.tsx
index 96df78776d..c660616271 100644
--- a/frontend/src/container/MeterExplorer/Explorer/Explorer.tsx
+++ b/frontend/src/container/MeterExplorer/Explorer/Explorer.tsx
@@ -79,7 +79,9 @@ function Explorer(): JSX.Element {
_isNewDashboard?: boolean,
queryToExport?: Query,
): void => {
- if (!dashboard) return;
+ if (!dashboard) {
+ return;
+ }
const widgetId = uuid();
diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx
index f267545bbe..13af61e86c 100644
--- a/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx
+++ b/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx
@@ -84,7 +84,9 @@ function ApDexMetrics({
);
const threshold: ReactNode = useMemo(() => {
- if (thresholdValue) return <DisplayThreshold threshold={thresholdValue} />;
+ if (thresholdValue) {
+ return <DisplayThreshold threshold={thresholdValue} />;
+ }
return null;
}, [thresholdValue]);
diff --git a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
index d3c09ce6e2..f5a9b091c2 100644
--- a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
+++ b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
@@ -182,7 +182,9 @@ function Explorer(): JSX.Element {
_isNewDashboard?: boolean,
queryToExport?: Query,
): void => {
- if (!dashboard) return;
+ if (!dashboard) {
+ return;
+ }
const widgetId = uuid();
diff --git a/frontend/src/container/MetricsExplorer/Inspect/utils.tsx b/frontend/src/container/MetricsExplorer/Inspect/utils.tsx
index 66364b73a5..c4ded46d4b 100644
--- a/frontend/src/container/MetricsExplorer/Inspect/utils.tsx
+++ b/frontend/src/container/MetricsExplorer/Inspect/utils.tsx
@@ -559,7 +559,9 @@ export function onGraphClick(
u,
formattedInspectMetricsTimeSeries,
);
- if (seriesIndex <= 0) return;
+ if (seriesIndex <= 0) {
+ return;
+ }
const series = inspectMetricsTimeSeries[seriesIndex - 1];
diff --git a/frontend/src/container/MetricsExplorer/MetricDetails/MetricDetails.tsx b/frontend/src/container/MetricsExplorer/MetricDetails/MetricDetails.tsx
index bd4403701c..7e36428016 100644
--- a/frontend/src/container/MetricsExplorer/MetricDetails/MetricDetails.tsx
+++ b/frontend/src/container/MetricsExplorer/MetricDetails/MetricDetails.tsx
@@ -55,7 +55,9 @@ function MetricDetails({
const metric = data?.payload?.data;
const lastReceived = useMemo(() => {
- if (!metric) return null;
+ if (!metric) {
+ return null;
+ }
return formatTimestampToReadableDate(metric.lastReceived);
}, [metric]);
@@ -67,7 +69,9 @@ function MetricDetails({
const isMetricDetailsLoading = isLoading || isFetching;
const timeSeries = useMemo(() => {
- if (!metric) return null;
+ if (!metric) {
+ return null;
+ }
const timeSeriesActive = formatNumberToCompactFormat(metric.timeSeriesActive);
const timeSeriesTotal = formatNumberToCompactFormat(metric.timeSeriesTotal);
diff --git a/frontend/src/container/MetricsExplorer/MetricDetails/utils.tsx b/frontend/src/container/MetricsExplorer/MetricDetails/utils.tsx
index df2d57cd42..5232c52c20 100644
--- a/frontend/src/container/MetricsExplorer/MetricDetails/utils.tsx
+++ b/frontend/src/container/MetricsExplorer/MetricDetails/utils.tsx
@@ -11,15 +11,19 @@ export function formatTimestampToReadableDate(timestamp: string): string {
const now = new Date();
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
- if (diffInSeconds < 60) return 'Few seconds ago';
+ if (diffInSeconds < 60) {
+ return 'Few seconds ago';
+ }
const diffInMinutes = Math.floor(diffInSeconds / 60);
- if (diffInMinutes < 60)
+ if (diffInMinutes < 60) {
return `${diffInMinutes} minute${diffInMinutes > 1 ? 's' : ''} ago`;
+ }
const diffInHours = Math.floor(diffInMinutes / 60);
- if (diffInHours < 24)
+ if (diffInHours < 24) {
return `${diffInHours} hour${diffInHours > 1 ? 's' : ''} ago`;
+ }
const diffInDays = Math.floor(diffInHours / 24);
if (diffInDays === 1) {
@@ -28,7 +32,9 @@ export function formatTimestampToReadableDate(timestamp: string): string {
.toString()
.padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
}
- if (diffInDays < 7) return `${diffInDays} days ago`;
+ if (diffInDays < 7) {
+ return `${diffInDays} days ago`;
+ }
return date.toLocaleDateString();
}
diff --git a/frontend/src/container/MetricsExplorer/Summary/MetricNameSearch.tsx b/frontend/src/container/MetricsExplorer/Summary/MetricNameSearch.tsx
index f26cd1fc4e..5e4547d03f 100644
--- a/frontend/src/container/MetricsExplorer/Summary/MetricNameSearch.tsx
+++ b/frontend/src/container/MetricsExplorer/Summary/MetricNameSearch.tsx
@@ -99,7 +99,9 @@ function MetricNameSearch({
const handleKeyDown = useCallback(
(event: React.KeyboardEvent<HTMLInputElement>) => {
- if (!isPopoverOpen) return;
+ if (!isPopoverOpen) {
+ return;
+ }
if (event.key === 'ArrowDown') {
event.preventDefault();
diff --git a/frontend/src/container/MySettings/LicenseSection/LicenseSection.tsx b/frontend/src/container/MySettings/LicenseSection/LicenseSection.tsx
index b691674679..7d12c3487e 100644
--- a/frontend/src/container/MySettings/LicenseSection/LicenseSection.tsx
+++ b/frontend/src/container/MySettings/LicenseSection/LicenseSection.tsx
@@ -13,7 +13,9 @@ function LicenseSection(): JSX.Element | null {
const [, handleCopyToClipboard] = useCopyToClipboard();
const getMaskedKey = (key: string): string => {
- if (!key || key.length < 4) return key || 'N/A';
+ if (!key || key.length < 4) {
+ return key || 'N/A';
+ }
return `${key.substring(0, 2)}********${key
.substring(key.length - 2)
.trim()}`;
diff --git a/frontend/src/container/MySettings/index.tsx b/frontend/src/container/MySettings/index.tsx
index b8dd8d9ef0..449eb30f8b 100644
--- a/frontend/src/container/MySettings/index.tsx
+++ b/frontend/src/container/MySettings/index.tsx
@@ -82,7 +82,9 @@ function MySettings(): JSX.Element {
];
const [theme, setTheme] = useState(() => {
- if (autoSwitch) return 'auto';
+ if (autoSwitch) {
+ return 'auto';
+ }
return isDarkMode ? 'dark' : 'light';
});
diff --git a/frontend/src/container/NewWidget/LeftContainer/ExplorerColumnsRenderer.tsx b/frontend/src/container/NewWidget/LeftContainer/ExplorerColumnsRenderer.tsx
index 92e613e6e7..b2d27e61f1 100644
--- a/frontend/src/container/NewWidget/LeftContainer/ExplorerColumnsRenderer.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/ExplorerColumnsRenderer.tsx
@@ -133,13 +133,14 @@ function ExplorerColumnsRenderer({
},
]);
}
- } else if (selectedField)
+ } else if (selectedField) {
setSelectedTracesFields([
{
...selectedField,
fieldDataType: selectedField.fieldDataType as FieldDataType,
},
]);
+ }
}
setOpen(false);
};
diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx
index 45b7da2b10..1ed8159063 100644
--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx
@@ -63,7 +63,9 @@ function WidgetGraph({
// Apply graph visibility when lineChartRef is available
useEffect(() => {
- if (!lineChartRef.current) return;
+ if (!lineChartRef.current) {
+ return;
+ }
graphVisibility.forEach((state, index) => {
lineChartRef.current?.toggleGraph(index, state);
diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/util.ts b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/util.ts
index 1ff56c5764..8d752f7607 100644
--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/util.ts
+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/util.ts
@@ -11,7 +11,9 @@ export function populateMultipleResults(
queryResults?.forEach((query: QueryDataV3) => {
const { queryName, legend, table } = query;
- if (!table) return;
+ if (!table) {
+ return;
+ }
const { columns, rows } = table;
diff --git a/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx b/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx
index eb5a652910..6c41f0e971 100644
--- a/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx
+++ b/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx
@@ -51,7 +51,9 @@ function UpdateContextLinks({
// Extract field variables from the widget's query (all groupBy fields from all queries)
const fieldVariables = useMemo(() => {
- if (!selectedWidget?.query?.builder?.queryData) return {};
+ if (!selectedWidget?.query?.builder?.queryData) {
+ return {};
+ }
const fieldVars: Record<string, string | number | boolean> = {};
diff --git a/frontend/src/container/NewWidget/RightContainer/ContextLinks/utils.tsx b/frontend/src/container/NewWidget/RightContainer/ContextLinks/utils.tsx
index 2162e743ec..b1f9402b02 100644
--- a/frontend/src/container/NewWidget/RightContainer/ContextLinks/utils.tsx
+++ b/frontend/src/container/NewWidget/RightContainer/ContextLinks/utils.tsx
@@ -136,7 +136,9 @@ const processContextLinks = (
// Process URLs with proper encoding/decoding
const finalUrls = urls.map((url) => {
- if (typeof url !== 'string') return url;
+ if (typeof url !== 'string') {
+ return url;
+ }
try {
// 1. Get the URL and extract base URL and query string
@@ -148,7 +150,9 @@ const processContextLinks = (
});
const resolvedBaseUrl = resolvedBaseUrlResult.fullTexts[0];
- if (!queryString) return resolvedBaseUrl;
+ if (!queryString) {
+ return resolvedBaseUrl;
+ }
// 2. Extract all query params using URLSearchParams
const searchParams = new URLSearchParams(queryString);
diff --git a/frontend/src/container/NewWidget/RightContainer/dataFormatCategories.ts b/frontend/src/container/NewWidget/RightContainer/dataFormatCategories.ts
index ea5bc2ab55..df8b1bd4c0 100644
--- a/frontend/src/container/NewWidget/RightContainer/dataFormatCategories.ts
+++ b/frontend/src/container/NewWidget/RightContainer/dataFormatCategories.ts
@@ -576,13 +576,19 @@ export function convertUnit(
// Finds the category that contains the specified units and extracts fromUnit and toUnit using array methods
const category = dataTypeCategories.find((category) =>
category.formats.some((format) => {
- if (format.id === fromUnitId) fromUnit = format.id;
- if (format.id === toUnitId) toUnit = format.id;
+ if (format.id === fromUnitId) {
+ fromUnit = format.id;
+ }
+ if (format.id === toUnitId) {
+ toUnit = format.id;
+ }
return fromUnit && toUnit; // Break out early if both units are found
}),
);
- if (!category || !fromUnit || !toUnit) return null; // Return null if category or units are not found
+ if (!category || !fromUnit || !toUnit) {
+ return null;
+ } // Return null if category or units are not found
// Gets the conversion factor for the specified units
const conversionFactor = getConversionFactor(
@@ -590,7 +596,9 @@ export function convertUnit(
toUnit,
category.name as any,
);
- if (conversionFactor === null) return null; // Return null if conversion is not possible
+ if (conversionFactor === null) {
+ return null;
+ } // Return null if conversion is not possible
return value * conversionFactor;
}
diff --git a/frontend/src/container/NewWidget/RightContainer/index.tsx b/frontend/src/container/NewWidget/RightContainer/index.tsx
index eba2a39b8e..1343dfa345 100644
--- a/frontend/src/container/NewWidget/RightContainer/index.tsx
+++ b/frontend/src/container/NewWidget/RightContainer/index.tsx
@@ -175,7 +175,9 @@ function RightContainer({
// Get dashboard variables
const dashboardVariables = useMemo<VariableOption[]>(() => {
- if (!selectedDashboard?.data?.variables) return [];
+ if (!selectedDashboard?.data?.variables) {
+ return [];
+ }
return Object.entries(selectedDashboard.data.variables).map(([, value]) => ({
value: value.name || '',
label: value.name || '',
@@ -228,7 +230,9 @@ function RightContainer({
const pos = cursorPos;
const value = inputValue;
const lastDollar = value.lastIndexOf('$', pos - 1);
- if (lastDollar === -1) return false;
+ if (lastDollar === -1) {
+ return false;
+ }
const afterDollar = value.substring(lastDollar + 1, pos).toLowerCase();
return option?.value.toLowerCase().startsWith(afterDollar) || false;
};
diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsx
index 3a6ea69da2..30658b08fa 100644
--- a/frontend/src/container/NewWidget/index.tsx
+++ b/frontend/src/container/NewWidget/index.tsx
@@ -718,7 +718,9 @@ function NewWidget({
enableDrillDown && !isNewDashboard && !!query.get('widgetId');
const handleSwitchToViewMode = useCallback(() => {
- if (!query.get('widgetId')) return;
+ if (!query.get('widgetId')) {
+ return;
+ }
const widgetId = query.get('widgetId') || '';
const graphType = query.get('graphType') || '';
const queryParams = {
diff --git a/frontend/src/container/OnboardingQuestionaire/OrgQuestions/OrgQuestions.tsx b/frontend/src/container/OnboardingQuestionaire/OrgQuestions/OrgQuestions.tsx
index 4a2606a24b..b4384d6d77 100644
--- a/frontend/src/container/OnboardingQuestionaire/OrgQuestions/OrgQuestions.tsx
+++ b/frontend/src/container/OnboardingQuestionaire/OrgQuestions/OrgQuestions.tsx
@@ -282,8 +282,12 @@ function OrgQuestions({
<div className="opentelemetry-radio-container">
<Radio.Group
value={((): string | undefined => {
- if (usesOtel === true) return 'yes';
- if (usesOtel === false) return 'no';
+ if (usesOtel === true) {
+ return 'yes';
+ }
+ if (usesOtel === false) {
+ return 'no';
+ }
return undefined;
})()}
onChange={(e: RadioChangeEvent): void =>
diff --git a/frontend/src/container/OnboardingV2Container/QuestionBlock/QuestionBlock.tsx b/frontend/src/container/OnboardingV2Container/QuestionBlock/QuestionBlock.tsx
index d684d496b6..2704b13b35 100644
--- a/frontend/src/container/OnboardingV2Container/QuestionBlock/QuestionBlock.tsx
+++ b/frontend/src/container/OnboardingV2Container/QuestionBlock/QuestionBlock.tsx
@@ -73,7 +73,9 @@ function QuestionBlock({
const filteredOptions = group.items.filter((option) =>
option.toLowerCase().includes(searchQuery),
);
- if (filteredOptions.length === 0) return null;
+ if (filteredOptions.length === 0) {
+ return null;
+ }
return (
<Flex gap={8} vertical key={group.id}>
{group.category && (
diff --git a/frontend/src/container/OptionsMenu/AddColumnField/index.tsx b/frontend/src/container/OptionsMenu/AddColumnField/index.tsx
index 274e9094bd..3eb8a8a599 100644
--- a/frontend/src/container/OptionsMenu/AddColumnField/index.tsx
+++ b/frontend/src/container/OptionsMenu/AddColumnField/index.tsx
@@ -17,7 +17,9 @@ function AddColumnField({ config }: AddColumnFieldProps): JSX.Element | null {
const { t } = useTranslation(['trace']);
const isDarkMode = useIsDarkMode();
- if (!config) return null;
+ if (!config) {
+ return null;
+ }
return (
<AddColumnWrapper direction="vertical">
diff --git a/frontend/src/container/OptionsMenu/FormatField/index.tsx b/frontend/src/container/OptionsMenu/FormatField/index.tsx
index b4a5ab5eb9..6859cfa108 100644
--- a/frontend/src/container/OptionsMenu/FormatField/index.tsx
+++ b/frontend/src/container/OptionsMenu/FormatField/index.tsx
@@ -11,14 +11,18 @@ function FormatField({ config }: FormatFieldProps): JSX.Element | null {
const onChange = useCallback(
(event: RadioChangeEvent) => {
- if (!config) return;
+ if (!config) {
+ return;
+ }
config.onChange(event.target.value);
},
[config],
);
- if (!config) return null;
+ if (!config) {
+ return null;
+ }
return (
<FormatFieldWrapper direction="vertical">
diff --git a/frontend/src/container/OptionsMenu/MaxLinesField/index.tsx b/frontend/src/container/OptionsMenu/MaxLinesField/index.tsx
index 779e948e56..b588b7f03c 100644
--- a/frontend/src/container/OptionsMenu/MaxLinesField/index.tsx
+++ b/frontend/src/container/OptionsMenu/MaxLinesField/index.tsx
@@ -7,7 +7,9 @@ import { MaxLinesFieldWrapper, MaxLinesInput } from './styles';
function MaxLinesField({ config }: MaxLinesFieldProps): JSX.Element | null {
const { t } = useTranslation(['trace']);
- if (!config) return null;
+ if (!config) {
+ return null;
+ }
return (
<MaxLinesFieldWrapper>
diff --git a/frontend/src/container/OptionsMenu/useOptionsMenu.ts b/frontend/src/container/OptionsMenu/useOptionsMenu.ts
index 9380f9df4b..0630738ce5 100644
--- a/frontend/src/container/OptionsMenu/useOptionsMenu.ts
+++ b/frontend/src/container/OptionsMenu/useOptionsMenu.ts
@@ -294,7 +294,9 @@ const useOptionsMenu = ({
...(preferences?.columns || []),
].find(({ name }) => name === key);
- if (!column) return acc;
+ if (!column) {
+ return acc;
+ }
return [...acc, column];
}, [] as TelemetryFieldKey[]);
diff --git a/frontend/src/container/PageSizeSelect/index.tsx b/frontend/src/container/PageSizeSelect/index.tsx
index 21e408f4ce..73a9971f0e 100644
--- a/frontend/src/container/PageSizeSelect/index.tsx
+++ b/frontend/src/container/PageSizeSelect/index.tsx
@@ -25,7 +25,9 @@ function PageSizeSelect({
[redirectWithQuery],
);
- if (!isShow) return null;
+ if (!isShow) {
+ return null;
+ }
return (
<Row>
diff --git a/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx b/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx
index 09963f18f5..c35b0260e0 100644
--- a/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx
+++ b/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx
@@ -134,7 +134,9 @@ function TraceFlamegraph(props: ITraceFlamegraphProps): JSX.Element {
<div className="stats">
{Object.keys(serviceExecTime)
.sort((a, b) => {
- if (spread <= 0) return 0;
+ if (spread <= 0) {
+ return 0;
+ }
const aValue = (serviceExecTime[a] * 100) / spread;
const bValue = (serviceExecTime[b] * 100) / spread;
return bValue - aValue;
diff --git a/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx b/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx
index 5136da3741..5bb1a070da 100644
--- a/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx
+++ b/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx
@@ -122,7 +122,9 @@ function PiePanelWrapper({
baseSize: number;
innerRadius: number;
}): number => {
- if (!text) return baseSize;
+ if (!text) {
+ return baseSize;
+ }
const { length } = text;
// More aggressive scaling for very long numbers
diff --git a/frontend/src/container/PanelWrapper/utils.ts b/frontend/src/container/PanelWrapper/utils.ts
index fa26e7c280..1de38dbc7b 100644
--- a/frontend/src/container/PanelWrapper/utils.ts
+++ b/frontend/src/container/PanelWrapper/utils.ts
@@ -63,7 +63,9 @@ const hexToRgb = (
export const lightenColor = (color: string, opacity: number): string => {
// Convert the hex color to RGB format
const rgbColor = hexToRgb(color);
- if (!rgbColor) return color; // Return the original color if unable to parse
+ if (!rgbColor) {
+ return color;
+ } // Return the original color if unable to parse
// Extract the RGB components
const { r, g, b } = rgbColor;
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx
index a52858645d..ce1565f814 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx
+++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx
@@ -60,7 +60,9 @@ function AddNewPipeline({
}
if (isAdd) {
setCurrPipelineData((prevState) => {
- if (prevState) return [...prevState, newPipeLineData];
+ if (prevState) {
+ return [...prevState, newPipeLineData];
+ }
return [newPipeLineData];
});
}
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/PipelineExpandView.tsx b/frontend/src/container/PipelinePage/PipelineListsView/PipelineExpandView.tsx
index d00f3fad83..0a1329247e 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/PipelineExpandView.tsx
+++ b/frontend/src/container/PipelinePage/PipelineListsView/PipelineExpandView.tsx
@@ -156,7 +156,9 @@ function PipelineExpandView({
const onCancelReorderProcessorRow = useCallback(
() => (): void => {
- if (expandedPipelineData) setExpandedPipelineData(expandedPipelineData);
+ if (expandedPipelineData) {
+ setExpandedPipelineData(expandedPipelineData);
+ }
},
[expandedPipelineData, setExpandedPipelineData],
);
diff --git a/frontend/src/container/QueryBuilder/components/ToolbarActions/RightToolbarActions.tsx b/frontend/src/container/QueryBuilder/components/ToolbarActions/RightToolbarActions.tsx
index 575c338eeb..77bc7777c5 100644
--- a/frontend/src/container/QueryBuilder/components/ToolbarActions/RightToolbarActions.tsx
+++ b/frontend/src/container/QueryBuilder/components/ToolbarActions/RightToolbarActions.tsx
@@ -27,7 +27,9 @@ export default function RightToolbarActions({
const queryClient = useQueryClient();
useEffect(() => {
- if (showLiveLogs) return;
+ if (showLiveLogs) {
+ return;
+ }
registerShortcut(LogsExplorerShortcuts.StageAndRunQuery, onStageRunQuery);
@@ -37,7 +39,7 @@ export default function RightToolbarActions({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [onStageRunQuery, showLiveLogs]);
- if (showLiveLogs)
+ if (showLiveLogs) {
return (
<div className="right-toolbar-actions-container">
<Button
@@ -50,6 +52,7 @@ export default function RightToolbarActions({
</Button>
</div>
);
+ }
const handleCancelQuery = (): void => {
if (listQueryKeyRef?.current) {
diff --git a/frontend/src/container/QueryBuilder/filters/Formula/OrderBy/useOrderByFormulaFilter.tsx b/frontend/src/container/QueryBuilder/filters/Formula/OrderBy/useOrderByFormulaFilter.tsx
index 3ad52da55f..adb59553d3 100644
--- a/frontend/src/container/QueryBuilder/filters/Formula/OrderBy/useOrderByFormulaFilter.tsx
+++ b/frontend/src/container/QueryBuilder/filters/Formula/OrderBy/useOrderByFormulaFilter.tsx
@@ -80,7 +80,9 @@ export const useOrderByFormulaFilter = ({
mapLabelValuePairs(data).flat();
const customValue: IOption[] = useMemo(() => {
- if (!searchText) return [];
+ if (!searchText) {
+ return [];
+ }
return [
{
diff --git a/frontend/src/container/QueryBuilder/filters/OrderByFilter/useOrderByFilter.ts b/frontend/src/container/QueryBuilder/filters/OrderByFilter/useOrderByFilter.ts
index 76fae4b9fc..90bb3d0457 100644
--- a/frontend/src/container/QueryBuilder/filters/OrderByFilter/useOrderByFilter.ts
+++ b/frontend/src/container/QueryBuilder/filters/OrderByFilter/useOrderByFilter.ts
@@ -45,7 +45,9 @@ export const useOrderByFilter = ({
);
const customValue: IOption[] = useMemo(() => {
- if (!searchText) return [];
+ if (!searchText) {
+ return [];
+ }
return [
{
diff --git a/frontend/src/container/QueryBuilder/filters/OrderByFilter/utils.ts b/frontend/src/container/QueryBuilder/filters/OrderByFilter/utils.ts
index 31147cfb58..9220c5ea94 100644
--- a/frontend/src/container/QueryBuilder/filters/OrderByFilter/utils.ts
+++ b/frontend/src/container/QueryBuilder/filters/OrderByFilter/utils.ts
@@ -74,7 +74,9 @@ export function splitOrderByFromString(str: string): OrderByPayload | null {
const order = splittedStr.pop() || ORDERBY_FILTERS.ASC;
const columnName = splittedStr.join(' ');
- if (!columnName) return null;
+ if (!columnName) {
+ return null;
+ }
return { columnName, order };
}
diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx
index 6f759e7ed7..9a8ae0b2cb 100644
--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx
+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx
@@ -192,7 +192,9 @@ function QueryBuilderSearch({
disabled={isDisabled}
$isEnabled={!!searchValue}
onClick={(): void => {
- if (!isDisabled) tagEditHandler(value);
+ if (!isDisabled) {
+ tagEditHandler(value);
+ }
}}
>
{chipValue}
@@ -203,12 +205,18 @@ function QueryBuilderSearch({
};
const onChangeHandler = (value: string[]): void => {
- if (!isMulti) handleSearch(value[value.length - 1]);
+ if (!isMulti) {
+ handleSearch(value[value.length - 1]);
+ }
};
const onInputKeyDownHandler = (event: KeyboardEvent<Element>): void => {
- if (isMulti || event.key === 'Backspace') handleKeyDown(event);
- if (isExistsNotExistsOperator(searchValue)) handleKeyDown(event);
+ if (isMulti || event.key === 'Backspace') {
+ handleKeyDown(event);
+ }
+ if (isExistsNotExistsOperator(searchValue)) {
+ handleKeyDown(event);
+ }
// Editing is done after enter key press
if (event.key === 'Enter') {
@@ -262,7 +270,9 @@ function QueryBuilderSearch({
};
const queryTags = useMemo(() => {
- if (!query.aggregateAttribute?.key && isMetricsDataSource) return [];
+ if (!query.aggregateAttribute?.key && isMetricsDataSource) {
+ return [];
+ }
return tags;
}, [isMetricsDataSource, query.aggregateAttribute?.key, tags]);
diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx
index f0aaeb0050..e48d43412c 100644
--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx
+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx
@@ -793,9 +793,12 @@ function QueryBuilderSearchV2(
const values: string[] = [];
const { tagValue } = getTagToken(searchValue);
if (isArray(tagValue)) {
- if (!isEmpty(tagValue[tagValue.length - 1]))
+ if (!isEmpty(tagValue[tagValue.length - 1])) {
values.push(tagValue[tagValue.length - 1]);
- } else if (!isEmpty(tagValue)) values.push(tagValue);
+ }
+ } else if (!isEmpty(tagValue)) {
+ values.push(tagValue);
+ }
if (attributeValues?.payload) {
const dataType = currentFilterItem?.key?.dataType || DataTypes.String;
@@ -960,7 +963,9 @@ function QueryBuilderSearchV2(
disabled={isDisabled}
$isEnabled={!!searchValue}
onClick={(): void => {
- if (!isDisabled) tagEditHandler(value);
+ if (!isDisabled) {
+ tagEditHandler(value);
+ }
}}
>
{chipValue}
diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx
index a9aa2d5fe8..4f89e82685 100644
--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx
+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx
@@ -77,8 +77,12 @@ function SpanScopeSelector({
filter.value === 'true',
);
- if (hasFilter('isRoot')) return SpanScope.ROOT_SPANS;
- if (hasFilter('isEntryPoint')) return SpanScope.ENTRYPOINT_SPANS;
+ if (hasFilter('isRoot')) {
+ return SpanScope.ROOT_SPANS;
+ }
+ if (hasFilter('isEntryPoint')) {
+ return SpanScope.ENTRYPOINT_SPANS;
+ }
return SpanScope.ALL_SPANS;
};
@@ -103,7 +107,9 @@ function SpanScopeSelector({
currentFilters: TagFilterItem[] = [],
isTargetQuery: boolean,
): TagFilterItem[] => {
- if (!isTargetQuery) return currentFilters;
+ if (!isTargetQuery) {
+ return currentFilters;
+ }
const nonScopeFilters = currentFilters.filter(
(filter) =>
diff --git a/frontend/src/container/QueryBuilder/filters/utils.ts b/frontend/src/container/QueryBuilder/filters/utils.ts
index 889c9ed321..3f2baf2d18 100644
--- a/frontend/src/container/QueryBuilder/filters/utils.ts
+++ b/frontend/src/container/QueryBuilder/filters/utils.ts
@@ -46,14 +46,17 @@ export const isValidHavingValue = (search: string): boolean => {
export const getUniqueOrderByValues = (values: IOption[]): IOption[] => {
const modifiedValues = values.map((item) => {
const match = parse(item.value, { delimiter: orderByValueDelimiter });
- if (!match) return { label: item.label, value: item.value };
+ if (!match) {
+ return { label: item.label, value: item.value };
+ }
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
const [_, order] = match.data.flat() as string[];
- if (order)
+ if (order) {
return {
label: item.label,
value: item.value,
};
+ }
return {
label: `${item.value} ${ORDERBY_FILTERS.ASC}`,
@@ -71,8 +74,12 @@ export const getUniqueOrderByValues = (values: IOption[]): IOption[] => {
export const getValidOrderByResult = (result: IOption[]): IOption[] =>
result.reduce<IOption[]>((acc, item) => {
- if (item.value === ORDERBY_FILTERS.ASC || item.value === ORDERBY_FILTERS.DESC)
+ if (
+ item.value === ORDERBY_FILTERS.ASC ||
+ item.value === ORDERBY_FILTERS.DESC
+ ) {
return acc;
+ }
if (
item.value.includes(ORDERBY_FILTERS.ASC) ||
@@ -116,7 +123,9 @@ export const filterByOperatorConfig = (
options: IOption[],
key?: OperatorConfigKeys,
): IOption[] => {
- if (!key || !OPERATORS_CONFIG[key]) return options;
+ if (!key || !OPERATORS_CONFIG[key]) {
+ return options;
+ }
return options.filter((option) =>
OPERATORS_CONFIG[key].includes(option.label),
);
diff --git a/frontend/src/container/QueryTable/Drilldown/drilldownUtils.tsx b/frontend/src/container/QueryTable/Drilldown/drilldownUtils.tsx
index d0e3ad7309..7e150ba318 100644
--- a/frontend/src/container/QueryTable/Drilldown/drilldownUtils.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/drilldownUtils.tsx
@@ -53,7 +53,9 @@ export const getRoute = (key: string): string => {
};
export const isNumberDataType = (dataType: DataTypes | undefined): boolean => {
- if (!dataType) return false;
+ if (!dataType) {
+ return false;
+ }
return dataType === DataTypes.Int64 || dataType === DataTypes.Float64;
};
@@ -90,7 +92,9 @@ function addFiltersToQuerySteps(
filters.forEach(({ filterKey, filterValue, operator }) => {
// skip if this step doesn't group by our key
const baseMeta = step.groupBy.find((g) => g.key === filterKey);
- if (!baseMeta) return;
+ if (!baseMeta) {
+ return;
+ }
newFilters.items.push({
id: uuid(),
@@ -235,7 +239,9 @@ export const getPieChartClickData = (
label: string | React.ReactNode;
} | null => {
const { metric, queryName } = arc.data.record;
- if (!queryName || !metric) return null;
+ if (!queryName || !metric) {
+ return null;
+ }
const label = <span style={{ color: arc.data.color }}>{arc.data.label}</span>;
return {
@@ -286,7 +292,9 @@ export const getViewQuery = (
const queryBuilderData = VIEW_QUERY_MAP[key];
- if (!queryBuilderData) return null;
+ if (!queryBuilderData) {
+ return null;
+ }
let existingFilters: TagFilterItem[] = [];
let existingFilterExpression: string | undefined;
@@ -301,7 +309,9 @@ export const getViewQuery = (
const filters = filtersToAdd.reduce((acc: any[], filter) => {
// use existing query to get baseMeta
const baseMeta = getBaseMeta(query, filter.filterKey);
- if (!baseMeta) return acc;
+ if (!baseMeta) {
+ return acc;
+ }
acc.push({
id: uuid(),
diff --git a/frontend/src/container/QueryTable/Drilldown/metricsCorrelationUtils.tsx b/frontend/src/container/QueryTable/Drilldown/metricsCorrelationUtils.tsx
index b6023f3011..3d367ae5a3 100644
--- a/frontend/src/container/QueryTable/Drilldown/metricsCorrelationUtils.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/metricsCorrelationUtils.tsx
@@ -52,10 +52,14 @@ function modifyKeyVal(pair: IQueryPair, mapping: KeyValueMapping): string {
// Map a single value token using valueMappings, skipping variables
const mapOne = (val: string | undefined): string | undefined => {
- if (val == null) return val;
+ if (val == null) {
+ return val;
+ }
const t = String(val).trim();
// Skip variables for now. We will handle them later.
- if (t.startsWith('$')) return t;
+ if (t.startsWith('$')) {
+ return t;
+ }
const raw = isQuoted(t) ? unquote(t) : t;
return mapping.valueMappings[raw] ?? raw;
};
@@ -121,7 +125,9 @@ export function replaceKeysAndValuesInExpression(
for (let i = 0; i < pairs.length; i += 1) {
const pair = pairs[i];
// Require complete positions for safe slicing
- if (!pair?.position) continue;
+ if (!pair?.position) {
+ continue;
+ }
const start =
pair.position.keyStart ??
pair.position.operatorStart ??
@@ -148,7 +154,9 @@ export function replaceKeysAndValuesInExpression(
for (let i = 0; i < withBounds.length; i += 1) {
const item = withBounds[i];
const sourceKey = item.pair?.key?.trim().toLowerCase();
- if (!sourceKey) continue;
+ if (!sourceKey) {
+ continue;
+ }
const mapping = attributeToMapping.get(sourceKey);
if (!mapping) {
diff --git a/frontend/src/container/QueryTable/Drilldown/tableDrilldownUtils.tsx b/frontend/src/container/QueryTable/Drilldown/tableDrilldownUtils.tsx
index 5303d6a26b..129d3fb0e0 100644
--- a/frontend/src/container/QueryTable/Drilldown/tableDrilldownUtils.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/tableDrilldownUtils.tsx
@@ -24,12 +24,15 @@ export const getFiltersToAddToView = (clickedData: any): FilterData[] => {
.reduce((acc: FilterData[], col: any) => {
// only add table col which have isValueColumn false. and the filter value suffices the isEmptyFilterValue condition.
const { dataIndex } = col;
- if (!dataIndex || typeof dataIndex !== 'string') return acc;
+ if (!dataIndex || typeof dataIndex !== 'string') {
+ return acc;
+ }
if (
clickedData?.column?.isValueColumn &&
isEmptyFilterValue(clickedData?.record?.[dataIndex])
- )
+ ) {
return acc;
+ }
return [
...acc,
{
diff --git a/frontend/src/container/QueryTable/Drilldown/useAggregateDrilldown.tsx b/frontend/src/container/QueryTable/Drilldown/useAggregateDrilldown.tsx
index 1cd2437a18..18d281c06b 100644
--- a/frontend/src/container/QueryTable/Drilldown/useAggregateDrilldown.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/useAggregateDrilldown.tsx
@@ -55,10 +55,14 @@ const useAggregateDrilldown = ({
} => {
// Ensure aggregateData has timeRange, fallback to widget time or global time if not provided
const aggregateDataWithTimeRange = useMemo(() => {
- if (!aggregateData) return null;
+ if (!aggregateData) {
+ return null;
+ }
// If timeRange is already provided, use it
- if (aggregateData.timeRange) return aggregateData;
+ if (aggregateData.timeRange) {
+ return aggregateData;
+ }
// Try to get widget-specific time range first, then fall back to global time
const timeRangeData = getTimeRange(queryRange);
@@ -83,7 +87,9 @@ const useAggregateDrilldown = ({
});
const fieldVariables = useMemo(() => {
- if (!aggregateDataWithTimeRange?.filters) return {};
+ if (!aggregateDataWithTimeRange?.filters) {
+ return {};
+ }
// Extract field variables from aggregation data filters
const fieldVars: Record<string, string | number | boolean> = {};
diff --git a/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx b/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx
index 900e0fa3ab..35d2b8ae05 100644
--- a/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx
@@ -69,7 +69,9 @@ const useBaseAggregateOptions = ({
const { selectedDashboard } = useDashboard();
useEffect(() => {
- if (!aggregateData) return;
+ if (!aggregateData) {
+ return;
+ }
const resolveQuery = async (): Promise<void> => {
const updatedQuery = await getUpdatedQuery({
widgetConfig: {
@@ -94,7 +96,9 @@ const useBaseAggregateOptions = ({
});
const getContextLinksItems = useCallback(() => {
- if (!contextLinks?.linksData) return [];
+ if (!contextLinks?.linksData) {
+ return [];
+ }
try {
const processedLinks = processContextLinks(
diff --git a/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx b/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx
index e5545eb16c..6f8cb34c94 100644
--- a/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx
@@ -52,16 +52,24 @@ const useDashboardVarConfig = ({
| 'traces'
| 'metrics'
| 'all sources' => {
- if (!query || !aggregateData?.queryName) return 'all sources';
+ if (!query || !aggregateData?.queryName) {
+ return 'all sources';
+ }
try {
const { dataSource } = getAggregateColumnHeader(
query,
aggregateData.queryName,
);
- if (dataSource === 'logs') return 'logs';
- if (dataSource === 'traces') return 'traces';
- if (dataSource === 'metrics') return 'metrics';
+ if (dataSource === 'logs') {
+ return 'logs';
+ }
+ if (dataSource === 'traces') {
+ return 'traces';
+ }
+ if (dataSource === 'metrics') {
+ return 'metrics';
+ }
} catch (error) {
console.warn('Error determining data source:', error);
}
diff --git a/frontend/src/container/QueryTable/Drilldown/useTableContextMenu.tsx b/frontend/src/container/QueryTable/Drilldown/useTableContextMenu.tsx
index 75eda3691f..7cd6c8760d 100644
--- a/frontend/src/container/QueryTable/Drilldown/useTableContextMenu.tsx
+++ b/frontend/src/container/QueryTable/Drilldown/useTableContextMenu.tsx
@@ -52,7 +52,9 @@ export function useTableContextMenu({
});
const aggregateData = useMemo((): AggregateData | null => {
- if (!clickedData?.column?.isValueColumn) return null;
+ if (!clickedData?.column?.isValueColumn) {
+ return null;
+ }
return {
queryName: String(clickedData.column.queryName || ''),
diff --git a/frontend/src/container/ServiceApplication/Columns/ServiceColumn.ts b/frontend/src/container/ServiceApplication/Columns/ServiceColumn.ts
index b0487b8915..a8952f4684 100644
--- a/frontend/src/container/ServiceApplication/Columns/ServiceColumn.ts
+++ b/frontend/src/container/ServiceApplication/Columns/ServiceColumn.ts
@@ -28,7 +28,9 @@ export const getColumns = (
}`,
sorter: (a: ServicesList, b: ServicesList): number => a.p99 - b.p99,
render: (value: number): string => {
- if (Number.isNaN(value)) return '0.00';
+ if (Number.isNaN(value)) {
+ return '0.00';
+ }
return isMetricData ? value.toFixed(2) : (value / 1000000).toFixed(2);
},
},
diff --git a/frontend/src/container/SideNav/sideNav.utils.ts b/frontend/src/container/SideNav/sideNav.utils.ts
index 77aee24147..3fa1171121 100644
--- a/frontend/src/container/SideNav/sideNav.utils.ts
+++ b/frontend/src/container/SideNav/sideNav.utils.ts
@@ -3,7 +3,9 @@ import { NEW_ROUTES_MENU_ITEM_KEY_MAP } from './menuItems';
export const getActiveMenuKeyFromPath = (pathname: string): string => {
const basePath = pathname?.split('/')?.[1]; // Get the base path, Eg; /dashboard/dc5beb63-589c-46a3-ad4c-1b9ca248ee33 -> dashboard
- if (!basePath) return '';
+ if (!basePath) {
+ return '';
+ }
const baseRoute = `/${basePath}`;
diff --git a/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx b/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx
index a04e35a0ec..bc17267239 100644
--- a/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx
@@ -50,7 +50,9 @@ export default function AttributeActions({
}, [record.value]);
const handleFilterIn = useCallback(async (): Promise<void> => {
- if (!onAddToQuery || isFilterInLoading) return;
+ if (!onAddToQuery || isFilterInLoading) {
+ return;
+ }
setIsFilterInLoading(true);
try {
await Promise.resolve(
@@ -62,7 +64,9 @@ export default function AttributeActions({
}, [onAddToQuery, record.field, record.value, isFilterInLoading]);
const handleFilterOut = useCallback(async (): Promise<void> => {
- if (!onAddToQuery || isFilterOutLoading) return;
+ if (!onAddToQuery || isFilterOutLoading) {
+ return;
+ }
setIsFilterOutLoading(true);
try {
await Promise.resolve(
diff --git a/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx b/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx
index 5003a03853..ddb53f0d7e 100644
--- a/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx
@@ -46,8 +46,12 @@ function Attributes(props: IAttributesProps): JSX.Element {
const aIsPinned = pinnedAttributes[a.field];
const bIsPinned = pinnedAttributes[b.field];
- if (aIsPinned && !bIsPinned) return -1;
- if (!aIsPinned && bIsPinned) return 1;
+ if (aIsPinned && !bIsPinned) {
+ return -1;
+ }
+ if (!aIsPinned && bIsPinned) {
+ return 1;
+ }
// Within same pinning status, maintain alphabetical order
return a.field.localeCompare(b.field);
diff --git a/frontend/src/container/SpanDetailsDrawer/SpanLogs/useSpanContextLogs.ts b/frontend/src/container/SpanDetailsDrawer/SpanLogs/useSpanContextLogs.ts
index 79908948cb..e4c1aa9fd4 100644
--- a/frontend/src/container/SpanDetailsDrawer/SpanLogs/useSpanContextLogs.ts
+++ b/frontend/src/container/SpanDetailsDrawer/SpanLogs/useSpanContextLogs.ts
@@ -169,7 +169,9 @@ export const useSpanContextLogs = ({
// Get first and last span logs for context queries
const { firstSpanLog, lastSpanLog } = useMemo(() => {
- if (spanLogs.length === 0) return { firstSpanLog: null, lastSpanLog: null };
+ if (spanLogs.length === 0) {
+ return { firstSpanLog: null, lastSpanLog: null };
+ }
const sortedLogs = [...spanLogs].sort(
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime(),
@@ -182,12 +184,16 @@ export const useSpanContextLogs = ({
}, [spanLogs]);
// Phase 2: Fetch context logs before first span log
const beforeFilter = useMemo(() => {
- if (!firstSpanLog) return null;
+ if (!firstSpanLog) {
+ return null;
+ }
return createContextFilters(traceId, firstSpanLog.id, 'lt');
}, [traceId, firstSpanLog]);
const beforeQueryPayload = useMemo(() => {
- if (!beforeFilter) return null;
+ if (!beforeFilter) {
+ return null;
+ }
return getSpanLogsQueryPayload(
timeRange.startTime,
timeRange.endTime,
@@ -211,12 +217,16 @@ export const useSpanContextLogs = ({
// Phase 3: Fetch context logs after last span log
const afterFilter = useMemo(() => {
- if (!lastSpanLog) return null;
+ if (!lastSpanLog) {
+ return null;
+ }
return createContextFilters(traceId, lastSpanLog.id, 'gt');
}, [traceId, lastSpanLog]);
const afterQueryPayload = useMemo(() => {
- if (!afterFilter) return null;
+ if (!afterFilter) {
+ return null;
+ }
return getSpanLogsQueryPayload(
timeRange.startTime,
timeRange.endTime,
@@ -241,7 +251,9 @@ export const useSpanContextLogs = ({
// Extract context logs
const beforeLogs = useMemo(() => {
- if (!beforeData?.payload?.data?.newResult?.data?.result?.[0]?.list) return [];
+ if (!beforeData?.payload?.data?.newResult?.data?.result?.[0]?.list) {
+ return [];
+ }
return beforeData.payload.data.newResult.data.result[0].list.map(
(item: any) => ({
@@ -252,7 +264,9 @@ export const useSpanContextLogs = ({
}, [beforeData]);
const afterLogs = useMemo(() => {
- if (!afterData?.payload?.data?.newResult?.data?.result?.[0]?.list) return [];
+ if (!afterData?.payload?.data?.newResult?.data?.result?.[0]?.list) {
+ return [];
+ }
return afterData.payload.data.newResult.data.result[0].list.map(
(item: any) => ({
@@ -270,13 +284,17 @@ export const useSpanContextLogs = ({
// Phase 4: Check for trace_id-only logs when span has no logs
// This helps differentiate between "no logs for span" vs "no logs for trace"
const traceOnlyFilter = useMemo(() => {
- if (spanLogs.length > 0) return null;
+ if (spanLogs.length > 0) {
+ return null;
+ }
const filters = getTraceOnlyFilters(traceId);
return convertFiltersToExpression(filters);
}, [traceId, spanLogs.length]);
const traceOnlyQueryPayload = useMemo(() => {
- if (!traceOnlyFilter) return null;
+ if (!traceOnlyFilter) {
+ return null;
+ }
return getSpanLogsQueryPayload(
timeRange.startTime,
timeRange.endTime,
@@ -298,7 +316,9 @@ export const useSpanContextLogs = ({
});
const hasTraceIdLogs = useMemo(() => {
- if (spanLogs.length > 0) return true;
+ if (spanLogs.length > 0) {
+ return true;
+ }
return !!(
traceOnlyData?.payload?.data?.newResult?.data?.result?.[0]?.list?.length || 0
);
diff --git a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
index 0075efd781..512b6f73a8 100644
--- a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
@@ -362,7 +362,9 @@ describe('SpanDetailsDrawer', () => {
const filterExpression = (query as any)?.query?.builder?.queryData?.[0]
?.filter?.expression;
- if (!filterExpression) return Promise.resolve(mockEmptyLogsResponse);
+ if (!filterExpression) {
+ return Promise.resolve(mockEmptyLogsResponse);
+ }
// Check for span logs query (contains both trace_id and span_id)
if (filterExpression.includes('span_id')) {
diff --git a/frontend/src/container/SpanDetailsDrawer/utils.ts b/frontend/src/container/SpanDetailsDrawer/utils.ts
index b0d3ce5fdb..e318c99640 100644
--- a/frontend/src/container/SpanDetailsDrawer/utils.ts
+++ b/frontend/src/container/SpanDetailsDrawer/utils.ts
@@ -16,7 +16,9 @@ export const INFRA_METADATA_KEYS = [
* @returns true if the span has at least one infrastructure metadata key, false otherwise
*/
export function hasInfraMetadata(span: Span | undefined): boolean {
- if (!span?.tagMap) return false;
+ if (!span?.tagMap) {
+ return false;
+ }
return INFRA_METADATA_KEYS.some((key) => span.tagMap?.[key]);
}
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx b/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
index 2a7c2abd1a..71c10555fd 100644
--- a/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
@@ -534,7 +534,9 @@ function DateTimeSelection({
// Sync time picker state with URL on browser navigation
useEffect(() => {
- if (navigationType !== 'POP') return;
+ if (navigationType !== 'POP') {
+ return;
+ }
if (searchStartTime && searchEndTime) {
handleAbsoluteTimeSync(searchStartTime, searchEndTime, minTime, maxTime);
diff --git a/frontend/src/container/Trace/Graph/config.ts b/frontend/src/container/Trace/Graph/config.ts
index 5f84c4840a..9a1cdd9a06 100644
--- a/frontend/src/container/Trace/Graph/config.ts
+++ b/frontend/src/container/Trace/Graph/config.ts
@@ -30,7 +30,7 @@ export const getChartData = (
};
const chartLabels: ChartData<'line'>['labels'] = [];
- if (allDataPoints && typeof allDataPoints === 'object')
+ if (allDataPoints && typeof allDataPoints === 'object') {
Object.keys(allDataPoints).forEach((timestamp) => {
const key = allDataPoints[timestamp];
if (key.value) {
@@ -39,6 +39,7 @@ export const getChartData = (
chartLabels.push(date.toDate().getTime());
}
});
+ }
return {
datasets: [
diff --git a/frontend/src/container/TraceFlameGraph/index.tsx b/frontend/src/container/TraceFlameGraph/index.tsx
index 7e52031646..47f7d742b1 100644
--- a/frontend/src/container/TraceFlameGraph/index.tsx
+++ b/frontend/src/container/TraceFlameGraph/index.tsx
@@ -57,8 +57,11 @@ function SpanItem({
const handleHover = (hoverState: boolean): void => {
// setIsLocalHover(hoverState);
- if (hoverState) onSpanHover(spanData.id);
- else onSpanHover('');
+ if (hoverState) {
+ onSpanHover(spanData.id);
+ } else {
+ onSpanHover('');
+ }
};
const handleClick = (): void => {
diff --git a/frontend/src/container/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx b/frontend/src/container/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
index 2f485e0076..f1dae9c3f8 100644
--- a/frontend/src/container/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
+++ b/frontend/src/container/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
@@ -438,7 +438,9 @@ function Success(props: ISuccessProps): JSX.Element {
const { range } = instance;
// when there are less than 500 elements in the API call that means there is nothing to fetch on top and bottom so
// do not trigger the API call
- if (spans.length < 500) return;
+ if (spans.length < 500) {
+ return;
+ }
if (range?.startIndex === 0 && instance.isScrolling) {
// do not trigger for trace root as nothing to fetch above
diff --git a/frontend/src/hooks/ResizeTable/useSortableTable.ts b/frontend/src/hooks/ResizeTable/useSortableTable.ts
index 5425445578..3bfa3588ea 100644
--- a/frontend/src/hooks/ResizeTable/useSortableTable.ts
+++ b/frontend/src/hooks/ResizeTable/useSortableTable.ts
@@ -26,7 +26,9 @@ const useSortableTable = <T>(
});
const handleChange: TableProps<T>['onChange'] = (pagination, __, sorter) => {
- if (Array.isArray(sorter)) return;
+ if (Array.isArray(sorter)) {
+ return;
+ }
const searchParams = new URLSearchParams(search);
setSortedInfo(sorter as SorterResult<T>);
searchParams.set('columnKey', sorter.columnKey as string);
diff --git a/frontend/src/hooks/TracesFunnels/useFunnelConfiguration.tsx b/frontend/src/hooks/TracesFunnels/useFunnelConfiguration.tsx
index 503b8d927c..2c3d129d59 100644
--- a/frontend/src/hooks/TracesFunnels/useFunnelConfiguration.tsx
+++ b/frontend/src/hooks/TracesFunnels/useFunnelConfiguration.tsx
@@ -21,7 +21,9 @@ interface UseFunnelConfiguration {
// Add this helper function
export const normalizeSteps = (steps: FunnelStepData[]): FunnelStepData[] => {
- if (steps.some((step) => !step.filters)) return steps;
+ if (steps.some((step) => !step.filters)) {
+ return steps;
+ }
return steps.map((step) => ({
...step,
@@ -126,7 +128,9 @@ export default function useFunnelConfiguration({
const hasFunnelStepDefinitionsChanged = useCallback(
(prevSteps: FunnelStepData[], nextSteps: FunnelStepData[]): boolean => {
- if (prevSteps.length !== nextSteps.length) return true;
+ if (prevSteps.length !== nextSteps.length) {
+ return true;
+ }
return prevSteps.some((step, index) => {
const nextStep = nextSteps[index];
return (
@@ -159,7 +163,9 @@ export default function useFunnelConfiguration({
onSuccess: (data) => {
const updatedFunnelSteps = data?.payload?.steps;
- if (!updatedFunnelSteps) return;
+ if (!updatedFunnelSteps) {
+ return;
+ }
// Clear localStorage since steps are saved successfully
clearLocalStorageSavedSteps();
@@ -167,7 +173,9 @@ export default function useFunnelConfiguration({
queryClient.setQueryData(
[REACT_QUERY_KEY.GET_FUNNEL_DETAILS, funnel.funnel_id],
(oldData: any) => {
- if (!oldData?.payload) return oldData;
+ if (!oldData?.payload) {
+ return oldData;
+ }
return {
...oldData,
payload: {
diff --git a/frontend/src/hooks/TracesFunnels/useFunnelGraph.tsx b/frontend/src/hooks/TracesFunnels/useFunnelGraph.tsx
index 8ba1dca464..4e1c63ca96 100644
--- a/frontend/src/hooks/TracesFunnels/useFunnelGraph.tsx
+++ b/frontend/src/hooks/TracesFunnels/useFunnelGraph.tsx
@@ -81,7 +81,9 @@ function useFunnelGraph({
const getPercentageChange = useCallback(
(current: number, previous: number): number => {
- if (previous === 0) return 0;
+ if (previous === 0) {
+ return 0;
+ }
return Math.abs(Math.round(((current - previous) / previous) * 100));
},
[],
@@ -97,7 +99,9 @@ function useFunnelGraph({
const errorSteps: number[] = [];
let stepCount = 1;
- if (!data) return { successSteps, errorSteps, totalSteps: 0 };
+ if (!data) {
+ return { successSteps, errorSteps, totalSteps: 0 };
+ }
while (
data[`total_s${stepCount}_spans`] !== undefined &&
@@ -120,14 +124,18 @@ function useFunnelGraph({
}, [data]);
useEffect(() => {
- if (!canvasRef.current) return;
+ if (!canvasRef.current) {
+ return;
+ }
if (chartRef.current) {
chartRef.current.destroy();
}
const ctx = canvasRef.current.getContext('2d');
- if (!ctx) return;
+ if (!ctx) {
+ return;
+ }
const { successSteps, errorSteps, totalSteps } = getStepGraphData();
@@ -166,7 +174,9 @@ function useFunnelGraph({
useEffect(() => {
const chart = chartRef.current;
- if (!chart) return;
+ if (!chart) {
+ return;
+ }
const { successSteps, errorSteps } = getStepGraphData();
diff --git a/frontend/src/hooks/TracesFunnels/useFunnelMetrics.ts b/frontend/src/hooks/TracesFunnels/useFunnelMetrics.ts
index 3a9739aa18..f838f67237 100644
--- a/frontend/src/hooks/TracesFunnels/useFunnelMetrics.ts
+++ b/frontend/src/hooks/TracesFunnels/useFunnelMetrics.ts
@@ -36,7 +36,9 @@ export function useFunnelMetrics({
const metricsData = useMemo(() => {
const sourceData = overviewData?.payload?.data?.[0]?.data;
- if (!sourceData) return [];
+ if (!sourceData) {
+ return [];
+ }
return [
{
@@ -102,7 +104,9 @@ export function useFunnelStepsMetrics({
const metricsData = useMemo(() => {
const sourceData = stepsOverviewData?.payload?.data?.[0]?.data;
- if (!sourceData) return [];
+ if (!sourceData) {
+ return [];
+ }
return [
{
diff --git a/frontend/src/hooks/dashboard/useAddDynamicVariableToPanels.tsx b/frontend/src/hooks/dashboard/useAddDynamicVariableToPanels.tsx
index 991cc6d1fc..311bdd2bd0 100644
--- a/frontend/src/hooks/dashboard/useAddDynamicVariableToPanels.tsx
+++ b/frontend/src/hooks/dashboard/useAddDynamicVariableToPanels.tsx
@@ -23,7 +23,9 @@ export const useAddDynamicVariableToPanels = (): ((
widgetIds?: string[],
applyToAll?: boolean,
): Dashboard | undefined => {
- if (!variableConfig) return dashboard;
+ if (!variableConfig) {
+ return dashboard;
+ }
const { dynamicVariablesAttribute, name } = variableConfig;
diff --git a/frontend/src/hooks/dashboard/useContextVariables.tsx b/frontend/src/hooks/dashboard/useContextVariables.tsx
index 249c93ca17..656dc937d3 100644
--- a/frontend/src/hooks/dashboard/useContextVariables.tsx
+++ b/frontend/src/hooks/dashboard/useContextVariables.tsx
@@ -47,7 +47,9 @@ function useContextVariables({
// Extract dashboard variables
const dashboardVariables = useMemo(() => {
- if (!selectedDashboard?.data?.variables) return [];
+ if (!selectedDashboard?.data?.variables) {
+ return [];
+ }
return Object.entries(selectedDashboard.data.variables)
.filter(([, value]) => value.name)
@@ -95,7 +97,9 @@ function useContextVariables({
// Extract custom variables with '_' prefix to avoid conflicts
const customVariablesList = useMemo(() => {
- if (!customVariables) return [];
+ if (!customVariables) {
+ return [];
+ }
return Object.entries(customVariables).map(([name, value]) => ({
name: `_${name}`, // Add '_' prefix to avoid conflicts
@@ -184,16 +188,22 @@ const extractVarName = (
const dotMatch = match.match(
new RegExp(`\\{\\{\\s*\\.(${varNamePattern})\\s*\\}\\}`),
);
- if (dotMatch) return dotMatch[1].trim();
+ if (dotMatch) {
+ return dotMatch[1].trim();
+ }
const normalMatch = match.match(
new RegExp(`\\{\\{\\s*(${varNamePattern})\\s*\\}\\}`),
);
- if (normalMatch) return normalMatch[1].trim();
+ if (normalMatch) {
+ return normalMatch[1].trim();
+ }
} else if (match.startsWith('[[')) {
const bracketMatch = match.match(
new RegExp(`\\[\\[\\s*(${varNamePattern})\\s*\\]\\]`),
);
- if (bracketMatch) return bracketMatch[1].trim();
+ if (bracketMatch) {
+ return bracketMatch[1].trim();
+ }
} else if (match.startsWith(matcher)) {
// For $ variables, we always want to strip the prefix
// unless the full match exists in processedVariables
diff --git a/frontend/src/hooks/dashboard/useGetResolvedText.tsx b/frontend/src/hooks/dashboard/useGetResolvedText.tsx
index 960ef7bc0c..96e66df26d 100644
--- a/frontend/src/hooks/dashboard/useGetResolvedText.tsx
+++ b/frontend/src/hooks/dashboard/useGetResolvedText.tsx
@@ -32,13 +32,19 @@ function useGetResolvedText({
const isString = typeof text === 'string';
const processedDashboardVariables = useMemo(() => {
- if (variables) return variables;
- if (!selectedDashboard?.data.variables) return {};
+ if (variables) {
+ return variables;
+ }
+ if (!selectedDashboard?.data.variables) {
+ return {};
+ }
return Object.entries(selectedDashboard.data.variables).reduce<
Record<string, string | number | boolean>
>((acc, [, value]) => {
- if (!value.name) return acc;
+ if (!value.name) {
+ return acc;
+ }
// Handle array values
if (Array.isArray(value.selectedValue)) {
@@ -99,16 +105,22 @@ function useGetResolvedText({
const dotMatch = match.match(
new RegExp(`\\{\\{\\s*\\.(${varNamePattern})\\s*\\}\\}`),
);
- if (dotMatch) return dotMatch[1].trim();
+ if (dotMatch) {
+ return dotMatch[1].trim();
+ }
const normalMatch = match.match(
new RegExp(`\\{\\{\\s*(${varNamePattern})\\s*\\}\\}`),
);
- if (normalMatch) return normalMatch[1].trim();
+ if (normalMatch) {
+ return normalMatch[1].trim();
+ }
} else if (match.startsWith('[[')) {
const bracketMatch = match.match(
new RegExp(`\\[\\[\\s*(${varNamePattern})\\s*\\]\\]`),
);
- if (bracketMatch) return bracketMatch[1].trim();
+ if (bracketMatch) {
+ return bracketMatch[1].trim();
+ }
} else if (match.startsWith(matcher)) {
// For $ variables, we always want to strip the prefix
// unless the full match exists in processedVariables
@@ -129,7 +141,9 @@ function useGetResolvedText({
);
const fullText = useMemo(() => {
- if (!isString) return text;
+ if (!isString) {
+ return text;
+ }
return (text as string)?.replace(combinedPattern, (match) => {
const varName = extractVarName(match);
@@ -144,7 +158,9 @@ function useGetResolvedText({
}, [text, processedVariables, combinedPattern, extractVarName, isString]);
const truncatedText = useMemo(() => {
- if (!isString) return text;
+ if (!isString) {
+ return text;
+ }
const result = (text as string)?.replace(combinedPattern, (match) => {
const varName = extractVarName(match);
diff --git a/frontend/src/hooks/dashboard/utils.ts b/frontend/src/hooks/dashboard/utils.ts
index 5f56bec998..434efe7eb8 100644
--- a/frontend/src/hooks/dashboard/utils.ts
+++ b/frontend/src/hooks/dashboard/utils.ts
@@ -105,7 +105,9 @@ export const createDynamicVariableToWidgetsMap = (
if (Array.isArray(widgets)) {
widgets.forEach((widget) => {
if (widget.query?.queryType === EQueryType.QUERY_BUILDER) {
- if (!Array.isArray(widget.query.builder.queryData)) return;
+ if (!Array.isArray(widget.query.builder.queryData)) {
+ return;
+ }
widget.query.builder.queryData.forEach((queryData: IBuilderQuery) => {
// Check filter items for dynamic variables
@@ -139,7 +141,9 @@ export const createDynamicVariableToWidgetsMap = (
}
});
} else if (widget.query?.queryType === EQueryType.PROM) {
- if (!Array.isArray(widget.query.promql)) return;
+ if (!Array.isArray(widget.query.promql)) {
+ return;
+ }
widget.query.promql.forEach((promqlQuery) => {
dynamicVariables.forEach((variable) => {
@@ -153,7 +157,9 @@ export const createDynamicVariableToWidgetsMap = (
});
});
} else if (widget.query?.queryType === EQueryType.CLICKHOUSE) {
- if (!Array.isArray(widget.query.clickhouse_sql)) return;
+ if (!Array.isArray(widget.query.clickhouse_sql)) {
+ return;
+ }
widget.query.clickhouse_sql.forEach((clickhouseQuery) => {
dynamicVariables.forEach((variable) => {
diff --git a/frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx b/frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx
index 0c45979293..72b6190584 100644
--- a/frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx
+++ b/frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx
@@ -77,7 +77,9 @@ export function KeyboardHotkeysProvider({
const wasExtended = useRef(false);
const handleKeyDown = (event: KeyboardEvent): void => {
- if (event.repeat) return;
+ if (event.repeat) {
+ return;
+ }
const target = event.target as HTMLElement;
const isCodeMirrorEditor =
@@ -90,7 +92,9 @@ export function KeyboardHotkeysProvider({
}
const key = event.key?.toLowerCase();
- if (!key) return; // Skip if key is undefined
+ if (!key) {
+ return;
+ } // Skip if key is undefined
// If a pending combo exists and a new key is pressed → extension
if (pendingCombo.current && !pressedKeys.current.has(key)) {
@@ -99,9 +103,15 @@ export function KeyboardHotkeysProvider({
pressedKeys.current.add(key);
- if (event.shiftKey) pressedKeys.current.add('shift');
- if (event.metaKey || event.ctrlKey) pressedKeys.current.add('meta');
- if (event.altKey) pressedKeys.current.add('alt');
+ if (event.shiftKey) {
+ pressedKeys.current.add('shift');
+ }
+ if (event.metaKey || event.ctrlKey) {
+ pressedKeys.current.add('meta');
+ }
+ if (event.altKey) {
+ pressedKeys.current.add('alt');
+ }
const combo = normalizeChord(pressedKeys.current);
@@ -115,15 +125,25 @@ export function KeyboardHotkeysProvider({
const handleKeyUp = (event: KeyboardEvent): void => {
const key = event.key?.toLowerCase();
- if (!key) return; // Skip if key is undefined
+ if (!key) {
+ return;
+ } // Skip if key is undefined
pressedKeys.current.delete(key);
- if (!event.shiftKey) pressedKeys.current.delete('shift');
- if (!event.metaKey && !event.ctrlKey) pressedKeys.current.delete('meta');
- if (!event.altKey) pressedKeys.current.delete('alt');
+ if (!event.shiftKey) {
+ pressedKeys.current.delete('shift');
+ }
+ if (!event.metaKey && !event.ctrlKey) {
+ pressedKeys.current.delete('meta');
+ }
+ if (!event.altKey) {
+ pressedKeys.current.delete('alt');
+ }
- if (!pendingCombo.current) return;
+ if (!pendingCombo.current) {
+ return;
+ }
// Fire only if user did NOT extend the combo
if (!wasExtended.current) {
diff --git a/frontend/src/hooks/infraMonitoring/useHandleLogsPagination.tsx b/frontend/src/hooks/infraMonitoring/useHandleLogsPagination.tsx
index 061ea8657c..558b306f86 100644
--- a/frontend/src/hooks/infraMonitoring/useHandleLogsPagination.tsx
+++ b/frontend/src/hooks/infraMonitoring/useHandleLogsPagination.tsx
@@ -137,7 +137,9 @@ export const useHandleLogsPagination = ({
}, [shouldResetPage, timeRange]);
const loadMoreLogs = useCallback(() => {
- if (!logs.length) return;
+ if (!logs.length) {
+ return;
+ }
setPage((prev) => prev + 1);
setIsPaginating(true);
}, [logs]);
diff --git a/frontend/src/hooks/integration/aws/useAccountSettingsModal.ts b/frontend/src/hooks/integration/aws/useAccountSettingsModal.ts
index 5003e2f99c..17a12f0da9 100644
--- a/frontend/src/hooks/integration/aws/useAccountSettingsModal.ts
+++ b/frontend/src/hooks/integration/aws/useAccountSettingsModal.ts
@@ -41,7 +41,9 @@ const allRegions = (): string[] =>
regions.flatMap((r) => r.subRegions.map((sr) => sr.name));
const getRegionPreviewText = (regions: string[] | undefined): string[] => {
- if (!regions) return [];
+ if (!regions) {
+ return [];
+ }
if (regions.includes('all')) {
return allRegions();
}
diff --git a/frontend/src/hooks/logs/useCopyLogLink.ts b/frontend/src/hooks/logs/useCopyLogLink.ts
index bdbbaa9355..aaf9d1f2ce 100644
--- a/frontend/src/hooks/logs/useCopyLogLink.ts
+++ b/frontend/src/hooks/logs/useCopyLogLink.ts
@@ -45,7 +45,9 @@ export const useCopyLogLink = (logId?: string): UseCopyLogLink => {
const onLogCopy: MouseEventHandler<HTMLElement> = useCallback(
(event) => {
- if (!logId) return;
+ if (!logId) {
+ return;
+ }
event.preventDefault();
event.stopPropagation();
@@ -74,7 +76,9 @@ export const useCopyLogLink = (logId?: string): UseCopyLogLink => {
}, [pathname, search, safeNavigate]);
useEffect(() => {
- if (!isActiveLog) return;
+ if (!isActiveLog) {
+ return;
+ }
const timer = setTimeout(() => setIsHighlighted(false), HIGHLIGHTED_DELAY);
diff --git a/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx b/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx
index 0cb7c72a83..6c370ff825 100644
--- a/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx
+++ b/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx
@@ -41,7 +41,9 @@ const useCreateAlerts = (widget?: Widgets, caller?: string): VoidFunction => {
);
return useCallback(() => {
- if (!widget) return;
+ if (!widget) {
+ return;
+ }
if (caller === 'panelView') {
logEvent('Panel Edit: Create alert', {
diff --git a/frontend/src/hooks/queryBuilder/useGetCompositeQueryParam.ts b/frontend/src/hooks/queryBuilder/useGetCompositeQueryParam.ts
index 439292ab61..a1dcbd2ff6 100644
--- a/frontend/src/hooks/queryBuilder/useGetCompositeQueryParam.ts
+++ b/frontend/src/hooks/queryBuilder/useGetCompositeQueryParam.ts
@@ -17,7 +17,9 @@ export const useGetCompositeQueryParam = (): Query | null => {
let parsedCompositeQuery: Query | null = null;
try {
- if (!compositeQuery) return null;
+ if (!compositeQuery) {
+ return null;
+ }
// MDN reference - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#decoding_query_parameters_from_a_url
// MDN reference to support + characters using encoding - https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams#preserving_plus_signs add later
diff --git a/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts b/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts
index 0bd9167263..7ada1366b5 100644
--- a/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts
+++ b/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts
@@ -40,7 +40,9 @@ export const useGetExplorerQueryRange = (
: REACT_QUERY_KEY.GET_QUERY_RANGE;
const isEnabled = useMemo(() => {
- if (!options) return isEnabledQuery;
+ if (!options) {
+ return isEnabledQuery;
+ }
if (typeof options.enabled === 'boolean') {
return options.enabled && (!isDependentOnQB || isEnabledQuery);
}
diff --git a/frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts b/frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
index 0a9b554bc9..046245b80e 100644
--- a/frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
+++ b/frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
@@ -531,7 +531,9 @@ export const useQueryOperations: UseQueryOperations = ({
const isTracePanelType = panelType === PANEL_TYPES.TRACE;
useEffect(() => {
- if (initialDataSource && dataSource !== initialDataSource) return;
+ if (initialDataSource && dataSource !== initialDataSource) {
+ return;
+ }
if (
dataSource === DataSource.METRICS &&
diff --git a/frontend/src/hooks/queryPagination/useQueryPagination.ts b/frontend/src/hooks/queryPagination/useQueryPagination.ts
index bf3cc30bb4..dbd00906d6 100644
--- a/frontend/src/hooks/queryPagination/useQueryPagination.ts
+++ b/frontend/src/hooks/queryPagination/useQueryPagination.ts
@@ -60,7 +60,9 @@ const useQueryPagination = (
perPageOptions,
);
- if (paginationQuery && isValidPaginationData) return;
+ if (paginationQuery && isValidPaginationData) {
+ return;
+ }
redirectWithCurrentPagination(defaultPaginationConfig);
}, [
diff --git a/frontend/src/hooks/trace/useCopySpanLink.ts b/frontend/src/hooks/trace/useCopySpanLink.ts
index 7f0413c487..d16c9c72f5 100644
--- a/frontend/src/hooks/trace/useCopySpanLink.ts
+++ b/frontend/src/hooks/trace/useCopySpanLink.ts
@@ -15,7 +15,9 @@ export const useCopySpanLink = (
const onSpanCopy: MouseEventHandler<HTMLElement> = useCallback(
(event) => {
- if (!span) return;
+ if (!span) {
+ return;
+ }
event.preventDefault();
event.stopPropagation();
diff --git a/frontend/src/hooks/useDarkMode/__tests__/useDarkMode.test.tsx b/frontend/src/hooks/useDarkMode/__tests__/useDarkMode.test.tsx
index 779d93b011..7b994ef850 100644
--- a/frontend/src/hooks/useDarkMode/__tests__/useDarkMode.test.tsx
+++ b/frontend/src/hooks/useDarkMode/__tests__/useDarkMode.test.tsx
@@ -78,8 +78,12 @@ describe('useDarkMode', () => {
it('should load theme from localStorage', () => {
localStorageMock.getItem.mockImplementation((key: string) => {
- if (key === 'THEME') return 'light';
- if (key === 'THEME_AUTO_SWITCH') return 'true';
+ if (key === 'THEME') {
+ return 'light';
+ }
+ if (key === 'THEME_AUTO_SWITCH') {
+ return 'true';
+ }
return null;
});
diff --git a/frontend/src/hooks/useDimensions.ts b/frontend/src/hooks/useDimensions.ts
index bf4d5835ba..f5209c9ead 100644
--- a/frontend/src/hooks/useDimensions.ts
+++ b/frontend/src/hooks/useDimensions.ts
@@ -31,7 +31,9 @@ export function useResizeObserver<T extends HTMLElement>(
}
return (): void => {
- if (referenceNode) ro.disconnect();
+ if (referenceNode) {
+ ro.disconnect();
+ }
};
}, [ref, debounceTime]);
diff --git a/frontend/src/hooks/useDragColumns/index.ts b/frontend/src/hooks/useDragColumns/index.ts
index 17a41b50ce..37acc01e7f 100644
--- a/frontend/src/hooks/useDragColumns/index.ts
+++ b/frontend/src/hooks/useDragColumns/index.ts
@@ -64,7 +64,9 @@ const useDragColumns = <T>(storageKey: LOCALSTORAGE): UseDragColumns<T> => {
);
useEffect(() => {
- if (draggedColumnsQuery || !localStorageDraggedColumns) return;
+ if (draggedColumnsQuery || !localStorageDraggedColumns) {
+ return;
+ }
redirectWithNewDraggedColumns(localStorageDraggedColumns);
}, [
diff --git a/frontend/src/hooks/useDragColumns/utils.ts b/frontend/src/hooks/useDragColumns/utils.ts
index df11981066..88dbbb3636 100644
--- a/frontend/src/hooks/useDragColumns/utils.ts
+++ b/frontend/src/hooks/useDragColumns/utils.ts
@@ -28,7 +28,9 @@ export const getDraggedColumns = <T>(
({ title: columnTitle }) => title === columnTitle,
);
- if (column) return [...acc, column];
+ if (column) {
+ return [...acc, column];
+ }
return acc;
}, [] as ColumnsType<T>);
}
diff --git a/frontend/src/hooks/useHandleExplorerTabChange.ts b/frontend/src/hooks/useHandleExplorerTabChange.ts
index 88f95ae08b..a5a2024f04 100644
--- a/frontend/src/hooks/useHandleExplorerTabChange.ts
+++ b/frontend/src/hooks/useHandleExplorerTabChange.ts
@@ -66,7 +66,9 @@ export const useHandleExplorerTabChange = (): {
) => {
const newPanelType = type as PANEL_TYPES;
- if (newPanelType === panelType && !currentQueryData) return;
+ if (newPanelType === panelType && !currentQueryData) {
+ return;
+ }
const query = currentQueryData?.query || getUpdateQuery(newPanelType);
diff --git a/frontend/src/hooks/useLogsData.ts b/frontend/src/hooks/useLogsData.ts
index 33335de1cd..4a7324e2c7 100644
--- a/frontend/src/hooks/useLogsData.ts
+++ b/frontend/src/hooks/useLogsData.ts
@@ -51,14 +51,20 @@ export const useLogsData = ({
);
const listQuery = useMemo(() => {
- if (!stagedQuery || stagedQuery?.builder?.queryData?.length < 1) return null;
+ if (!stagedQuery || stagedQuery?.builder?.queryData?.length < 1) {
+ return null;
+ }
return stagedQuery.builder?.queryData.find((item) => !item.disabled) || null;
}, [stagedQuery]);
const isLimit: boolean = useMemo(() => {
- if (!listQuery) return false;
- if (!listQuery.limit) return false;
+ if (!listQuery) {
+ return false;
+ }
+ if (!listQuery.limit) {
+ return false;
+ }
return logs.length >= listQuery.limit;
}, [logs.length, listQuery]);
@@ -72,7 +78,9 @@ export const useLogsData = ({
}, [listQuery]);
useEffect(() => {
- if (panelType !== PANEL_TYPES.LIST) return;
+ if (panelType !== PANEL_TYPES.LIST) {
+ return;
+ }
const currentData = result || [];
if (currentData.length > 0 && currentData[0].list) {
const currentLogs: ILog[] = currentData[0].list.map((item) => ({
@@ -97,7 +105,9 @@ export const useLogsData = ({
filters: TagFilter;
},
): Query | null => {
- if (!query) return null;
+ if (!query) {
+ return null;
+ }
const paginateData = getPaginationQueryDataV2({
page: params.page,
@@ -161,10 +171,16 @@ export const useLogsData = ({
}, [data]);
const handleEndReached = (index: number): void => {
- if (!listQuery) return;
+ if (!listQuery) {
+ return;
+ }
- if (isLimit) return;
- if (logs.length < pageSize) return;
+ if (isLimit) {
+ return;
+ }
+ if (logs.length < pageSize) {
+ return;
+ }
const { limit, filters } = listQuery;
@@ -175,7 +191,9 @@ export const useLogsData = ({
const nextPageSize =
limit && nextLogsLength >= limit ? limit - logs.length : pageSize;
- if (!stagedQuery) return;
+ if (!stagedQuery) {
+ return;
+ }
const newRequestData = getRequestData(stagedQuery, {
filters: filters || { items: [], op: 'AND' },
diff --git a/frontend/src/hooks/useMultiIntersectionObserver.ts b/frontend/src/hooks/useMultiIntersectionObserver.ts
index 8c8ce59b43..409ec444a1 100644
--- a/frontend/src/hooks/useMultiIntersectionObserver.ts
+++ b/frontend/src/hooks/useMultiIntersectionObserver.ts
@@ -24,7 +24,9 @@ export function useMultiIntersectionObserver(
);
useEffect(() => {
- if (!elementsRef.current.length) return;
+ if (!elementsRef.current.length) {
+ return;
+ }
const observer = new IntersectionObserver((entries) => {
setEverVisibles((prev) => {
@@ -42,7 +44,9 @@ export function useMultiIntersectionObserver(
}, options);
elementsRef.current.forEach((el) => {
- if (el) observer.observe(el);
+ if (el) {
+ observer.observe(el);
+ }
});
return (): void => {
diff --git a/frontend/src/hooks/useResourceAttribute/utils.ts b/frontend/src/hooks/useResourceAttribute/utils.ts
index 535344686e..23ebc93c4d 100644
--- a/frontend/src/hooks/useResourceAttribute/utils.ts
+++ b/frontend/src/hooks/useResourceAttribute/utils.ts
@@ -147,7 +147,9 @@ export const OperatorSchema: IOption[] = OperatorConversions.map(
export const getResourceDeploymentKeys = (
dotMetricsEnabled: boolean,
): string => {
- if (dotMetricsEnabled) return 'resource_deployment.environment';
+ if (dotMetricsEnabled) {
+ return 'resource_deployment.environment';
+ }
return 'resource_deployment_environment';
};
diff --git a/frontend/src/hooks/useSafeNavigate.ts b/frontend/src/hooks/useSafeNavigate.ts
index bb18c6b55c..dcafb197dd 100644
--- a/frontend/src/hooks/useSafeNavigate.ts
+++ b/frontend/src/hooks/useSafeNavigate.ts
@@ -18,7 +18,9 @@ interface UseSafeNavigateProps {
}
const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
- if (url1.pathname !== url2.pathname) return false;
+ if (url1.pathname !== url2.pathname) {
+ return false;
+ }
const params1 = new URLSearchParams(url1.search);
const params2 = new URLSearchParams(url2.search);
@@ -34,7 +36,9 @@ const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
const query1 = params1.get('compositeQuery');
const query2 = params2.get('compositeQuery');
- if (!query1 || !query2) return false;
+ if (!query1 || !query2) {
+ return false;
+ }
const decoded1 = JSON.parse(decodeURIComponent(query1));
const decoded2 = JSON.parse(decodeURIComponent(query2));
@@ -66,13 +70,17 @@ const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
*/
const isDefaultNavigation = (currentUrl: URL, targetUrl: URL): boolean => {
// Different pathnames means it's not a default navigation
- if (currentUrl.pathname !== targetUrl.pathname) return false;
+ if (currentUrl.pathname !== targetUrl.pathname) {
+ return false;
+ }
const currentParams = new URLSearchParams(currentUrl.search);
const targetParams = new URLSearchParams(targetUrl.search);
// Case 1: Clean URL getting params for the first time
- if (!currentParams.toString() && targetParams.toString()) return true;
+ if (!currentParams.toString() && targetParams.toString()) {
+ return true;
+ }
// Case 2: Check for new params that didn't exist before
const currentKeys = new Set(Array.from(currentParams.keys()));
diff --git a/frontend/src/hooks/useTimezoneFormatter/useTimezoneFormatter.ts b/frontend/src/hooks/useTimezoneFormatter/useTimezoneFormatter.ts
index db021d336e..0fdfbdc6f7 100644
--- a/frontend/src/hooks/useTimezoneFormatter/useTimezoneFormatter.ts
+++ b/frontend/src/hooks/useTimezoneFormatter/useTimezoneFormatter.ts
@@ -41,7 +41,9 @@ function useTimezoneFormatter({
}, [cache, userTimezone]);
const clearCacheEntries = useCallback(() => {
- if (cache.size <= CACHE_SIZE_LIMIT) return;
+ if (cache.size <= CACHE_SIZE_LIMIT) {
+ return;
+ }
// Sort entries by timestamp (oldest first)
const sortedEntries = Array.from(cache.entries()).sort(
diff --git a/frontend/src/lib/dashbaordVariables/sortVariableValues.ts b/frontend/src/lib/dashbaordVariables/sortVariableValues.ts
index 0937f70412..be2961b4de 100644
--- a/frontend/src/lib/dashbaordVariables/sortVariableValues.ts
+++ b/frontend/src/lib/dashbaordVariables/sortVariableValues.ts
@@ -6,8 +6,12 @@ const sortValues = (
values: TValuesDataType,
sortType: TSortVariableValuesType,
): TValuesDataType => {
- if (sortType === 'ASC') return sortBy(values);
- if (sortType === 'DESC') return sortBy(values).reverse();
+ if (sortType === 'ASC') {
+ return sortBy(values);
+ }
+ if (sortType === 'DESC') {
+ return sortBy(values).reverse();
+ }
return values;
};
diff --git a/frontend/src/lib/dashboard/prepareQueryRangePayload.ts b/frontend/src/lib/dashboard/prepareQueryRangePayload.ts
index 46eedebe6f..897e90ba94 100644
--- a/frontend/src/lib/dashboard/prepareQueryRangePayload.ts
+++ b/frontend/src/lib/dashboard/prepareQueryRangePayload.ts
@@ -54,7 +54,9 @@ export const prepareQueryRangePayload = ({
}
case EQueryType.CLICKHOUSE: {
const chQueries = query[query.queryType].reduce((acc, query) => {
- if (!query.query) return acc;
+ if (!query.query) {
+ return acc;
+ }
acc[query.name] = query;
@@ -70,7 +72,9 @@ export const prepareQueryRangePayload = ({
case EQueryType.PROM: {
// eslint-disable-next-line sonarjs/no-identical-functions
const promQueries = query[query.queryType].reduce((acc, query) => {
- if (!query.query) return acc;
+ if (!query.query) {
+ return acc;
+ }
acc[query.name] = query;
diff --git a/frontend/src/lib/getChartData.ts b/frontend/src/lib/getChartData.ts
index cd0ebcebf8..9b4709a097 100644
--- a/frontend/src/lib/getChartData.ts
+++ b/frontend/src/lib/getChartData.ts
@@ -74,7 +74,9 @@ const getChartData = ({
const diff = avearageOfArray(a.second) - avearageOfArray(b.second); // calculating the difference
- if (diff !== 0) return diff;
+ if (diff !== 0) {
+ return diff;
+ }
}
return a.second.length - b.second.length;
diff --git a/frontend/src/lib/getLabelName.ts b/frontend/src/lib/getLabelName.ts
index 0507a7aed5..58e5ed6857 100644
--- a/frontend/src/lib/getLabelName.ts
+++ b/frontend/src/lib/getLabelName.ts
@@ -44,8 +44,12 @@ const getLabelName = (
const result = `${value === undefined ? '' : value}`;
if (post.length === 0 && pre.length === 0) {
- if (result) return result;
- if (query) return query;
+ if (result) {
+ return result;
+ }
+ if (query) {
+ return query;
+ }
return result;
}
return `${result}{${pre}${post}}`;
diff --git a/frontend/src/lib/logql/tokens.ts b/frontend/src/lib/logql/tokens.ts
index e4eb64fe3c..43aa42fb3f 100644
--- a/frontend/src/lib/logql/tokens.ts
+++ b/frontend/src/lib/logql/tokens.ts
@@ -43,9 +43,13 @@ export const ValidTypeValue = (
op: string,
value: string | string[],
): boolean => {
- if (!op) return true;
+ if (!op) {
+ return true;
+ }
if (Object.values(NumTypeQueryOperators).includes(op)) {
- if (Array.isArray(value)) return false;
+ if (Array.isArray(value)) {
+ return false;
+ }
return !Number.isNaN(Number(value));
}
return true;
@@ -62,20 +66,30 @@ export const ValidTypeSequence = (
switch (current) {
case QueryTypes.QUERY_KEY:
// query key can have an empty prior
- if (!prior) return true;
+ if (!prior) {
+ return true;
+ }
return [QueryTypes.CONDITIONAL_OPERATOR].includes(prior);
case QueryTypes.QUERY_OPERATOR:
// empty prior is not allowed
- if (!prior || ![QueryTypes.QUERY_KEY].includes(prior)) return false;
- if (!next || ![QueryTypes.QUERY_VALUE].includes(next)) return false;
+ if (!prior || ![QueryTypes.QUERY_KEY].includes(prior)) {
+ return false;
+ }
+ if (!next || ![QueryTypes.QUERY_VALUE].includes(next)) {
+ return false;
+ }
return true;
case QueryTypes.QUERY_VALUE:
// empty prior is not allowed
- if (!prior) return false;
+ if (!prior) {
+ return false;
+ }
return [QueryTypes.QUERY_OPERATOR].includes(prior);
case QueryTypes.CONDITIONAL_OPERATOR:
// empty prior is not allowed
- if (!next) return false;
+ if (!next) {
+ return false;
+ }
return [QueryTypes.QUERY_KEY].includes(next);
default:
return false;
diff --git a/frontend/src/lib/newQueryBuilder/queryBuilderMappers/mapCompositeQueryFromQuery.ts b/frontend/src/lib/newQueryBuilder/queryBuilderMappers/mapCompositeQueryFromQuery.ts
index 7a0ebb3aba..699bdb51bc 100644
--- a/frontend/src/lib/newQueryBuilder/queryBuilderMappers/mapCompositeQueryFromQuery.ts
+++ b/frontend/src/lib/newQueryBuilder/queryBuilderMappers/mapCompositeQueryFromQuery.ts
@@ -52,7 +52,9 @@ const buildClickHouseQuery = (
): ICompositeMetricQuery => {
const chQueries: BuilderClickHouseResource = {};
query.clickhouse_sql.forEach((query: IClickHouseQuery) => {
- if (!query.query) return;
+ if (!query.query) {
+ return;
+ }
chQueries[query.name] = query;
});
@@ -70,7 +72,9 @@ const buildPromQuery = (
): ICompositeMetricQuery => {
const promQueries: BuilderPromQLResource = {};
query.promql.forEach((query) => {
- if (!query.query) return;
+ if (!query.query) {
+ return;
+ }
promQueries[query.name] = {
legend: query.legend,
name: query.name,
diff --git a/frontend/src/lib/query/GetFormulaName.ts b/frontend/src/lib/query/GetFormulaName.ts
index 9eea375b82..89a7688c32 100644
--- a/frontend/src/lib/query/GetFormulaName.ts
+++ b/frontend/src/lib/query/GetFormulaName.ts
@@ -6,7 +6,9 @@ function GetFormulaName(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
formulas: { name: string; [key: string]: any }[] = [],
): string | null {
- if (!formulas.length) return 'F1';
+ if (!formulas.length) {
+ return 'F1';
+ }
if (formulas.length === MAX_QUERIES) {
return null;
}
diff --git a/frontend/src/lib/query/GetQueryName.ts b/frontend/src/lib/query/GetQueryName.ts
index ee5a52e5e3..c897419fb0 100644
--- a/frontend/src/lib/query/GetQueryName.ts
+++ b/frontend/src/lib/query/GetQueryName.ts
@@ -2,7 +2,9 @@ import { sortBy } from 'lodash-es';
const MAX_QUERIES = 26;
function GetQueryName(queries: { name: string }[] = []): string | null {
- if (!queries.length) return 'A';
+ if (!queries.length) {
+ return 'A';
+ }
if (queries.length === MAX_QUERIES) {
return null;
}
diff --git a/frontend/src/lib/query/createTableColumnsFromQuery.ts b/frontend/src/lib/query/createTableColumnsFromQuery.ts
index 804c17bf61..c7d3ef7a16 100644
--- a/frontend/src/lib/query/createTableColumnsFromQuery.ts
+++ b/frontend/src/lib/query/createTableColumnsFromQuery.ts
@@ -125,7 +125,9 @@ const addLabels = (
dynamicColumns: DynamicColumns,
columnId?: string,
): void => {
- if (isValueExist('dataIndex', label, dynamicColumns)) return;
+ if (isValueExist('dataIndex', label, dynamicColumns)) {
+ return;
+ }
const fieldObj: DynamicColumn = {
query,
@@ -290,7 +292,9 @@ const processSeriesColumns = (
series.forEach((seria) => {
seria.labelsArray?.forEach((lab) => {
Object.keys(lab).forEach((label) => {
- if (label === currentQuery?.queryName) return;
+ if (label === currentQuery?.queryName) {
+ return;
+ }
addLabels(currentStagedQuery, label, dynamicColumns);
});
@@ -362,7 +366,9 @@ const findSeriaValueFromAnotherQuery = (
currentLabels: Record<string, string>,
nextQuery: QueryDataV3 | null,
): SeriesItem | null => {
- if (!nextQuery || !nextQuery.series) return null;
+ if (!nextQuery || !nextQuery.series) {
+ return null;
+ }
let value = null;
@@ -370,7 +376,9 @@ const findSeriaValueFromAnotherQuery = (
nextQuery.series.forEach((seria) => {
const localLabelEntries = Object.entries(seria.labels);
- if (localLabelEntries.length !== labelEntries.length) return;
+ if (localLabelEntries.length !== labelEntries.length) {
+ return;
+ }
const isExistLabels = isEqual(localLabelEntries, labelEntries);
@@ -446,7 +454,9 @@ const fillDataFromSeries = (
const { series, queryName } = currentQuery;
const isEqualQuery = isEqualQueriesByLabel(equalQueriesByLabels, queryName);
- if (!series) return;
+ if (!series) {
+ return;
+ }
series.forEach((seria) => {
const unusedColumnsKeys = new Set<keyof RowData>(
@@ -455,7 +465,9 @@ const fillDataFromSeries = (
columns.forEach((column) => {
if (queryName === column.field) {
- if (seria.values.length === 0) return;
+ if (seria.values.length === 0) {
+ return;
+ }
fillAggregationData(
column,
@@ -478,7 +490,9 @@ const fillDataFromSeries = (
return;
}
- if (isEqualQuery) return;
+ if (isEqualQuery) {
+ return;
+ }
fillLabelsData(column, seria, unusedColumnsKeys);
@@ -493,7 +507,9 @@ const fillDataFromList = (
): void => {
const listData = listItem.data || {};
columns.forEach((column) => {
- if (isFormula(column.field)) return;
+ if (isFormula(column.field)) {
+ return;
+ }
Object.keys(listData).forEach((label) => {
if (column.dataIndex === label) {
@@ -532,7 +548,9 @@ const fillDataFromTable = (
): void => {
const { table } = currentQuery;
- if (!table || !table.rows) return;
+ if (!table || !table.rows) {
+ return;
+ }
table.rows.forEach((row) => {
const unusedColumnsKeys = new Set<keyof RowData>(
diff --git a/frontend/src/lib/toCapitalize.ts b/frontend/src/lib/toCapitalize.ts
index 7692dbf246..d924e60f0a 100644
--- a/frontend/src/lib/toCapitalize.ts
+++ b/frontend/src/lib/toCapitalize.ts
@@ -1,5 +1,7 @@
export const toCapitalize = (str: string): string => {
- if (!str) return '';
+ if (!str) {
+ return '';
+ }
return str[0].toUpperCase() + str.slice(1);
};
diff --git a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
index 8317547460..19ba262309 100644
--- a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
+++ b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
@@ -610,7 +610,9 @@ export const getUPlotChartOptions = ({
// Small delay to ensure cleanup is complete and DOM is ready
setTimeout(() => {
- if (!isHovering) return; // Don't show if mouse already left
+ if (!isHovering) {
+ return;
+ } // Don't show if mouse already left
// Double-check no tooltip exists
if (document.querySelector('.legend-tooltip')) {
diff --git a/frontend/src/lib/uPlotLib/plugins/timelinePlugin.ts b/frontend/src/lib/uPlotLib/plugins/timelinePlugin.ts
index b740fb2b2c..4979b8a19e 100644
--- a/frontend/src/lib/uPlotLib/plugins/timelinePlugin.ts
+++ b/frontend/src/lib/uPlotLib/plugins/timelinePlugin.ts
@@ -175,7 +175,9 @@ export function distr(
gap = space / (numItems + 1);
}
- if (Number.isNaN(gap) || gap === Infinity) gap = 0;
+ if (Number.isNaN(gap) || gap === Infinity) {
+ gap = 0;
+ }
let offs = 0;
if (justify === SPACE_AROUND) {
@@ -188,9 +190,12 @@ export function distr(
const iwidRounded = roundDec(iwid, 6);
if (onlyIdx == null) {
- for (let i = 0; i < numItems; i++)
+ for (let i = 0; i < numItems; i++) {
each(i, coord(i, offs, iwid, gap), iwidRounded);
- } else each(onlyIdx, coord(onlyIdx, offs, iwid, gap), iwidRounded);
+ }
+ } else {
+ each(onlyIdx, coord(onlyIdx, offs, iwid, gap), iwidRounded);
+ }
}
function timelinePlugin(opts: any): any {
@@ -266,7 +271,9 @@ function timelinePlugin(opts: any): any {
const fillStyle = fill(iy + 1, ix, value);
let fillPath = fillPaths.get(fillStyle);
- if (fillPath == null) fillPaths.set(fillStyle, (fillPath = new Path2D()));
+ if (fillPath == null) {
+ fillPaths.set(fillStyle, (fillPath = new Path2D()));
+ }
rect(fillPath, lft, top, wid, hgt);
@@ -274,8 +281,9 @@ function timelinePlugin(opts: any): any {
const strokeStyle = stroke(iy + 1, ix, value);
let strokePath = strokePaths.get(strokeStyle);
- if (strokePath == null)
+ if (strokePath == null) {
strokePaths.set(strokeStyle, (strokePath = new Path2D()));
+ }
rect(
strokePath,
@@ -503,7 +511,9 @@ function timelinePlugin(opts: any): any {
seriesIdx: number,
closestIdx: any,
) => {
- if (seriesIdx === 0) return closestIdx;
+ if (seriesIdx === 0) {
+ return closestIdx;
+ }
const cx = round(u.cursor.left * pxRatio);
@@ -513,8 +523,9 @@ function timelinePlugin(opts: any): any {
hovered[seriesIdx - 1] = null;
qt.get(cx, cy, 1, 1, (o: { x: any; y: any; w: any; h: any }) => {
- if (pointWithin(cx, cy, o.x, o.y, o.x + o.w, o.y + o.h))
+ if (pointWithin(cx, cy, o.x, o.y, o.x + o.w, o.y + o.h)) {
hovered[seriesIdx - 1] = o;
+ }
});
}
@@ -542,12 +553,16 @@ function timelinePlugin(opts: any): any {
const scalePad = colWid / 2;
// eslint-disable-next-line no-param-reassign
- if (min <= u.data[0][0]) min = u.data[0][0] - scalePad;
+ if (min <= u.data[0][0]) {
+ min = u.data[0][0] - scalePad;
+ }
const lastIdx = u.data[0].length - 1;
// eslint-disable-next-line no-param-reassign
- if (max >= u.data[0][lastIdx]) max = u.data[0][lastIdx] + scalePad;
+ if (max >= u.data[0][lastIdx]) {
+ max = u.data[0][lastIdx] + scalePad;
+ }
}
return [min, max];
@@ -576,7 +591,9 @@ function timelinePlugin(opts: any): any {
for (let i = 0; i < u.data[0].length; i += skipFactor) {
const v = u.data[0][i];
- if (v >= scaleMin && v <= scaleMax) splits.push(v);
+ if (v >= scaleMin && v <= scaleMax) {
+ splits.push(v);
+ }
}
return splits;
diff --git a/frontend/src/lib/uPlotLib/utils/getAxes.ts b/frontend/src/lib/uPlotLib/utils/getAxes.ts
index 3b69b5547b..1f88646c58 100644
--- a/frontend/src/lib/uPlotLib/utils/getAxes.ts
+++ b/frontend/src/lib/uPlotLib/utils/getAxes.ts
@@ -72,7 +72,9 @@ const getAxes = ({
const axis = self.axes[axisIdx];
// bail out, force convergence
- if (cycleNum > 1) return axis._size;
+ if (cycleNum > 1) {
+ return axis._size;
+ }
let axisSize = axis.ticks.size + axis.gap;
diff --git a/frontend/src/lib/uPlotLib/utils/getYAxisScale.ts b/frontend/src/lib/uPlotLib/utils/getYAxisScale.ts
index 40b9ba5217..2b51e4f9b2 100644
--- a/frontend/src/lib/uPlotLib/utils/getYAxisScale.ts
+++ b/frontend/src/lib/uPlotLib/utils/getYAxisScale.ts
@@ -33,9 +33,13 @@ function findMinMaxThresholdValues(
thresholds.forEach((entry) => {
const { thresholdValue, thresholdUnit } = entry;
- if (thresholdValue === undefined) return;
+ if (thresholdValue === undefined) {
+ return;
+ }
const compareValue = convertValue(thresholdValue, thresholdUnit, yAxisUnit);
- if (compareValue === null) return;
+ if (compareValue === null) {
+ return;
+ }
minThresholdValue = Math.min(minThresholdValue, compareValue);
maxThresholdValue = Math.max(maxThresholdValue, compareValue);
});
@@ -67,7 +71,9 @@ function getRange(
function areAllSeriesEmpty(series: QueryDataV3[]): boolean {
return series.every((entry) => {
- if (!entry.series) return true;
+ if (!entry.series) {
+ return true;
+ }
return entry.series.every((series) => series.values.length === 0);
});
}
diff --git a/frontend/src/pages/AlertDetails/hooks.tsx b/frontend/src/pages/AlertDetails/hooks.tsx
index bbe9b31699..66c89ee65e 100644
--- a/frontend/src/pages/AlertDetails/hooks.tsx
+++ b/frontend/src/pages/AlertDetails/hooks.tsx
@@ -69,8 +69,9 @@ export const useAlertHistoryQueryParams = (): {
const hasStartAndEndParams = !!intStartTime && !!intEndTime;
const { maxTime, minTime } = useMemo(() => {
- if (hasStartAndEndParams)
+ if (hasStartAndEndParams) {
return GetMinMax('custom', [intStartTime, intEndTime]);
+ }
return GetMinMax(relativeTime);
}, [hasStartAndEndParams, intStartTime, intEndTime, relativeTime]);
diff --git a/frontend/src/pages/Celery/CeleryOverview/CeleryOverviewDetail/ValueInfo.tsx b/frontend/src/pages/Celery/CeleryOverview/CeleryOverviewDetail/ValueInfo.tsx
index 0d2183afea..d196fb23df 100644
--- a/frontend/src/pages/Celery/CeleryOverview/CeleryOverviewDetail/ValueInfo.tsx
+++ b/frontend/src/pages/Celery/CeleryOverview/CeleryOverviewDetail/ValueInfo.tsx
@@ -86,32 +86,52 @@ export default function ValueInfo({
const navigateToExplorer = useNavigateToExplorer();
const avgLatencyInMs = useMemo(() => {
- if (avgLatency === 'NaN') return 'NaN';
+ if (avgLatency === 'NaN') {
+ return 'NaN';
+ }
const numericValue = parseFloat(avgLatency);
return (numericValue / 1000000).toFixed(2);
}, [avgLatency]);
const getColorBasedOnValue = (value: string): string => {
const numericValue = parseFloat(value);
- if (value === 'NaN') return 'gray';
- if (numericValue < 3) return 'green';
- if (numericValue < 8) return 'yellow';
+ if (value === 'NaN') {
+ return 'gray';
+ }
+ if (numericValue < 3) {
+ return 'green';
+ }
+ if (numericValue < 8) {
+ return 'yellow';
+ }
return 'red';
};
const getColorForLatency = (value: string): string => {
const numericValue = parseFloat(value);
- if (value === 'NaN') return 'gray';
- if (numericValue < 100) return 'green';
- if (numericValue < 200) return 'yellow';
+ if (value === 'NaN') {
+ return 'gray';
+ }
+ if (numericValue < 100) {
+ return 'green';
+ }
+ if (numericValue < 200) {
+ return 'yellow';
+ }
return 'red';
};
const getColorForErrorRate = (value: string): string => {
const numericValue = parseFloat(value);
- if (value === 'NaN') return 'gray';
- if (numericValue < 60) return 'green';
- if (numericValue < 90) return 'yellow';
+ if (value === 'NaN') {
+ return 'gray';
+ }
+ if (numericValue < 60) {
+ return 'green';
+ }
+ if (numericValue < 90) {
+ return 'yellow';
+ }
return 'red';
};
diff --git a/frontend/src/pages/Logs/hooks.ts b/frontend/src/pages/Logs/hooks.ts
index 7093147ce3..07be261adb 100644
--- a/frontend/src/pages/Logs/hooks.ts
+++ b/frontend/src/pages/Logs/hooks.ts
@@ -40,7 +40,9 @@ export const useSelectedLogView = (): SelectedLogViewData => {
const handleViewModeOptionChange = useCallback(
({ key }: { key: string }) => {
- if (isLogViewMode(key)) handleViewModeChange(key);
+ if (isLogViewMode(key)) {
+ handleViewModeChange(key);
+ }
},
[handleViewModeChange],
);
diff --git a/frontend/src/pages/LogsExplorer/index.tsx b/frontend/src/pages/LogsExplorer/index.tsx
index 77df42fb46..aa786e4648 100644
--- a/frontend/src/pages/LogsExplorer/index.tsx
+++ b/frontend/src/pages/LogsExplorer/index.tsx
@@ -112,7 +112,9 @@ function LogsExplorer(): JSX.Element {
const logListOptionsFromLocalStorage = useMemo(() => {
const data = getLocalStorageKey(LOCALSTORAGE.LOGS_LIST_OPTIONS);
- if (!data) return null;
+ if (!data) {
+ return null;
+ }
try {
return JSON.parse(data);
@@ -124,7 +126,9 @@ function LogsExplorer(): JSX.Element {
// Check if the columns have the required columns (timestamp, body)
const hasRequiredColumns = useCallback(
(columns?: TelemetryFieldKey[] | null): boolean => {
- if (!columns?.length) return false;
+ if (!columns?.length) {
+ return false;
+ }
const hasTimestamp = columns.some((col) => col.name === 'timestamp');
const hasBody = columns.some((col) => col.name === 'body');
@@ -148,7 +152,9 @@ function LogsExplorer(): JSX.Element {
const migrateOptionsQuery = useCallback(
(query: OptionsQuery): OptionsQuery => {
// Skip if already migrated
- if (query.version) return query;
+ if (query.version) {
+ return query;
+ }
if (logListOptionsFromLocalStorage?.version) {
return logListOptionsFromLocalStorage;
diff --git a/frontend/src/pages/LogsSettings/components/TabLabel.tsx b/frontend/src/pages/LogsSettings/components/TabLabel.tsx
index cb97869ad6..4679122eaa 100644
--- a/frontend/src/pages/LogsSettings/components/TabLabel.tsx
+++ b/frontend/src/pages/LogsSettings/components/TabLabel.tsx
@@ -6,7 +6,9 @@ import { TableLabel } from '../types';
function TabLabel({ routeKey, label }: TableLabel): JSX.Element {
const { pathname } = useLocation();
- if (pathname === routeKey) return <Typography.Link>{label}</Typography.Link>;
+ if (pathname === routeKey) {
+ return <Typography.Link>{label}</Typography.Link>;
+ }
return <Typography>{label}</Typography>;
}
diff --git a/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx b/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx
index 5fc65e16e9..23965c135a 100644
--- a/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx
+++ b/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx
@@ -132,8 +132,9 @@ export function getColumns(
}
if (column === 'breach_percentage' && text) {
- if (!isNumber(text))
+ if (!isNumber(text)) {
return <Typography.Text>{text.toString()}</Typography.Text>;
+ }
return (
<Typography.Text>
{(typeof text === 'string' ? parseFloat(text) : text).toFixed(2)} %
diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx
index 33dd4269b5..0612402ee4 100644
--- a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx
+++ b/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx
@@ -35,6 +35,7 @@ import { useHistory, useLocation } from 'react-router-dom';
import { ErrorResponse, SuccessResponse } from 'types/api';
import { getTableDataForProducerLatencyOverview } from './MQTableUtils';
+import { formatNumericValue } from 'utils/numericUtils';
const INITIAL_PAGE_SIZE = 10;
@@ -72,10 +73,7 @@ export function getColumns(
'ingestion_rate',
'byte_rate',
].includes(column.name)
- ? (value: number | string): string => {
- if (!isNumber(value)) return value.toString();
- return (typeof value === 'string' ? parseFloat(value) : value).toFixed(3);
- }
+ ? formatNumericValue
: (text: string): ColumnTypeRender<Record<string, unknown>> => ({
children:
column.name === 'service_name' ? (
diff --git a/frontend/src/pages/MetricsApplication/utils.ts b/frontend/src/pages/MetricsApplication/utils.ts
index 5d785e629a..7eb044cc00 100644
--- a/frontend/src/pages/MetricsApplication/utils.ts
+++ b/frontend/src/pages/MetricsApplication/utils.ts
@@ -27,7 +27,9 @@ export const onSaveApDexSettings = ({
handlePopOverClose,
servicename,
}: OnSaveApDexSettingsProps) => async (): Promise<void> => {
- if (!refetchGetApDexSetting) return;
+ if (!refetchGetApDexSetting) {
+ return;
+ }
try {
await mutateAsync({
diff --git a/frontend/src/pages/SaveView/index.tsx b/frontend/src/pages/SaveView/index.tsx
index f9c2f6fb1a..99be9788c7 100644
--- a/frontend/src/pages/SaveView/index.tsx
+++ b/frontend/src/pages/SaveView/index.tsx
@@ -210,7 +210,9 @@ function SaveView(): JSX.Element {
view.id,
viewsData?.data.data,
);
- if (!currentViewDetails) return;
+ if (!currentViewDetails) {
+ return;
+ }
const { query, name, id, panelType: currentPanelType } = currentViewDetails;
if (sourcepage) {
diff --git a/frontend/src/pages/TracesExplorer/index.tsx b/frontend/src/pages/TracesExplorer/index.tsx
index ea73561bdd..09059327b3 100644
--- a/frontend/src/pages/TracesExplorer/index.tsx
+++ b/frontend/src/pages/TracesExplorer/index.tsx
@@ -122,7 +122,9 @@ function TracesExplorer(): JSX.Element {
const handleExport = useCallback(
(dashboard: Dashboard | null, isNewDashboard?: boolean): void => {
- if (!dashboard || !panelType) return;
+ if (!dashboard || !panelType) {
+ return;
+ }
const panelTypeParam = AVAILABLE_EXPORT_PANEL_TYPES.includes(panelType)
? panelType
diff --git a/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx b/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx
index aef3129fce..a909b1b5af 100644
--- a/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx
+++ b/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx
@@ -24,7 +24,9 @@ function StepsContent({
const { hasEditPermission } = useAppContext();
const handleAddForNewStep = useCallback(() => {
- if (!span || !hasEditPermission) return;
+ if (!span || !hasEditPermission) {
+ return;
+ }
const stepWasAdded = handleAddStep();
if (stepWasAdded) {
diff --git a/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelMetricsTable.tsx b/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelMetricsTable.tsx
index 427835fa6e..a4e22695d8 100644
--- a/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelMetricsTable.tsx
+++ b/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelMetricsTable.tsx
@@ -31,12 +31,13 @@ function FunnelMetricsContentRenderer({
isError?: boolean;
emptyState?: JSX.Element;
}): JSX.Element {
- if (isLoading)
+ if (isLoading) {
return (
<div className="funnel-metrics--loading-state">
<Spinner size="small" height="100%" />
</div>
);
+ }
if (data.length === 0 && emptyState) {
return emptyState;
}
diff --git a/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelResults.tsx b/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelResults.tsx
index 2050424013..9ecb79bd19 100644
--- a/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelResults.tsx
+++ b/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelResults.tsx
@@ -24,15 +24,18 @@ function FunnelResults(): JSX.Element {
funnelId,
]);
- if (hasAllEmptyStepFields) return <EmptyFunnelResults />;
+ if (hasAllEmptyStepFields) {
+ return <EmptyFunnelResults />;
+ }
- if (hasIncompleteStepFields)
+ if (hasIncompleteStepFields) {
return (
<EmptyFunnelResults
title="Missing service / span names"
description="Fill in the service and span names for all the steps"
/>
);
+ }
if (isValidateStepsLoading || isFunnelUpdateMutating) {
return <Spinner size="large" />;
diff --git a/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelTopTracesTable.tsx b/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelTopTracesTable.tsx
index b6fab8a99b..be7b23648d 100644
--- a/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelTopTracesTable.tsx
+++ b/frontend/src/pages/TracesFunnelDetails/components/FunnelResults/FunnelTopTracesTable.tsx
@@ -55,7 +55,9 @@ function FunnelTopTracesTable({
);
const data = useMemo(() => {
- if (!response?.payload?.data) return [];
+ if (!response?.payload?.data) {
+ return [];
+ }
return response.payload.data.map((item) => ({
trace_id: item.data.trace_id,
duration_ms: item.data.duration_ms,
diff --git a/frontend/src/pages/TracesFunnels/FunnelContext.tsx b/frontend/src/pages/TracesFunnels/FunnelContext.tsx
index 941e8e13b9..0cc878b45e 100644
--- a/frontend/src/pages/TracesFunnels/FunnelContext.tsx
+++ b/frontend/src/pages/TracesFunnels/FunnelContext.tsx
@@ -211,7 +211,9 @@ export function FunnelProvider({
}
const handleRunFunnel = useCallback(async (): Promise<void> => {
- if (validTracesCount === 0) return;
+ if (validTracesCount === 0) {
+ return;
+ }
queryClient.refetchQueries([
REACT_QUERY_KEY.GET_FUNNEL_OVERVIEW,
diff --git a/frontend/src/pages/TracesFunnels/utils.ts b/frontend/src/pages/TracesFunnels/utils.ts
index 42b60be735..10d2e6e432 100644
--- a/frontend/src/pages/TracesFunnels/utils.ts
+++ b/frontend/src/pages/TracesFunnels/utils.ts
@@ -5,7 +5,9 @@ export function filterFunnelsByQuery(
query: string,
): FunnelData[] {
const q = query.trim().toLowerCase();
- if (!q) return funnels;
+ if (!q) {
+ return funnels;
+ }
return funnels.filter((funnel) =>
(funnel.funnel_name || '').toLowerCase().includes(q),
diff --git a/frontend/src/providers/Dashboard/initializeDefaultVariables.ts b/frontend/src/providers/Dashboard/initializeDefaultVariables.ts
index 299e1078ad..47829ac8f2 100644
--- a/frontend/src/providers/Dashboard/initializeDefaultVariables.ts
+++ b/frontend/src/providers/Dashboard/initializeDefaultVariables.ts
@@ -23,7 +23,9 @@ export const initializeDefaultVariables = (
selectedValue: IDashboardVariable['selectedValue'],
) => void,
): void => {
- if (!variables) return;
+ if (!variables) {
+ return;
+ }
Object.values(variables).forEach((variable) => {
const { id, name, allSelected, showALLOption } = variable;
diff --git a/frontend/src/providers/EventSource.tsx b/frontend/src/providers/EventSource.tsx
index 85ddcd7e01..36c88ea820 100644
--- a/frontend/src/providers/EventSource.tsx
+++ b/frontend/src/providers/EventSource.tsx
@@ -99,14 +99,18 @@ export function EventSourceProvider({
description: (error as APIError).getErrorMessage(),
});
setIsConnectionError(true);
- if (!eventSourceRef.current) return;
+ if (!eventSourceRef.current) {
+ return;
+ }
eventSourceRef.current.close();
Logout();
}
}, [notifications, queryClient]);
const destroyEventSourceSession = useCallback(() => {
- if (!eventSourceRef.current) return;
+ if (!eventSourceRef.current) {
+ return;
+ }
eventSourceRef.current.close();
eventSourceRef.current.removeEventListener('error', handleErrorConnection);
diff --git a/frontend/src/providers/QueryBuilder.tsx b/frontend/src/providers/QueryBuilder.tsx
index eecff00e1d..844eeae88e 100644
--- a/frontend/src/providers/QueryBuilder.tsx
+++ b/frontend/src/providers/QueryBuilder.tsx
@@ -538,7 +538,9 @@ export function QueryBuilderProvider({
const addNewQueryItem = useCallback(
(type: EQueryType.CLICKHOUSE | EQueryType.PROM) => {
setCurrentQuery((prevState) => {
- if (prevState[type].length >= MAX_QUERIES) return prevState;
+ if (prevState[type].length >= MAX_QUERIES) {
+ return prevState;
+ }
const newQuery = createNewQueryTypeItem(prevState[type], type);
@@ -549,7 +551,9 @@ export function QueryBuilderProvider({
});
// eslint-disable-next-line sonarjs/no-identical-functions
setSupersetQuery((prevState) => {
- if (prevState[type].length >= MAX_QUERIES) return prevState;
+ if (prevState[type].length >= MAX_QUERIES) {
+ return prevState;
+ }
const newQuery = createNewQueryTypeItem(prevState[type], type);
@@ -564,7 +568,9 @@ export function QueryBuilderProvider({
const addNewBuilderQuery = useCallback(() => {
setCurrentQuery((prevState) => {
- if (prevState.builder.queryData.length >= MAX_QUERIES) return prevState;
+ if (prevState.builder.queryData.length >= MAX_QUERIES) {
+ return prevState;
+ }
const newQuery = createNewBuilderQuery(prevState.builder.queryData);
@@ -579,7 +585,9 @@ export function QueryBuilderProvider({
// eslint-disable-next-line sonarjs/no-identical-functions
setSupersetQuery((prevState) => {
- if (prevState.builder.queryData.length >= MAX_QUERIES) return prevState;
+ if (prevState.builder.queryData.length >= MAX_QUERIES) {
+ return prevState;
+ }
const newQuery = createNewBuilderQuery(prevState.builder.queryData);
@@ -596,7 +604,9 @@ export function QueryBuilderProvider({
const cloneQuery = useCallback(
(type: string, query: IBuilderQuery): void => {
setCurrentQuery((prevState) => {
- if (prevState.builder.queryData.length >= MAX_QUERIES) return prevState;
+ if (prevState.builder.queryData.length >= MAX_QUERIES) {
+ return prevState;
+ }
const clonedQuery = cloneNewBuilderQuery(
prevState.builder.queryData,
@@ -613,7 +623,9 @@ export function QueryBuilderProvider({
});
// eslint-disable-next-line sonarjs/no-identical-functions
setSupersetQuery((prevState) => {
- if (prevState.builder.queryData.length >= MAX_QUERIES) return prevState;
+ if (prevState.builder.queryData.length >= MAX_QUERIES) {
+ return prevState;
+ }
const clonedQuery = cloneNewBuilderQuery(
prevState.builder.queryData,
@@ -634,7 +646,9 @@ export function QueryBuilderProvider({
const addNewFormula = useCallback(() => {
setCurrentQuery((prevState) => {
- if (prevState.builder.queryFormulas.length >= MAX_FORMULAS) return prevState;
+ if (prevState.builder.queryFormulas.length >= MAX_FORMULAS) {
+ return prevState;
+ }
const newFormula = createNewBuilderFormula(prevState.builder.queryFormulas);
@@ -648,7 +662,9 @@ export function QueryBuilderProvider({
});
// eslint-disable-next-line sonarjs/no-identical-functions
setSupersetQuery((prevState) => {
- if (prevState.builder.queryFormulas.length >= MAX_FORMULAS) return prevState;
+ if (prevState.builder.queryFormulas.length >= MAX_FORMULAS) {
+ return prevState;
+ }
const newFormula = createNewBuilderFormula(prevState.builder.queryFormulas);
@@ -1067,7 +1083,9 @@ export function QueryBuilderProvider({
// Separate useEffect to handle initQueryBuilderData after pathname changes
useEffect(() => {
- if (!compositeQueryParam) return;
+ if (!compositeQueryParam) {
+ return;
+ }
// Only run initQueryBuilderData if we're not in the middle of a pathname change
if (location.pathname === currentPathnameRef.current) {
diff --git a/frontend/src/providers/Timezone.tsx b/frontend/src/providers/Timezone.tsx
index 8dfe9191d5..7d1ad1afff 100644
--- a/frontend/src/providers/Timezone.tsx
+++ b/frontend/src/providers/Timezone.tsx
@@ -68,7 +68,9 @@ function TimezoneProvider({
const [isAdaptationEnabled, setIsAdaptationEnabled] = useState(true);
const updateTimezone = useCallback((timezone: Timezone): void => {
- if (!timezone.value) return;
+ if (!timezone.value) {
+ return;
+ }
// TODO(shaheer): replace this with user preferences API
setStoredTimezoneValue(timezone.value);
diff --git a/frontend/src/providers/cmdKProvider.tsx b/frontend/src/providers/cmdKProvider.tsx
index a4f656665f..477a8eb667 100644
--- a/frontend/src/providers/cmdKProvider.tsx
+++ b/frontend/src/providers/cmdKProvider.tsx
@@ -45,6 +45,8 @@ export function CmdKProvider({
export function useCmdK(): CmdKContextType {
const ctx = useContext(CmdKContext);
- if (!ctx) throw new Error('useCmdK must be used inside CmdKProvider');
+ if (!ctx) {
+ throw new Error('useCmdK must be used inside CmdKProvider');
+ }
return ctx;
}
diff --git a/frontend/src/providers/preferences/configs/logsUpdaterConfig.ts b/frontend/src/providers/preferences/configs/logsUpdaterConfig.ts
index 44e762a422..04ab95fae1 100644
--- a/frontend/src/providers/preferences/configs/logsUpdaterConfig.ts
+++ b/frontend/src/providers/preferences/configs/logsUpdaterConfig.ts
@@ -57,7 +57,9 @@ const getLogsUpdaterConfig = (
updateFormatting: (newFormatting: FormattingOptions, mode: string): void => {
if (mode === PreferenceMode.SAVED_VIEW) {
setSavedViewPreferences((prev) => {
- if (!prev) return { columns: [], formatting: newFormatting };
+ if (!prev) {
+ return { columns: [], formatting: newFormatting };
+ }
return {
...prev,
formatting: newFormatting,
diff --git a/frontend/src/providers/preferences/context/PreferenceContextProvider.tsx b/frontend/src/providers/preferences/context/PreferenceContextProvider.tsx
index 6a0d743ef3..1f5bfee7eb 100644
--- a/frontend/src/providers/preferences/context/PreferenceContextProvider.tsx
+++ b/frontend/src/providers/preferences/context/PreferenceContextProvider.tsx
@@ -58,9 +58,10 @@ export function PreferenceContextProvider({
export function usePreferenceContext(): PreferenceContextValue {
const ctx = useContext(PreferenceContext);
- if (!ctx)
+ if (!ctx) {
throw new Error(
'usePreferenceContext must be used within PreferenceContextProvider',
);
+ }
return ctx;
}
diff --git a/frontend/src/providers/preferences/sync/usePreferenceSync.ts b/frontend/src/providers/preferences/sync/usePreferenceSync.ts
index 2cc64e5830..2859615935 100644
--- a/frontend/src/providers/preferences/sync/usePreferenceSync.ts
+++ b/frontend/src/providers/preferences/sync/usePreferenceSync.ts
@@ -38,7 +38,9 @@ export function usePreferenceSync({
const updateExtraDataSelectColumns = (
columns: TelemetryFieldKey[],
): TelemetryFieldKey[] | null => {
- if (!columns) return null;
+ if (!columns) {
+ return null;
+ }
return columns.map((column) => ({
...column,
name: column.name ?? column.key,
diff --git a/frontend/src/store/actions/logs/addToSelectedField.ts b/frontend/src/store/actions/logs/addToSelectedField.ts
index 5e8c6fc6a1..8b6ff5876a 100644
--- a/frontend/src/store/actions/logs/addToSelectedField.ts
+++ b/frontend/src/store/actions/logs/addToSelectedField.ts
@@ -7,9 +7,10 @@ export const AddToSelectedField = (): ((
dispatch: Dispatch<AppActions>,
) => void) => async (dispatch): Promise<void> => {
const response = await GetSearchFields();
- if (response.payload)
+ if (response.payload) {
dispatch({
type: SET_FIELDS,
payload: response.payload,
});
+ }
};
diff --git a/frontend/src/store/actions/logs/getLogs.ts b/frontend/src/store/actions/logs/getLogs.ts
index 3b34fafa0e..66e4d81b04 100644
--- a/frontend/src/store/actions/logs/getLogs.ts
+++ b/frontend/src/store/actions/logs/getLogs.ts
@@ -16,16 +16,17 @@ export const getLogs = (
const response = await GetLogs(props);
- if (response.payload)
+ if (response.payload) {
dispatch({
type: SET_LOGS,
payload: response.payload,
});
- else
+ } else {
dispatch({
type: SET_LOGS,
payload: [],
});
+ }
dispatch({
type: SET_LOADING,
diff --git a/frontend/src/utils/app.ts b/frontend/src/utils/app.ts
index 55a02fa8db..f457e7a280 100644
--- a/frontend/src/utils/app.ts
+++ b/frontend/src/utils/app.ts
@@ -31,7 +31,9 @@ export const isFeatureKeys = (key: string): key is keyof typeof FeatureKeys =>
export function isIngestionActive(data: any): boolean {
const table = get(data, 'data.newResult.data.result[0].table');
- if (!table) return false;
+ if (!table) {
+ return false;
+ }
const key = get(table, 'columns[0].id');
const value = get(table, `rows[0].data["${key}"]`) || '0';
diff --git a/frontend/src/utils/customTimeRangeUtils.ts b/frontend/src/utils/customTimeRangeUtils.ts
index 0b3f570fe7..3010b80207 100644
--- a/frontend/src/utils/customTimeRangeUtils.ts
+++ b/frontend/src/utils/customTimeRangeUtils.ts
@@ -19,7 +19,9 @@ export const getCustomTimeRanges = (): CustomTimeRange[] => {
const stored = localStorage.getItem(
LOCALSTORAGE.LAST_USED_CUSTOM_TIME_RANGES,
);
- if (!stored) return [];
+ if (!stored) {
+ return [];
+ }
const parsed = JSON.parse(stored);
diff --git a/frontend/src/utils/epochUtils.ts b/frontend/src/utils/epochUtils.ts
index 056ca81a26..ce3ad18389 100644
--- a/frontend/src/utils/epochUtils.ts
+++ b/frontend/src/utils/epochUtils.ts
@@ -110,13 +110,19 @@ export const getTimeDifference = (minTime: number, maxTime: number): string => {
const diff = dayjs.duration(diffInMs, 'milliseconds');
const weeks = diff.asWeeks();
- if (weeks >= 1) return `${roundHalfUp(weeks)}w`;
+ if (weeks >= 1) {
+ return `${roundHalfUp(weeks)}w`;
+ }
const days = diff.asDays();
- if (days >= 1) return `${roundHalfUp(days)}d`;
+ if (days >= 1) {
+ return `${roundHalfUp(days)}d`;
+ }
const hours = diff.asHours();
- if (hours >= 1) return `${roundHalfUp(hours)}h`;
+ if (hours >= 1) {
+ return `${roundHalfUp(hours)}h`;
+ }
return `${roundHalfUp(diff.asMinutes())}m`;
};
diff --git a/frontend/src/utils/errorUtils.ts b/frontend/src/utils/errorUtils.ts
index 784ce563da..30af59b133 100644
--- a/frontend/src/utils/errorUtils.ts
+++ b/frontend/src/utils/errorUtils.ts
@@ -4,7 +4,9 @@
* @returns HTTP status code if available, undefined otherwise
*/
export const getHttpStatusCode = (error: any): number | undefined => {
- if (!error) return undefined;
+ if (!error) {
+ return undefined;
+ }
// Try to get status code from APIError instance (transformed by ErrorResponseHandlerV2)
if (typeof error.getHttpStatusCode === 'function') {
diff --git a/frontend/src/utils/getSortedSeriesData.ts b/frontend/src/utils/getSortedSeriesData.ts
index 98336e8b1f..bff607f2df 100644
--- a/frontend/src/utils/getSortedSeriesData.ts
+++ b/frontend/src/utils/getSortedSeriesData.ts
@@ -7,8 +7,12 @@ export const getSortedSeriesData = (
const seriesList = result || [];
return seriesList.sort((a, b) => {
- if (a.values.length === 0) return 1;
- if (b.values.length === 0) return -1;
+ if (a.values.length === 0) {
+ return 1;
+ }
+ if (b.values.length === 0) {
+ return -1;
+ }
const avgA =
a.values.reduce((acc, curr) => acc + parseFloat(curr[1]), 0) /
a.values.length;
diff --git a/frontend/src/utils/getSpanTreeMetadata.ts b/frontend/src/utils/getSpanTreeMetadata.ts
index 631d15d551..37d48fa94e 100644
--- a/frontend/src/utils/getSpanTreeMetadata.ts
+++ b/frontend/src/utils/getSpanTreeMetadata.ts
@@ -28,7 +28,9 @@ export const getSpanTreeMetadata = (
}
if (treeNode.hasError) {
treeNode.serviceColour = themeColors.errorColor;
- } else treeNode.serviceColour = spanServiceColours[treeNode.serviceName];
+ } else {
+ treeNode.serviceColour = spanServiceColours[treeNode.serviceName];
+ }
treeNode.children.forEach((childNode) => {
traverse(childNode, level + 1);
});
diff --git a/frontend/src/utils/logs.ts b/frontend/src/utils/logs.ts
index 9c15b696bf..323b7d9c1c 100644
--- a/frontend/src/utils/logs.ts
+++ b/frontend/src/utils/logs.ts
@@ -6,7 +6,9 @@ export const getDefaultLogBackground = (
isReadOnly?: boolean,
isDarkMode?: boolean,
): string => {
- if (isReadOnly) return '';
+ if (isReadOnly) {
+ return '';
+ }
// TODO handle the light mode here
return `&:hover {
background-color: ${
@@ -20,7 +22,9 @@ export const getActiveLogBackground = (
isDarkMode = true,
logType?: string,
): string => {
- if (!isActiveLog) return ``;
+ if (!isActiveLog) {
+ return ``;
+ }
if (isDarkMode) {
switch (logType) {
case LogType.INFO:
@@ -45,12 +49,16 @@ export const getActiveLogBackground = (
export const getHightLightedLogBackground = (
isHighlightedLog = true,
): string => {
- if (!isHighlightedLog) return '';
+ if (!isHighlightedLog) {
+ return '';
+ }
return `background-color: ${orange[3]};`;
};
export const getCustomHighlightBackground = (isHighlighted = false): string => {
- if (!isHighlighted) return '';
+ if (!isHighlighted) {
+ return '';
+ }
return `background-color: ${Color.BG_ROBIN_500}20;`;
};
diff --git a/frontend/src/utils/numericUtils.ts b/frontend/src/utils/numericUtils.ts
new file mode 100644
index 0000000000..a1ef76ade2
--- /dev/null
+++ b/frontend/src/utils/numericUtils.ts
@@ -0,0 +1,8 @@
+import { isNumber } from 'lodash-es';
+
+export function formatNumericValue(value: number | string): string {
+ if (isNumber(value)) {
+ return value.toString();
+ }
+ return (typeof value === 'string' ? parseFloat(value) : value).toFixed(3);
+}
diff --git a/frontend/src/utils/sanitizeOrderBy.ts b/frontend/src/utils/sanitizeOrderBy.ts
index 098996e7d0..b0ed1c3652 100644
--- a/frontend/src/utils/sanitizeOrderBy.ts
+++ b/frontend/src/utils/sanitizeOrderBy.ts
@@ -13,7 +13,9 @@ export function sanitizeOrderByForExplorer(
(query.groupBy || []).forEach((g) => g?.key && allowed.add(g.key));
getParsedAggregationOptionsForOrderBy(query).forEach((agg) => {
// agg.key is the expression or alias (e.g., count(), avg(quantity), 'alias')
- if ((agg as any)?.key) allowed.add((agg as any).key as string);
+ if ((agg as any)?.key) {
+ allowed.add((agg as any).key as string);
+ }
});
const current = query.orderBy || [];
diff --git a/frontend/src/utils/stringUtils.ts b/frontend/src/utils/stringUtils.ts
index c252cafebf..4cd0b735f1 100644
--- a/frontend/src/utils/stringUtils.ts
+++ b/frontend/src/utils/stringUtils.ts
@@ -1,5 +1,7 @@
export function unquote(str: string): string {
- if (typeof str !== 'string') return str;
+ if (typeof str !== 'string') {
+ return str;
+ }
const trimmed = str.trim();
const firstChar = trimmed[0];
diff --git a/frontend/src/utils/timeUtils.ts b/frontend/src/utils/timeUtils.ts
index 08d6c1caaf..29f967e597 100644
--- a/frontend/src/utils/timeUtils.ts
+++ b/frontend/src/utils/timeUtils.ts
@@ -59,10 +59,18 @@ export const getDurationFromNow = (epochTimestamp: number): string => {
const seconds = duration.seconds();
let result = '';
- if (days > 0) result += `${days}d `;
- if (hours > 0) result += `${hours}h `;
- if (minutes > 0) result += `${minutes}m `;
- if (seconds > 0) result += `${seconds}s`;
+ if (days > 0) {
+ result += `${days}d `;
+ }
+ if (hours > 0) {
+ result += `${hours}h `;
+ }
+ if (minutes > 0) {
+ result += `${minutes}m `;
+ }
+ if (seconds > 0) {
+ result += `${seconds}s`;
+ }
return result.trim();
};
@@ -167,7 +175,9 @@ export const hasDatePassed = (expiresAt: string): boolean => {
export const getDaysUntilExpiry = (expiresAt: string): number => {
const date = dayjs(expiresAt);
- if (!date.isValid()) return 0;
+ if (!date.isValid()) {
+ return 0;
+ }
return date.diff(dayjs(), 'day');
};
diff --git a/frontend/src/utils/tokenUtils.ts b/frontend/src/utils/tokenUtils.ts
index 76a560910e..a70d185b1e 100644
--- a/frontend/src/utils/tokenUtils.ts
+++ b/frontend/src/utils/tokenUtils.ts
@@ -63,7 +63,9 @@ export function isBracketToken(tokenType: number): boolean {
// Helper function to check if an operator typically uses bracket values (multi-value operators)
export function isMultiValueOperator(operatorToken?: string): boolean {
- if (!operatorToken) return false;
+ if (!operatorToken) {
+ return false;
+ }
const upperOp = operatorToken.toUpperCase();
return upperOp === 'IN';
@@ -79,7 +81,9 @@ export function isFunctionToken(tokenType: number): boolean {
}
export function isWrappedUnderQuotes(token: string): boolean {
- if (!token) return false;
+ if (!token) {
+ return false;
+ }
const sanitizedToken = token.trim();
return (
(sanitizedToken.startsWith('"') && sanitizedToken.endsWith('"')) ||
@@ -126,7 +130,9 @@ export function isNonValueOperator(operator: string): boolean {
}
export function isQueryPairComplete(queryPair: Partial<IQueryPair>): boolean {
- if (!queryPair) return false;
+ if (!queryPair) {
+ return false;
+ }
// A complete query pair must have a key, an operator, and a value (or EXISTS operator)
if (queryPair.operator && isNonValueOperator(queryPair.operator)) {
return !!queryPair.key && !!queryPair.operator;