Resolved all eslint issues

This commit is contained in:
2022-12-30 00:35:53 +01:00
parent bfb55db8d6
commit d4a0569af0
10 changed files with 23 additions and 23 deletions

View File

@@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import { fade, fly, slide } from 'svelte/transition'; import { fly, slide } from 'svelte/transition';
import type IOrderValidationError from '$lib/interfaces/IOrderValidationError';
export let errors: string[] = []; export let errors: string[] = [];
let currentCard = 0; let currentCard = 0;

View File

@@ -1,13 +1,13 @@
<script lang="ts"> <script lang="ts">
import ProductTile from './ProductTile.svelte'; import ProductTile from './ProductTile.svelte';
import Button from './Button.svelte'; // import Button from './Button.svelte';
import type { IProduct } from '$lib/interfaces/IProduct'; import type { IProduct } from '$lib/interfaces/IProduct';
import LinkArrow from './LinkArrow.svelte'; import LinkArrow from './LinkArrow.svelte';
export let products: IProduct[]; export let products: IProduct[];
export let title: string; export let title: string;
export let textColor: string = 'black'; export let textColor = 'black';
export let backgroundColor: string = 'white'; export let backgroundColor = 'white';
let galleryStyles = `background-color: ${backgroundColor}; color: ${textColor}`; let galleryStyles = `background-color: ${backgroundColor}; color: ${textColor}`;
</script> </script>

View File

@@ -80,7 +80,7 @@ color: ${product?.primary_color === '#231B1D' ? '#f3efeb' : '#37301e'}`;
if (entries[0]?.isIntersecting) { if (entries[0]?.isIntersecting) {
const target = entries[0]?.target as HTMLElement; const target = entries[0]?.target as HTMLElement;
const targetIndex = Number(target?.dataset?.index); const targetIndex = Number(target?.dataset?.index);
if (targetIndex === NaN) return; if (isNaN(targetIndex)) return;
selected = targetIndex; selected = targetIndex;
updateHeight(); updateHeight();

View File

@@ -5,7 +5,7 @@
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
let dragOver: boolean = false; let dragOver = false;
let fileInput: HTMLInputElement; let fileInput: HTMLInputElement;
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -23,7 +23,7 @@
await uploadImage(file); await uploadImage(file);
} }
setTimeout(() => (fileInput.value = ''), 3000); setTimeout(() => resetUploadInput, 3000);
} }
function resetUploadInput() { function resetUploadInput() {
@@ -80,20 +80,21 @@
// uploadImage(file) // uploadImage(file)
} }
function onFileDrop(event: Event) { function onFileDrop(event: DragEvent) {
const { files } = event?.dataTransfer; const files: FileList | undefined = event?.dataTransfer?.files;
if (files) { if (files) {
fileInput.files = files; fileInput.files = files;
} }
} }
$: hasFiles = fileInput?.files?.length > 0 || false; $: hasFiles = (fileInput?.files && fileInput?.files?.length > 0) || false;
</script> </script>
<div <div
id="drop_zone" id="drop_zone"
class="{dragOver ? 'highlighted' : ''}" class="{dragOver ? 'highlighted' : ''}"
on:click="{() => fileInput.click()}" on:click="{() => fileInput.click()}"
on:keypress="{(e) => e.code === 'Enter' && fileInput.click()}"
on:drop|preventDefault="{onFileDrop}" on:drop|preventDefault="{onFileDrop}"
on:dragover|preventDefault="{() => (dragOver = true)}" on:dragover|preventDefault="{() => (dragOver = true)}"
on:dragenter|preventDefault="{() => (dragOver = true)}" on:dragenter|preventDefault="{() => (dragOver = true)}"
@@ -118,8 +119,11 @@
<span>Files found to upload:</span> <span>Files found to upload:</span>
<div class="thumbnails"> <div class="thumbnails">
{#each fileInput.files || [] as file} {#each fileInput.files || [] as file, index}
<img src="{window.URL.createObjectURL(file)}" /> <img
src="{window.URL.createObjectURL(file)}"
alt="{`Upload asset thumbnail number ${index + 1}`}"
/>
{/each} {/each}
</div> </div>

View File

@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
export let pointLeft: boolean = false; export let pointLeft = false;
let defaultRoute = '/shop'; let defaultRoute = '/shop';
function navigateBack() { function navigateBack() {

View File

@@ -3,8 +3,8 @@ import { loadStripe } from '@stripe/stripe-js/pure';
import type { import type {
ConfirmCardPaymentData, ConfirmCardPaymentData,
PaymentIntentResult, PaymentIntentResult,
Stripe, Stripe
StripeError // StripeError
} from '@stripe/stripe-js'; } from '@stripe/stripe-js';
let stripeInstance: Stripe; let stripeInstance: Stripe;

View File

@@ -5,7 +5,7 @@
import FrontTextImageBubble from '$lib/components/FrontTextImageBubble.svelte'; import FrontTextImageBubble from '$lib/components/FrontTextImageBubble.svelte';
// import FrontProductGallery from '$lib/components/FrontProductGallery.svelte'; // import FrontProductGallery from '$lib/components/FrontProductGallery.svelte';
import type IFrontTextImage from '$lib/interfaces/IFrontTextImage'; import type IFrontTextImage from '$lib/interfaces/IFrontTextImage';
import type { IProduct } from '$lib/interfaces/IProduct'; // import type { IProduct } from '$lib/interfaces/IProduct';
import type IFrontText from '$lib/interfaces/IFrontText'; import type IFrontText from '$lib/interfaces/IFrontText';
const textImages: Array<IFrontTextImage> = [ const textImages: Array<IFrontTextImage> = [

View File

@@ -14,7 +14,6 @@
import { buildApiUrl } from '$lib/utils/apiUrl'; import { buildApiUrl } from '$lib/utils/apiUrl';
import type { StripeCardElement } from '@stripe/stripe-js/types'; import type { StripeCardElement } from '@stripe/stripe-js/types';
import type ICustomer from '$lib/interfaces/ICustomer'; import type ICustomer from '$lib/interfaces/ICustomer';
import type IOrderValidationError from '$lib/interfaces/IOrderValidationError';
import type { import type {
IOrderCreateDTO, IOrderCreateDTO,
IOrderCreateResponse, IOrderCreateResponse,
@@ -44,7 +43,7 @@
function handleSubmitOrderError(error: IOrderCreateUnsuccessfullResponse) { function handleSubmitOrderError(error: IOrderCreateUnsuccessfullResponse) {
console.log('got error from order api!', error, error?.validationErrors); console.log('got error from order api!', error, error?.validationErrors);
const { success, validationErrors } = error; const { validationErrors } = error;
if (!validationErrors || validationErrors?.length == 0) { if (!validationErrors || validationErrors?.length == 0) {
errors.push('Ukjent feil ved plassering av ordre.'); errors.push('Ukjent feil ved plassering av ordre.');

View File

@@ -4,7 +4,6 @@
import PaymentDetails from './PaymentDetails.svelte'; import PaymentDetails from './PaymentDetails.svelte';
import CustomerDetails from './CustomerDetails.svelte'; import CustomerDetails from './CustomerDetails.svelte';
import TrackingDetails from './TrackingDetails.svelte'; import TrackingDetails from './TrackingDetails.svelte';
import ShipmentProgress from '$lib/components/ShipmentProgress.svelte';
import type { IOrder } from '$lib/interfaces/IOrder'; import type { IOrder } from '$lib/interfaces/IOrder';
import type { PageServerData } from './$types'; import type { PageServerData } from './$types';

View File

@@ -49,10 +49,9 @@
else updateShipment(); else updateShipment();
} }
let edit: boolean = false; let edit = false;
let trackingCode: string = shipping?.tracking_code; let trackingCode: string = shipping?.tracking_code;
let trackingLink: string = shipping?.tracking_link; let trackingLink: string = shipping?.tracking_link;
let courier: string = shipping?.courier;
let selectedCourier: any = shipping?.courier_id; let selectedCourier: any = shipping?.courier_id;
let couriers: ICourier[]; let couriers: ICourier[];
</script> </script>
@@ -63,7 +62,7 @@
{#if shipping} {#if shipping}
<ul class="property-list"> <ul class="property-list">
<li> <li>
<span class="label" for="courier">Tracking company</span> <label class="label" for="courier">Tracking company</label>
{#if !edit} {#if !edit}
<span>{shipping.courier}</span> <span>{shipping.courier}</span>
{:else if couriers?.length > 0} {:else if couriers?.length > 0}