Skip to content

Commit cc665f9

Browse files
committed
Fix errors & warnings in VS Code
1 parent a0fe218 commit cc665f9

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

web/src/components/AutoStarlightPage.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import type { MarkdownHeading } from 'astro';
34
import { parse } from 'node-html-parser';
45
56
const { frontmatter = {} } = Astro.props;
@@ -11,10 +12,10 @@ if (Astro.slots.has('default')) {
1112
1213
const root = parse(slot ?? '', { lowerCaseTagName: false });
1314
14-
const headings = [];
15+
const headings: MarkdownHeading[] = [];
1516
1617
// AnchorHeading component source
17-
function renderAnchorHeading(level, id, text, classAttr = '', styleAttr = '') {
18+
function renderAnchorHeading(level: number, id: string, text: string, classAttr = '', styleAttr = '') {
1819
const accessibleLabel = `Section ${text}`;
1920
2021
return `

web/src/components/CategoryList.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { badgeConfig } from "@src/utils/badges";
66
import { Badge } from "@astrojs/starlight/components";
77
88
interface Props {
9-
itemsByCategory: any;
9+
itemsByCategory: Record<string, any[]>;
1010
what: string;
1111
}
1212

web/src/components/CodeExamplesSection.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ if (codeExamples.length === 0 && !examplesRequired) {
8383
const buttons = document.querySelectorAll('.tab-btn');
8484
const tabs = document.querySelectorAll('.tab-content');
8585

86-
function activateTab(tabIndex) {
87-
buttons.forEach((b) => b.classList.toggle('active', b.dataset.tab === tabIndex));
88-
tabs.forEach((t) => (t.style.display = t.dataset.tab === tabIndex ? 'block' : 'none'));
86+
function activateTab(tabIndex: string) {
87+
buttons.forEach((b) => (b as HTMLElement).classList.toggle('active', (b as HTMLElement).dataset.tab === tabIndex));
88+
tabs.forEach((t) => ((t as HTMLElement).style.display = (t as HTMLElement).dataset.tab === tabIndex ? 'block' : 'none'));
8989
}
9090

9191
buttons.forEach((btn) => {
9292
btn.addEventListener('click', () => {
93-
const tab = btn.dataset.tab;
93+
const tab = (btn as HTMLElement).dataset.tab;
94+
if (!tab) return;
9495
activateTab(tab);
9596

9697
history.replaceState(null, '', `#example${parseInt(tab) + 1}`);

web/src/components/PreviewImages.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (images?.length) {
2929
}
3030
---
3131

32-
{images?.length > 0 && (
32+
{images && images.length > 0 && (
3333
<div id="preview-images-gallery">
3434
<h4>Gallery</h4>
3535
<p>Click on the image to view the full preview along with the description.</p>

web/src/pages/reference/ID_Lists/Blips.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { blips } from "@src/data/blips";
3838
src={getAssetImagePath(`Blips/radar_${blip.name}.png`)}
3939
alt={blip.name}
4040
class="blip-image"
41-
id={blip.id}
41+
id={String(blip.id)}
4242
/>
4343

4444
<p><code>{blip.id}</code></p>

web/src/pages/reference/ID_Lists/IDE.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ import { ide_table } from '@src/data/ide_table';
4343
</div>
4444

4545
<script>
46-
const filterInput = document.getElementById('filterInput');
47-
const tableBody = document.getElementById('tableBody');
46+
const filterInput = document.getElementById('filterInput') as HTMLInputElement;
47+
const tableBody = document.getElementById('tableBody') as HTMLTableElement;
48+
if (!filterInput || !tableBody)
49+
return;
4850

4951
filterInput.addEventListener('input', () => {
5052
const filter = filterInput.value.toLowerCase();

web/src/pages/reference/ID_Lists/Vehicles.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { vehicles } from '@src/data/vehicles';
3232
<li>
3333
<a href={`#${category}`}>{category}</a>
3434
<ul>
35-
{Object.keys(vehicles[category]).map(subcategory => (
35+
{Object.keys(vehicles[category as keyof typeof vehicles]).map(subcategory => (
3636
<>
3737
{subcategory !== 'Uncategorized' && (
3838
<li>
@@ -82,6 +82,7 @@ import { vehicles } from '@src/data/vehicles';
8282
<h3 class="vehicle-category-title">{category}</h3>
8383
{
8484
Object.entries(subcategories).map(([subcategory, vehiclesList]) => (
85+
<>
8586
<div class="vehicle-subcategory" id={subcategory}>
8687
{subcategory !== 'Uncategorized' && (
8788
<h4 class="vehicle-subcategory-title">{subcategory}</h4>
@@ -102,6 +103,7 @@ import { vehicles } from '@src/data/vehicles';
102103
))}
103104
</div>
104105
</div>
106+
</>
105107
))
106108
}
107109
</div>

0 commit comments

Comments
 (0)