Skip to content

Commit e9d96a2

Browse files
authored
resolve svelte-fix errors (#106)
# Description When running `npm run check` we should get no errors. Resolve all errors or as many as possible. - Closes #105 ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) # How to Test? run `npm run check` and see that there is only the mouse exit/enter errors. According to multiple forums, that is a known error that we can't yet solve. # Checklist: - [ ] I have performed a self-review of my code - [ ] I have commented my code & PR, particularly in hard-to-understand areas - [ ] I have checked at all the breakpoints to make sure it works on all screen sizes --------- Co-authored-by: Claire Olmstead <[email protected]>
1 parent 0cc57db commit e9d96a2

15 files changed

+58
-102
lines changed

package-lock.json

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"type": "module",
4848
"dependencies": {
4949
"@frequency-chain/style-guide": "^0.1.24",
50-
"@lottiefiles/dotlottie-web": "^0.37.0-beta.8"
50+
"@lottiefiles/dotlottie-web": "^0.37.0-beta.8",
51+
"@tsconfig/svelte": "^5.0.4"
5152
}
5253
}

src/components/Animations/Home.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
src="{base}/animation/home-dot.lottie"
99
autoplay
1010
playOnVisible
11-
speed="0.8"
11+
speed={0.8}
1212
layout={{ fit: 'fit-width', align: [0.5, 0.5] }}
1313
renderConfig={{ autoResize: true }}
1414
/>
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<script lang="ts">
22
import ThankYouWaves from '$lib/assets/Contact/ThankYouWave.svg';
33
4-
let { onClick = async () => {} } = $props();
4+
export let onClick: (e: MouseEvent) => void;
55
</script>
66

7-
<!-- svelte-ignore a11y_click_events_have_key_events -->
8-
<!-- svelte-ignore a11y_no_static_element_interactions -->
9-
<div class="flex cursor-pointer items-center justify-center" onclick={onClick}>
7+
<button class="flex cursor-pointer items-center justify-center" onclick={onClick}>
108
<img src={ThankYouWaves} alt="Frequency waves with 'Thank you!' caption" />
11-
</div>
9+
</button>

src/components/GetNotified/GetNotified.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
// form.checkValidity doesn't work b/c StyleGuide doesn't propagate
2828
// 'required' into its form inputs.
2929
const checkValidity = (form: HTMLElement): boolean => {
30-
for (let input of form.getElementsByClassName('required')) {
31-
if (!input?.value) return false;
30+
for (const element of form.getElementsByClassName('required')) {
31+
const input = element as HTMLInputElement;
32+
if (!input.value) return false;
3233
}
3334
return true;
3435
};
@@ -49,7 +50,7 @@
4950
if (isPartnership) formData.append(fieldMapping.partnerInterest, 'Partner');
5051
5152
try {
52-
let response: unknown;
53+
let response: Partial<Response>;
5354
if (dev) {
5455
response = {
5556
ok: true,

src/components/Grow.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<div
99
class="grow-out transition-all duration-1000 {grow} {klass}"
1010
use:viewport
11-
onenterViewport={() => (grow = 'grow-in')}
12-
onexitViewport={() => (grow = '')}
11+
{...{ onenterViewport: () => (grow = 'grow-in') } as any}
12+
{...{ onexitViewport: () => (grow = '') } as any}
1313
>
1414
{@render children?.()}
1515
</div>

src/components/OpenCloseIcon.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
export let onClick: () => void;
33
export let isOpen: boolean;
44
export let classes: string = '';
5+
6+
function handleOnClick(event: Event) {
7+
event.preventDefault();
8+
onClick();
9+
}
510
</script>
611

712
<button
813
aria-label="Open main navigation"
914
aria-controls="mobile-navigation"
10-
on:click|preventDefault={onClick}
15+
onclick={handleOnClick}
1116
class={`z-50 ${classes}`}
1217
>
1318
<svg class="h-[40px] w-[40px]" role="none">

src/components/Sections/Mission/MissionStatement.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
</div>
1515

16-
<style>
16+
<style lang="postcss">
1717
.text-slider-container {
1818
@apply flex flex-col gap-0;
1919
animation: text-slide 10s linear infinite;

src/components/Sections/Top/Top.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</div>
3434
</SectionWrapper>
3535

36-
<style>
36+
<style lang="postcss">
3737
.top-title {
3838
@apply font-title leading-[1] tracking-wide text-primary xs:text-[50px] sm:text-[60px] md:text-[75px] lg:text-[90px];
3939
}

src/components/SideTag.svelte

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/components/SlideIn.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<div
99
class={`slide-out transition-all duration-1000 ${slide} ${klass}`}
1010
use:viewport
11-
onenterViewport={() => (slide = 'slide-in')}
12-
onexitViewport={() => (slide = '')}
11+
{...{ onenterViewport: () => (slide = 'slide-in') } as any}
12+
{...{ onexitViewport: () => (slide = '') } as any}
1313
>
1414
{@render children?.()}
1515
</div>

src/lib/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { add } from '$lib';
21
import { describe, it, expect } from 'vitest';
2+
import { add } from '$lib/index';
33

44
describe('sum test', () => {
55
it('adds 1 + 2 to equal 3', () => {

src/lib/vendor/LottieWrapper.svelte

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
let prevSrc: string | undefined = undefined;
5151
let prevData: Config['data'] = undefined;
5252
// Render each different src in a different worker
53-
let workerId = 'lottie-' + src.replace('/', '-');
53+
let workerId = 'lottie-' + src?.replace('/', '-');
5454
5555
onMount(() => {
5656
const shouldAutoplay = autoplay && !playOnHover;
5757
dotLottie = new DotLottie({
5858
canvas,
59-
src: src.includes('://') ? src : new URL(src, self.location.href).toString(),
59+
src: src?.includes('://') ? src : new URL(src || '', self.location.href).toString(),
6060
autoplay: shouldAutoplay,
6161
loop,
6262
speed,
@@ -142,7 +142,7 @@
142142
143143
$: if (dotLottie && src !== prevSrc) {
144144
dotLottie.load({
145-
src: src.includes('://') ? src : new URL(src, self.location.href).toString(),
145+
src: src?.includes('://') ? src : new URL(src || '', self.location.href).toString(),
146146
autoplay,
147147
loop,
148148
speed,
@@ -155,8 +155,8 @@
155155
marker,
156156
layout,
157157
workerId,
158-
});
159-
prevSrc = src;
158+
} as any);
159+
prevSrc = src = data as any;
160160
}
161161
162162
$: if (dotLottie && data !== prevData) {
@@ -174,20 +174,25 @@
174174
marker,
175175
layout,
176176
workerId,
177-
});
178-
prevData = data;
177+
} as any);
178+
prevData = data as any;
179179
}
180180
181181
$: if (dotLottie && dotLottie.isLoaded && dotLottie.activeAnimationId !== animationId) {
182-
dotLottie.loadAnimation(animationId);
182+
(dotLottie as any).loadAnimation(animationId);
183183
}
184184
185185
$: if (dotLottie && dotLottie.isLoaded && dotLottie.activeThemeId !== themeId) {
186-
dotLottie.loadTheme(themeId);
186+
(dotLottie as any).loadTheme(themeId);
187187
}
188188
189189
$: if (dotLottie && dotLottie.isLoaded) {
190-
dotLottie.loadThemeData(themeData);
190+
(dotLottie as any).loadThemeData(themeData);
191+
}
192+
193+
function onEnterCanvas() {
194+
dotLottie?.setFrame(0);
195+
dotLottie?.play();
191196
}
192197
</script>
193198

@@ -196,13 +201,8 @@
196201
class="block h-full w-full {$$restProps.class}"
197202
bind:this={canvas}
198203
use:viewport={{ threshold: 0.3 }}
199-
on:enterViewport={() => {
200-
dotLottie?.setFrame(0);
201-
dotLottie?.play();
202-
}}
203-
on:exitViewport={() => {
204-
dotLottie?.stop();
205-
}}
204+
{...{ onenterViewport: () => onEnterCanvas() } as any}
205+
{...{ onexitViewport: () => dotLottie?.stop() } as any}
206206
>
207207
</canvas>
208208
{:else}

svelte.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const config = {
2121
paths: {
2222
base: dev ? '' : process.env.BASE_PATH,
2323
},
24+
alias: {
25+
$components: 'src/components',
26+
$lib: 'src/lib',
27+
routes: 'src/routes',
28+
},
2429
},
2530
};
2631

tsconfig.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
"sourceMap": true,
1111
"strict": true,
1212
"moduleResolution": "bundler",
13-
"types": ["vitest/globals", "@testing-library/jest-dom"]
14-
}
15-
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
13+
"types": ["svelte", "@sveltejs/kit", "vitest/globals", "@testing-library/jest-dom"]
14+
},
15+
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
16+
17+
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias,
18+
// but we still need to define the paths here or else we will get a "Cannot find module '*.svelte' or its corresponding type declarations" error
1619
//
1720
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
1821
// from the referenced tsconfig.json - TypeScript does not merge them in

0 commit comments

Comments
 (0)