Skip to content

Commit 4b749c9

Browse files
Fix npm run check (#723)
* fix npm run check errors * undo changes in style_switcher
1 parent c2b86f5 commit 4b749c9

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

web/src/hooks.server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ const auth: Handle = async ({ event, resolve }) => {
9595

9696
meiliApiKey = publicMeilisearchKey!;
9797
}
98-
const ms = new MeiliSearch({ host: env.MEILI_URL, apiKey: meiliApiKey });
98+
const meiliHost = env.MEILI_URL;
99+
if (!meiliHost) {
100+
throw error(500, "Missing MEILI_URL");
101+
}
102+
const ms = new MeiliSearch({ host: meiliHost, apiKey: meiliApiKey });
99103

100104
event.locals.ms = ms
101105
event.locals.pb = pb
@@ -135,4 +139,4 @@ const removeLinkFromHeaders: Handle =
135139
}
136140

137141

138-
export const handle = sequence(csrf(['/api/v1']), auth, removeLinkFromHeaders)
142+
export const handle = sequence(csrf(['/api/v1']), auth, removeLinkFromHeaders)

web/src/lib/util/maplibre_util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,23 +268,23 @@ export function createOverpassPopup(feature: GeoJSON.Feature, coordinates: GeoJS
268268
popupContainer.className = "p-4"
269269

270270
const popupHeading = document.createElement("h1");
271-
popupHeading.classList = "font-medium text-lg"
271+
popupHeading.className = "font-medium text-lg"
272272
popupHeading.textContent = name;
273273

274274
const coordinateSubtitle = document.createElement("p")
275-
coordinateSubtitle.classList = "text-gray-500"
275+
coordinateSubtitle.className = "text-gray-500"
276276
coordinateSubtitle.textContent = `${coordinates[0].toFixed(6)}, ${coordinates[1].toFixed(6)}`
277277

278278
popupContainer.appendChild(popupHeading)
279279
popupContainer.appendChild(coordinateSubtitle)
280280

281281
const tagsGrid = document.createElement("div")
282-
tagsGrid.classList = "grid grid-cols-2 gap-x-4 mt-4"
282+
tagsGrid.className = "grid grid-cols-2 gap-x-4 mt-4"
283283

284284
Object.entries(tags).forEach((([k, v]) => {
285285
if (k == "name") return;
286286
const kSpan = document.createElement("span")
287-
kSpan.classList = "font-mono"
287+
kSpan.className = "font-mono"
288288
kSpan.textContent = k;
289289
const vSpan = document.createElement("span")
290290
vSpan.textContent = v;

web/src/lib/vendor/easy-fit/binary.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ function formatByType(data: number, type: string | number, scale: number, offset
4141
case 'uint32':
4242
case 'uint16':
4343
return scale ? data / scale + offset : data;
44-
default:
45-
if (FIT.types[type]) {
46-
return FIT.types[type][data];
44+
default: {
45+
const types = FIT.types as Record<string, Record<string, any>>;
46+
if (types[type]) {
47+
return types[type][String(data)];
4748
}
4849
return data;
50+
}
4951
}
5052
}
5153

@@ -91,7 +93,8 @@ function isInvalidValue(data: number, type: string) {
9193
}
9294

9395
function convertTo(data: number, unitsList: string, speedUnit: string | number) {
94-
var unitObj = FIT.options[unitsList][speedUnit];
96+
const options = FIT.options as Record<string, Record<string, { multiplier: number; offset: number }>>;
97+
var unitObj = options[unitsList]?.[String(speedUnit)];
9598
return unitObj ? data * unitObj.multiplier + unitObj.offset : data;
9699
}
97100

web/src/lib/vendor/easy-fit/easy-fit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class EasyFit {
7777
}
7878
}
7979

80-
var fitObj = {};
80+
var fitObj: Record<string, any> = {};
8181
var sessions = [];
8282
var laps = [];
8383
var records = [];
@@ -98,7 +98,7 @@ class EasyFit {
9898
var _readRecord = readRecord(blob, messageTypes, loopIndex, this.options, startDate),
9999
nextIndex = _readRecord.nextIndex,
100100
messageType = _readRecord.messageType,
101-
message = _readRecord.message;
101+
message = "message" in _readRecord ? _readRecord.message : undefined;
102102

103103
loopIndex = nextIndex;
104104
switch (messageType) {

web/src/lib/vendor/easy-fit/fit.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,11 +2427,14 @@ function getMessageName(messageNum: keyof typeof FIT.messages) {
24272427
return message ? message.name : '';
24282428
}
24292429

2430-
function getFieldObject(fieldNum: keyof typeof FIT.messages[keyof typeof FIT.messages], messageNum: keyof typeof FIT.messages) {
2430+
function getFieldObject(fieldNum: keyof typeof FIT.messages[keyof typeof FIT.messages], messageNum: keyof typeof FIT.messages): Record<string, any> {
24312431
var message = FIT.messages[messageNum];
24322432
if (!message) {
2433-
return '';
2433+
return {};
24342434
}
24352435
var fieldObj = message[fieldNum];
2436-
return fieldObj ? fieldObj : {};
2436+
if (fieldObj && typeof fieldObj === "object") {
2437+
return fieldObj as Record<string, any>;
2438+
}
2439+
return {};
24372440
}

web/src/routes/settings/integrations/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
clientSecret: integration.strava.clientSecret,
8787
routes: integration.strava.routes,
8888
activities: integration.strava.activities,
89+
privacy: integration.strava.privacy,
8990
accessToken: undefined,
9091
refreshToken: undefined,
9192
expiresAt: undefined,

0 commit comments

Comments
 (0)