Skip to content

Commit

Permalink
add svelte-check and resolve all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
claireclark1 committed Nov 25, 2024
1 parent fc31203 commit ef7a5bd
Show file tree
Hide file tree
Showing 13 changed files with 860 additions and 1,718 deletions.
2,536 changes: 836 additions & 1,700 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"lint": "eslint",
"lint:fix": "eslint --fix",
"format": "npm run prettier && npm run lint:fix",
"prettier": "prettier --write --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss src"
"prettier": "prettier --write --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss src",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@storybook/addon-essentials": "^8.3.3",
Expand All @@ -40,6 +41,7 @@
"@storybook/svelte-vite": "^8.3.3",
"@sveltejs/package": "^2.3.5",
"@sveltejs/vite-plugin-svelte": "^2.5.3",
"@tsconfig/svelte": "^5.0.4",
"@typescript-eslint/parser": "^8.8.0",
"autoprefixer": "^10.4.13",
"eslint": "^8.50.0",
Expand All @@ -55,12 +57,14 @@
"storybook": "^8.3.3",
"stylelint": "^15.10.0",
"stylelint-config-standard": "^31.0.0",
"svelte-check": "^4.1.0",
"svelte-loader": "^3.2.3",
"tailwindcss": "^3.3.0",
"typescript-eslint": "^8.8.0",
"vite": "^4.4.9"
},
"dependencies": {
"@melt-ui/svelte": "^0.86.2",
"@storybook/addons": "^7.6.17",
"bits-ui": "^0.21.16",
"clsx": "^2.1.1",
Expand Down
4 changes: 4 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svelte' {
import { SvelteComponentTyped } from 'svelte';
export default class SvelteComponent extends SvelteComponentTyped {}
}
6 changes: 2 additions & 4 deletions src/lib/atoms/FormElement.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
export let label = '';
export let isRequired = false;
export let description = '';
export let value: string = '';
export let placeholder = 'Enter some text...';
export let error: string | undefined;
</script>

<div class="flex flex-col gap-f4">
<label class="form-item-label">
<label class="form-item-label" for="form-element">
{label}
{#if isRequired}
<span class="text-error">*</span>
Expand All @@ -21,7 +19,7 @@
<span class="form-item-description">{description}</span>
{/if}

<div class="flex items-center gap-f12">
<div class="flex items-center gap-f12" id="form-element">
<slot />

{#if error}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/atoms/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let error: string | undefined;
</script>

<FormElement {label} {isRequired} {description} {value} {placeholder} {error}>
<FormElement {label} {isRequired} {description} {error}>
<input
class={cn(
'border-input aria-[invalid]:border-destructive data-[placeholder]:[&>span]:text-muted-foreground sm flex h-10 w-full max-w-[388px] items-center justify-between rounded-md border bg-white px-3 py-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/atoms/Select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import { Root, Trigger, Value, Content, Item, Label } from '../shadcnComponents/ui/select';
export let label: string;
export let description: string | undefined;
export let description: string | undefined = undefined;
export let placeholder: string | undefined;
export let isRequired: boolean = false;
export let error: string | undefined;
export let error: string | undefined = undefined;
export let options: { optionLabel: string; value: string }[];
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/lib/atoms/Textarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let error: string | undefined;
</script>

<FormElement {label} {isRequired} {description} {value} {placeholder} {error}>
<FormElement {label} {isRequired} {description} {error}>
<textarea
class={cn(
'border-input aria-[invalid]:border-destructive data-[placeholder]:[&>span]:text-muted-foreground sm flex h-10 w-full max-w-[388px] items-center justify-between rounded-md border bg-white px-3 py-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/Header.stories.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { Meta, Story } from '@storybook/addon-svelte-csf';
import Header from './Header.svelte';
import { MenuItem } from '../utils/types.js';
import type { MenuItem } from '../utils/types.js';
const menuItems: MenuItem[] = [
{ label: 'Mission', href: '#mission', viewportHighlightId: 'mission' },
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { FrequencyLogo } from '../assets/index';
import NavMenu from './NavMenu.svelte';
import NavMenuMobile from './NavMenuMobile.svelte';
import { MenuItem } from '$lib/utils/types.js';
import type { MenuItem } from '$lib/utils/types.js';
import { cn } from '../utils/utils.js';
export let logoLink = '';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Root, Trigger, Content, Header, Title, Description } from '../shadcnComponents/ui/dialog';
export let title = '';
export let description;
export let description = '';
</script>

<Root>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/features/NavMenu.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
// Note: Shows the buttons still in md view, but not the non-buttons
import { onMount, tick } from 'svelte';
import { MenuItem } from '../utils/types.js';
import type { MenuItem } from '../utils/types.js';
import Button from '../atoms/Button.svelte';
export let menuItems: MenuItem[] = [];
Expand Down Expand Up @@ -69,7 +69,7 @@
{/each}
</nav>

<style>
<style lang="postcss">
/* Underline on hover animation */
.underline-on-nav-hover,
.underline-on-nav {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/NavMenuMobile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Note: Menu "Buttons" are shown on the nav bar in "md" view
import { OpenClose } from '../assets/index';
import { MenuItem } from '$lib/utils/types.js';
import type { MenuItem } from '$lib/utils/types.js';
import Button from '../atoms/Button.svelte';
export let menuItems: MenuItem[] = [];
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"types": ["svelte"],
"compilerOptions": {
"paths": {
"$src": [
Expand Down Expand Up @@ -30,7 +32,5 @@
"outDir": "dist",
"declaration": true
},
"include": [
"src/**/*.ts"
]
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
}

0 comments on commit ef7a5bd

Please sign in to comment.