Fix: Replace require with ES module imports

This commit is contained in:
gpt-engineer-app[bot]
2025-11-05 16:12:47 +00:00
parent 6e1ff944c8
commit 5a61a2b49e
3 changed files with 4 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ import type { Json } from '@/integrations/supabase/types';
import { uploadPendingImages } from './imageUploadHelper';
import { CompanyFormData, TempCompanyData } from '@/types/company';
import { handleError } from './errorHandler';
import { withRetry } from './retryHelpers';
import { withRetry, isRetryableError } from './retryHelpers';
import { logger } from './logger';
export type { CompanyFormData, TempCompanyData };
@@ -114,7 +114,6 @@ export async function submitCompanyCreation(
if (message.includes('permission')) return false;
}
const { isRetryableError } = require('./retryHelpers');
return isRetryableError(error);
}
}
@@ -259,7 +258,6 @@ export async function submitCompanyUpdate(
if (message.includes('permission')) return false;
}
const { isRetryableError } = require('./retryHelpers');
return isRetryableError(error);
}
}

View File

@@ -9,6 +9,7 @@ import { logger } from './logger';
import { handleError } from './errorHandler';
import type { TimelineEventFormData, EntityType } from '@/types/timeline';
import { breadcrumb } from './errorBreadcrumbs';
import { isRetryableError } from './retryHelpers';
import {
validateParkCreateFields,
validateRideCreateFields,
@@ -493,7 +494,6 @@ async function submitCompositeCreation(
}
// Use default retryable error detection from retryHelpers
const { isRetryableError } = require('./retryHelpers');
return isRetryableError(error);
}
}
@@ -726,7 +726,6 @@ export async function submitParkCreation(
if (message.includes('permission')) return false;
}
const { isRetryableError } = require('./retryHelpers');
return isRetryableError(error);
}
}
@@ -1176,7 +1175,6 @@ export async function submitRideCreation(
if (message.includes('permission')) return false;
}
const { isRetryableError } = require('./retryHelpers');
return isRetryableError(error);
}
}

View File

@@ -6,6 +6,8 @@
* "Unit Conversion Rules: Storage: Always metric in DB (km/h, m, cm, kg)"
*/
import { convertValueToMetric, getMetricUnit } from './units';
export const METRIC_UNITS = [
'km/h', // Speed
'm', // Distance (large)
@@ -68,7 +70,6 @@ export function ensureMetricUnit(
}
// Convert imperial to metric
const { convertValueToMetric, getMetricUnit } = require('./units');
const metricValue = convertValueToMetric(value, unit);
const metricUnit = getMetricUnit(unit) as MetricUnit;