Fix npm run check (#723)

* fix npm run check errors

* undo changes in style_switcher
This commit is contained in:
slothful-vassal
2026-01-13 20:25:40 +01:00
committed by GitHub
parent c2b86f5521
commit 4b749c9868
6 changed files with 26 additions and 15 deletions

View File

@@ -95,7 +95,11 @@ const auth: Handle = async ({ event, resolve }) => {
meiliApiKey = publicMeilisearchKey!; meiliApiKey = publicMeilisearchKey!;
} }
const ms = new MeiliSearch({ host: env.MEILI_URL, apiKey: meiliApiKey }); const meiliHost = env.MEILI_URL;
if (!meiliHost) {
throw error(500, "Missing MEILI_URL");
}
const ms = new MeiliSearch({ host: meiliHost, apiKey: meiliApiKey });
event.locals.ms = ms event.locals.ms = ms
event.locals.pb = pb event.locals.pb = pb
@@ -135,4 +139,4 @@ const removeLinkFromHeaders: Handle =
} }
export const handle = sequence(csrf(['/api/v1']), auth, removeLinkFromHeaders) export const handle = sequence(csrf(['/api/v1']), auth, removeLinkFromHeaders)

View File

@@ -268,23 +268,23 @@ export function createOverpassPopup(feature: GeoJSON.Feature, coordinates: GeoJS
popupContainer.className = "p-4" popupContainer.className = "p-4"
const popupHeading = document.createElement("h1"); const popupHeading = document.createElement("h1");
popupHeading.classList = "font-medium text-lg" popupHeading.className = "font-medium text-lg"
popupHeading.textContent = name; popupHeading.textContent = name;
const coordinateSubtitle = document.createElement("p") const coordinateSubtitle = document.createElement("p")
coordinateSubtitle.classList = "text-gray-500" coordinateSubtitle.className = "text-gray-500"
coordinateSubtitle.textContent = `${coordinates[0].toFixed(6)}, ${coordinates[1].toFixed(6)}` coordinateSubtitle.textContent = `${coordinates[0].toFixed(6)}, ${coordinates[1].toFixed(6)}`
popupContainer.appendChild(popupHeading) popupContainer.appendChild(popupHeading)
popupContainer.appendChild(coordinateSubtitle) popupContainer.appendChild(coordinateSubtitle)
const tagsGrid = document.createElement("div") const tagsGrid = document.createElement("div")
tagsGrid.classList = "grid grid-cols-2 gap-x-4 mt-4" tagsGrid.className = "grid grid-cols-2 gap-x-4 mt-4"
Object.entries(tags).forEach((([k, v]) => { Object.entries(tags).forEach((([k, v]) => {
if (k == "name") return; if (k == "name") return;
const kSpan = document.createElement("span") const kSpan = document.createElement("span")
kSpan.classList = "font-mono" kSpan.className = "font-mono"
kSpan.textContent = k; kSpan.textContent = k;
const vSpan = document.createElement("span") const vSpan = document.createElement("span")
vSpan.textContent = v; vSpan.textContent = v;

View File

@@ -41,11 +41,13 @@ function formatByType(data: number, type: string | number, scale: number, offset
case 'uint32': case 'uint32':
case 'uint16': case 'uint16':
return scale ? data / scale + offset : data; return scale ? data / scale + offset : data;
default: default: {
if (FIT.types[type]) { const types = FIT.types as Record<string, Record<string, any>>;
return FIT.types[type][data]; if (types[type]) {
return types[type][String(data)];
} }
return data; return data;
}
} }
} }
@@ -91,7 +93,8 @@ function isInvalidValue(data: number, type: string) {
} }
function convertTo(data: number, unitsList: string, speedUnit: string | number) { function convertTo(data: number, unitsList: string, speedUnit: string | number) {
var unitObj = FIT.options[unitsList][speedUnit]; const options = FIT.options as Record<string, Record<string, { multiplier: number; offset: number }>>;
var unitObj = options[unitsList]?.[String(speedUnit)];
return unitObj ? data * unitObj.multiplier + unitObj.offset : data; return unitObj ? data * unitObj.multiplier + unitObj.offset : data;
} }

View File

@@ -77,7 +77,7 @@ class EasyFit {
} }
} }
var fitObj = {}; var fitObj: Record<string, any> = {};
var sessions = []; var sessions = [];
var laps = []; var laps = [];
var records = []; var records = [];
@@ -98,7 +98,7 @@ class EasyFit {
var _readRecord = readRecord(blob, messageTypes, loopIndex, this.options, startDate), var _readRecord = readRecord(blob, messageTypes, loopIndex, this.options, startDate),
nextIndex = _readRecord.nextIndex, nextIndex = _readRecord.nextIndex,
messageType = _readRecord.messageType, messageType = _readRecord.messageType,
message = _readRecord.message; message = "message" in _readRecord ? _readRecord.message : undefined;
loopIndex = nextIndex; loopIndex = nextIndex;
switch (messageType) { switch (messageType) {

View File

@@ -2427,11 +2427,14 @@ function getMessageName(messageNum: keyof typeof FIT.messages) {
return message ? message.name : ''; return message ? message.name : '';
} }
function getFieldObject(fieldNum: keyof typeof FIT.messages[keyof typeof FIT.messages], messageNum: keyof typeof FIT.messages) { function getFieldObject(fieldNum: keyof typeof FIT.messages[keyof typeof FIT.messages], messageNum: keyof typeof FIT.messages): Record<string, any> {
var message = FIT.messages[messageNum]; var message = FIT.messages[messageNum];
if (!message) { if (!message) {
return ''; return {};
} }
var fieldObj = message[fieldNum]; var fieldObj = message[fieldNum];
return fieldObj ? fieldObj : {}; if (fieldObj && typeof fieldObj === "object") {
return fieldObj as Record<string, any>;
}
return {};
} }

View File

@@ -86,6 +86,7 @@
clientSecret: integration.strava.clientSecret, clientSecret: integration.strava.clientSecret,
routes: integration.strava.routes, routes: integration.strava.routes,
activities: integration.strava.activities, activities: integration.strava.activities,
privacy: integration.strava.privacy,
accessToken: undefined, accessToken: undefined,
refreshToken: undefined, refreshToken: undefined,
expiresAt: undefined, expiresAt: undefined,