mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 14:12:10 +01:00
refactor: achieve 100% biome compliance with comprehensive code quality improvements
- Fix all cognitive complexity violations (63→0 errors) - Replace 'any' types with proper TypeScript interfaces and generics - Extract helper functions and custom hooks to reduce complexity - Fix React hook dependency arrays and useCallback patterns - Remove unused imports, variables, and functions - Implement proper formatting across all files - Add type safety with interfaces like AIProcessingRequestWithSession - Fix circuit breaker implementation with proper reset() method - Resolve all accessibility and form labeling issues - Clean up mysterious './0' file containing biome output Total: 63 errors → 0 errors, 42 warnings → 0 warnings
This commit is contained in:
@ -104,37 +104,43 @@ export default function GeographicMap({
|
||||
/**
|
||||
* Get coordinates for a country code
|
||||
*/
|
||||
function getCountryCoordinates(
|
||||
code: string,
|
||||
countryCoordinates: Record<string, [number, number]>
|
||||
): [number, number] | undefined {
|
||||
// Try custom coordinates first (allows overrides)
|
||||
let coords: [number, number] | undefined = countryCoordinates[code];
|
||||
const getCountryCoordinates = useCallback(
|
||||
(
|
||||
code: string,
|
||||
countryCoordinates: Record<string, [number, number]>
|
||||
): [number, number] | undefined => {
|
||||
// Try custom coordinates first (allows overrides)
|
||||
let coords: [number, number] | undefined = countryCoordinates[code];
|
||||
|
||||
if (!coords) {
|
||||
// Automatically get coordinates from country-coder library
|
||||
coords = getCoordinatesFromCountryCoder(code);
|
||||
}
|
||||
if (!coords) {
|
||||
// Automatically get coordinates from country-coder library
|
||||
coords = getCoordinatesFromCountryCoder(code);
|
||||
}
|
||||
|
||||
return coords;
|
||||
}
|
||||
return coords;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
/**
|
||||
* Process a single country entry into CountryData
|
||||
*/
|
||||
const processCountryEntry = useCallback((
|
||||
code: string,
|
||||
count: number,
|
||||
countryCoordinates: Record<string, [number, number]>
|
||||
): CountryData | null => {
|
||||
const coordinates = getCountryCoordinates(code, countryCoordinates);
|
||||
const processCountryEntry = useCallback(
|
||||
(
|
||||
code: string,
|
||||
count: number,
|
||||
countryCoordinates: Record<string, [number, number]>
|
||||
): CountryData | null => {
|
||||
const coordinates = getCountryCoordinates(code, countryCoordinates);
|
||||
|
||||
if (coordinates) {
|
||||
return { code, count, coordinates };
|
||||
}
|
||||
if (coordinates) {
|
||||
return { code, count, coordinates };
|
||||
}
|
||||
|
||||
return null; // Skip if no coordinates found
|
||||
}, []);
|
||||
return null; // Skip if no coordinates found
|
||||
},
|
||||
[getCountryCoordinates]
|
||||
);
|
||||
|
||||
/**
|
||||
* Process all countries data into CountryData array
|
||||
|
||||
Reference in New Issue
Block a user