fix: packages/ui eslint issues

This commit is contained in:
ndom91 2024-10-21 14:32:09 +02:00 committed by Nico Domino
parent f928b25fff
commit 26713898b8
9 changed files with 25 additions and 14 deletions

View File

@ -56,6 +56,7 @@
if (ref) {
// reference the value to trigger
// the effect when it changes
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
value;
autoHeight(ref);
}

View File

@ -12,7 +12,7 @@ export interface CommitNodeData {
commit?: CommitData;
}
export interface BaseNodeData {}
export type BaseNodeData = object;
export interface LineData {
top: CellData;

View File

@ -21,7 +21,9 @@
let isSelected = $state(false);
$effect(() => {
elRef && isFocused && elRef.focus();
if (elRef && isFocused) {
elRef.focus();
}
});
$effect(() => {
@ -47,7 +49,9 @@
index,
id
});
onselect && onselect(id);
if (onselect) {
onselect(id);
}
}
}}
onkeydown={({ key }) => {
@ -57,7 +61,9 @@
index,
id
});
onselect && onselect(id);
if (onselect) {
onselect(id);
}
}
}
}}

View File

@ -30,7 +30,9 @@
setSelected: ({ index: segmentIndex, id }) => {
if (segmentIndex >= 0 && segmentIndex < segments.length) {
$selectedSegmentIndex = segmentIndex;
onselect && onselect(id);
if (onselect) {
onselect(id);
}
}
}
};

View File

@ -1,7 +1,7 @@
export function convertToBase64(iconString: string) {
try {
return btoa(iconString);
} catch (err) {
} catch {
return Buffer.from(iconString).toString('base64');
}
}

View File

@ -1,6 +1,8 @@
export function portal(node: HTMLElement, to: string) {
const target = document.querySelector(to);
target && target.appendChild(node);
if (target) {
target.appendChild(node);
}
return {
destroy() {
if (node.isConnected) node.remove();

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { ComponentColor } from '$lib/utils/colorTypes';
import Button from '$lib/Button.svelte';
import type { ComponentColor } from '$lib/utils/colorTypes';
interface Props {
label: string;

View File

@ -2,9 +2,9 @@
import Button from '$lib/Button.svelte';
import Modal from '$lib/Modal.svelte';
const { ...args }: typeof Modal = $props();
const { ...args }: ReturnType<typeof Modal> = $props();
let modal: Modal;
let modal: ReturnType<typeof Modal>;
</script>
<Button
@ -18,8 +18,8 @@
{#snippet controls(close)}
<Button style="ghost" outline onclick={() => close()}>Cancel</Button>
<Button style="pop" kind="solid" type="submit" onclick={() => console.log('clicked')}
>Merge</Button
>
<Button style="pop" kind="solid" type="submit" onclick={() => console.log('clicked')}>
Merge
</Button>
{/snippet}
</Modal>

View File

@ -1,6 +1,6 @@
<script lang="ts">
import AvatarGroup from '$lib/avatar/AvatarGroup.svelte';
import SidebarEntry from '$lib/SidebarEntry.svelte';
import AvatarGroup from '$lib/avatar/AvatarGroup.svelte';
interface Props {
selected?: boolean;