Skip to content

Commit a748cf9

Browse files
authored
Merge pull request #400 from 3nprob/vite-plugin-checker
chore(frontend): add vite-plugin-checker devDependency
2 parents 67f6d7e + 86f7f9d commit a748cf9

File tree

10 files changed

+142
-34
lines changed

10 files changed

+142
-34
lines changed

services/frontend/www-app/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import globals from 'globals';
55
import typescriptEslint from 'typescript-eslint';
66

77
export default typescriptEslint.config(
8-
{ ignores: ['**/*.d.ts', '**/coverage', '**/dist', '.quasar/**' ] },
8+
{ ignores: ['**/*.d.ts', '**/coverage', '**/dist', '.quasar/**'] },
99
{
1010
extends: [
1111
eslint.configs.recommended,
@@ -25,5 +25,5 @@ export default typescriptEslint.config(
2525
// your rules
2626
},
2727
},
28-
eslintConfigPrettier
28+
eslintConfigPrettier,
2929
);

services/frontend/www-app/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
"prettier": "^3.2.4",
4444
"ts-jest": "^29.1.2",
4545
"typescript": "^5.7.2",
46-
"typescript-eslint": "^8.18.0"
46+
"typescript-eslint": "^8.18.0",
47+
"vite-plugin-checker": "^0.11.0",
48+
"vue-tsc": "^3.1.5"
4749
},
4850
"engines": {
4951
"node": "^24 || ^23 || ^22 || ^20",

services/frontend/www-app/quasar.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default defineConfig((/* ctx */) => {
9090
vueTsc: true,
9191
eslint: {
9292
lintCommand:
93-
'eslint -c ./eslint.config.js "./src*/**/*.{ts,js,mjs,cjs,vue}"',
93+
'eslint -c ./eslint.config.mjs "./src*/**/*.{ts,js,mjs,cjs,vue}"',
9494
useFlatConfig: true,
9595
},
9696
},

services/frontend/www-app/src/components/BaseMap.vue

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ async function loadMap(): Promise<maplibregl.Map> {
5959
6060
const bounds = Config.maxBounds;
6161
if (bounds) {
62-
const center = [(bounds[2] + bounds[0]) / 2, (bounds[3] + bounds[1]) / 2];
62+
const center: [number, number] = [
63+
(bounds[2] + bounds[0]) / 2,
64+
(bounds[3] + bounds[1]) / 2,
65+
];
6366
const scaleFactor = 1.0 / Math.cos((3.14159 / 180) * center[1]);
6467
const extents = [bounds[2] - bounds[0], bounds[3] - bounds[1]];
6568
const maxExtent = Math.max(...extents) * scaleFactor;
@@ -151,8 +154,8 @@ interface SimpleMarker {
151154
export default defineComponent({
152155
name: 'BaseMap',
153156
data: function (): {
154-
flyToOptions?: FlyToOptions;
155-
boundsToFit?: LngLatBoundsLike;
157+
flyToOptions?: FlyToOptions | undefined;
158+
boundsToFit?: LngLatBoundsLike | undefined;
156159
markers: Map<string, SimpleMarker>;
157160
layers: string[];
158161
loaded: boolean;
@@ -286,11 +289,11 @@ export default defineComponent({
286289
});
287290
});
288291
this.pushTouchHandler('poi_click', async (event) => {
289-
if (!event.features) {
292+
if (!event.features || event.features.length === 0) {
290293
console.warn('poi_click without features');
291294
return;
292295
}
293-
const place = await mapFeatureToPlace(event?.features[0]);
296+
const place = await mapFeatureToPlace(event.features[0]!);
294297
if (place?.id.gid) {
295298
const id = PlaceId.gid(place.id.gid);
296299
this.$router.push({
@@ -510,20 +513,19 @@ export default defineComponent({
510513
pushLayer(
511514
layerId: TripLayerId,
512515
source: SourceSpecification,
513-
layer: LayerSpecification,
516+
newLayer: LayerSpecification,
514517
beforeLayerType: string,
515518
) {
516519
const sourceKey = layerId.toString();
517-
const actualLayer = layer;
518520
// eslint-disable-next-line @typescript-eslint/no-explicit-any
519-
if ((actualLayer as any).source) {
521+
if ((newLayer as any).source) {
520522
// eslint-disable-next-line @typescript-eslint/no-explicit-any
521-
(actualLayer as any).source = sourceKey;
523+
(newLayer as any).source = sourceKey;
522524
}
523525
// eslint-disable-next-line @typescript-eslint/no-explicit-any
524-
if ((actualLayer as any).id) {
526+
if ((newLayer as any).id) {
525527
// eslint-disable-next-line @typescript-eslint/no-explicit-any
526-
(actualLayer as any).id = sourceKey;
528+
(newLayer as any).id = sourceKey;
527529
}
528530
this.ensureMapLoaded((map: maplibregl.Map) => {
529531
if (map.getLayer(sourceKey)) {
@@ -536,14 +538,14 @@ export default defineComponent({
536538
let beforeLayerId = undefined;
537539
if (beforeLayerType) {
538540
for (const key in map.style._layers) {
539-
const layer = map.style._layers[key];
540-
if (layer.type == beforeLayerType) {
541+
const layer = map.style._layers[key]!;
542+
if (layer.type === beforeLayerType) {
541543
beforeLayerId = layer.id;
542544
break;
543545
}
544546
}
545547
}
546-
map.addLayer(layer, beforeLayerId);
548+
map.addLayer(newLayer, beforeLayerId);
547549
this.layers.push(layerId.toString());
548550
});
549551
},

services/frontend/www-app/src/components/MultiModalSteps.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,17 @@ type Step = {
123123
124124
function buildSteps(itinerary: Itinerary): Step[] {
125125
const firstLeg = itinerary.legs[0];
126+
if (!firstLeg) {
127+
console.error('Itinerary has no legs');
128+
return [];
129+
}
126130
127131
function pairwiseForEach(
128132
list: ItineraryLeg[],
129133
f: (prev: ItineraryLeg, current: ItineraryLeg | undefined) => void,
130134
): void {
131135
for (let idx = 0; idx < list.length; idx++) {
132-
f(list[idx], list[idx + 1]);
136+
f(list[idx]!, list[idx + 1]);
133137
}
134138
}
135139

services/frontend/www-app/src/pages/AlternatesPage.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,24 @@ export default defineComponent({
283283
},
284284
renderTrips(selectedIdx: number) {
285285
console.assert(this.trips.length > 0);
286-
const trips: Trip[] = this.trips as Trip[];
287286
const map = getBaseMap();
288287
if (!map) {
289288
console.error('basemap was unexpectedly empty');
290289
return;
291290
}
291+
const trips: Trip[] = this.trips as Trip[];
292+
const selectedTrip = trips[selectedIdx]!;
293+
if (!selectedTrip) {
294+
console.error('selected trip was unexpectedly undefined');
295+
return;
296+
}
292297
this.$data.trips = trips;
293-
this.activeTrip = trips[selectedIdx];
298+
this.activeTrip = selectedTrip;
294299
295300
for (let tripIdx = 0; tripIdx < trips.length; tripIdx++) {
296-
const trip = trips[tripIdx];
301+
const trip = trips[tripIdx]!;
297302
for (let legIdx = 0; legIdx < trip.legs.length; legIdx++) {
298-
const leg = trip.legs[legIdx];
303+
const leg = trip.legs[legIdx]!;
299304
if (tripIdx == selectedIdx) {
300305
if (map.hasLayer(TripLayerId.unselectedLeg(tripIdx, legIdx))) {
301306
map.removeLayer(TripLayerId.unselectedLeg(tripIdx, legIdx));
@@ -333,9 +338,8 @@ export default defineComponent({
333338
}
334339
335340
// Add selected trip last to be sure it's on top of the unselected trips
336-
const selectedTrip = trips[selectedIdx];
337341
for (let legIdx = 0; legIdx < selectedTrip.legs.length; legIdx++) {
338-
const leg = selectedTrip.legs[legIdx];
342+
const leg = selectedTrip.legs[legIdx]!;
339343
if (!map.hasLayer(TripLayerId.selectedLeg(selectedIdx, legIdx))) {
340344
map.pushTripLayer(
341345
TripLayerId.selectedLeg(selectedIdx, legIdx),

services/frontend/www-app/src/pages/SearchPage.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ export default defineComponent({
8181
},
8282
},
8383
data(): {
84-
searchResults?: SearchResults;
85-
selectedPlace?: Place;
86-
hoveredPlace?: Place;
84+
searchResults?: SearchResults | undefined;
85+
selectedPlace?: Place | undefined;
86+
hoveredPlace?: Place | undefined;
8787
isLoading: boolean;
8888
} {
8989
return {

services/frontend/www-app/src/pages/StepsPage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default defineComponent({
7676
};
7777
},
7878
data: function (): {
79-
trip?: Trip;
79+
trip?: Trip | undefined;
8080
tripMarkers: string[];
8181
} {
8282
return {
@@ -202,7 +202,7 @@ export default defineComponent({
202202
// we can keep the layer we need and remove the others based on a prefix/regex/w.e.
203203
const layerIds = [];
204204
for (let legIdx = 0; legIdx < trip.legs.length; legIdx++) {
205-
const leg = trip.legs[legIdx];
205+
const leg = trip.legs[legIdx]!;
206206
207207
const layerId = TripLayerId.selectedLeg(tripIdx, legIdx);
208208
layerIds.push(layerId);

services/frontend/www-app/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"extends": "./.quasar/tsconfig.json",
33
"compilerOptions": {
4+
/* TODO: Enable exactOptionalPropertyTypes */
5+
"exactOptionalPropertyTypes": false,
46
"baseUrl": ".",
57
"paths": {
68
"src/*": ["src/*"],

0 commit comments

Comments
 (0)