fix: eslint errors

This commit is contained in:
2023-02-10 17:28:54 +01:00
parent 6624bfefb0
commit 0c829c88c5
86 changed files with 171 additions and 169 deletions

View File

@@ -17,7 +17,6 @@
<span class="text-split__line" aria-hidden={index === 1}> <span class="text-split__line" aria-hidden={index === 1}>
{#each split as word, i} {#each split as word, i}
<span class="word" style:--i-w={i}>{word}</span>{#if word.includes('\n')}<br>{/if} <span class="word" style:--i-w={i}>{word}</span>{#if word.includes('\n')}<br>{/if}
<!-- svelte-ignore empty-block -->
{#if i < split.length - 1}{/if} {#if i < split.length - 1}{/if}
{/each} {/each}
</span> </span>

View File

@@ -45,7 +45,6 @@
href={url} class={classes} href={url} class={classes}
{target} {rel} {target} {rel}
data-sveltekit-noscroll={isExternal || isProtocol ? 'off' : ''} data-sveltekit-noscroll={isExternal || isProtocol ? 'off' : ''}
{disabled}
tabindex="0" tabindex="0"
on:click on:click
> >

View File

@@ -10,7 +10,7 @@
export let ratio: number = undefined export let ratio: number = undefined
export let alt: string export let alt: string
export let lazy = true export let lazy = true
export let decoding: "auto" | "sync" | "async" = "auto" export let decoding: 'auto' | 'sync' | 'async' = 'auto'
interface Sizes { interface Sizes {
small?: { width?: number, height?: number } small?: { width?: number, height?: number }
@@ -50,16 +50,16 @@
$: imgSrc = id ? getAssetUrlKey(id, `${sizeKey}-small-jpg`) : src ? src : undefined $: imgSrc = id ? getAssetUrlKey(id, `${sizeKey}-small-jpg`) : src ? src : undefined
$: srcSet = { $: srcSet = {
// WebP // WebP
webp: webp: sizes
sizes ? [ ? [
`${getAssetUrlKey(id, `${sizeKey}-small-webp`)} 345w`, `${getAssetUrlKey(id, `${sizeKey}-small-webp`)} 345w`,
sizes.medium ? `${getAssetUrlKey(id, `${sizeKey}-medium-webp`)} 768w` : null, sizes.medium ? `${getAssetUrlKey(id, `${sizeKey}-medium-webp`)} 768w` : null,
sizes.large ? `${getAssetUrlKey(id, `${sizeKey}-large-webp`)} 1280w` : null, sizes.large ? `${getAssetUrlKey(id, `${sizeKey}-large-webp`)} 1280w` : null,
] ]
: [getAssetUrlKey(id, `${sizeKey}-webp`)], : [getAssetUrlKey(id, `${sizeKey}-webp`)],
// JPG // JPG
jpg: jpg: sizes
sizes ? [ ? [
`${getAssetUrlKey(id, `${sizeKey}-small-jpg`)} 345w`, `${getAssetUrlKey(id, `${sizeKey}-small-jpg`)} 345w`,
sizes.medium ? `${getAssetUrlKey(id, `${sizeKey}-medium-jpg`)} 768w` : null, sizes.medium ? `${getAssetUrlKey(id, `${sizeKey}-medium-jpg`)} 768w` : null,
sizes.large ? `${getAssetUrlKey(id, `${sizeKey}-large-jpg`)} 1280w` : null, sizes.large ? `${getAssetUrlKey(id, `${sizeKey}-large-jpg`)} 1280w` : null,

View File

@@ -31,7 +31,7 @@
// Detect if location has new content // Detect if location has new content
const seenLocationDate = dayjs(parsedSeenLocations[location.id]) const seenLocationDate = dayjs(parsedSeenLocations[location.id])
const isLocationSeen = parsedSeenLocations?.hasOwnProperty(location.id) const isLocationSeen = location.id in parsedSeenLocations
// Define if location is has new photos // Define if location is has new photos
if (seenLocationDate && isLocationSeen) { if (seenLocationDate && isLocationSeen) {

View File

@@ -19,8 +19,9 @@
</script> </script>
<div class="notification-cart shadow-small" <div class="notification-cart shadow-small"
on:click={closeNotification}
transition:fly={{ y: 20, duration: 700, easing: quartOut }} transition:fly={{ y: 20, duration: 700, easing: quartOut }}
on:click={closeNotification}
on:keydown
> >
<div class="notification-cart__left"> <div class="notification-cart__left">
<img src={image} width={58} height={88} alt={title}> <img src={image} width={58} height={88} alt={title}>

View File

@@ -36,7 +36,7 @@
alt={image.title} alt={image.title}
/> />
{:else if video && video.mp4 && video.webm} {:else if video && video.mp4 && video.webm}
<video muted loop playsinline autoplay allow="autoplay"> <video muted loop playsinline autoplay>
<source type="video/mp4" src={getAssetUrlKey(video.mp4, 'step')} /> <source type="video/mp4" src={getAssetUrlKey(video.mp4, 'step')} />
<source type="video/webm" src={getAssetUrlKey(video.webm, 'step')} /> <source type="video/webm" src={getAssetUrlKey(video.webm, 'step')} />
<track kind="captions" /> <track kind="captions" />

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte'
interface Option { interface Option {
value: string value: string

View File

@@ -10,12 +10,12 @@
import { smoothScroll } from '$utils/stores' import { smoothScroll } from '$utils/stores'
import { cartOpen, cartData, cartAmount, cartIsUpdating } from '$utils/stores/shop' import { cartOpen, cartData, cartAmount, cartIsUpdating } from '$utils/stores/shop'
import { initSwell, getCart, updateCartItem, removeCartItem } from '$utils/functions/shop' import { initSwell, getCart, updateCartItem, removeCartItem } from '$utils/functions/shop'
import { sendEvent } from '$utils/analytics'
// Components // Components
import Button from '$components/atoms/Button.svelte' import Button from '$components/atoms/Button.svelte'
import Icon from '$components/atoms/Icon.svelte' import Icon from '$components/atoms/Icon.svelte'
import CartItem from '$components/molecules/CartItem.svelte' import CartItem from '$components/molecules/CartItem.svelte'
import ShopLocationSwitcher from '$components/molecules/ShopLocationSwitcher.svelte' import ShopLocationSwitcher from '$components/molecules/ShopLocationSwitcher.svelte'
import { sendEvent } from '$utils/analytics';
// Block scroll if cart is open // Block scroll if cart is open
@@ -151,5 +151,6 @@
<div class="cart-overlay" <div class="cart-overlay"
transition:fade={{ duration: 600, easing: quartOut }} transition:fade={{ duration: 600, easing: quartOut }}
on:click={handleCloseCart} on:click={handleCloseCart}
on:keydown
/> />
{/if} {/if}

View File

@@ -15,7 +15,7 @@
}, },
500: { 500: {
title: 'Server error', title: 'Server error',
message: "That is embarassing, the problem is on our side.", message: 'That is embarassing, the problem is on our side.',
}, },
} }
</script> </script>

View File

@@ -73,7 +73,7 @@ export const load = (async ({ params, setHeaders }) => {
const { data: { location: location, photos, total_published, product } } = res const { data: { location: location, photos, total_published, product } } = res
if (!location.length || location.length && params.country !== location[0].country.slug) { if (!location.length || location.length && params.country !== location[0].country.slug) {
throw error(404, "This location is not available… yet!") throw error(404, 'This location is not available… yet!')
} }
setHeaders({ 'Cache-Control': 'public, max-age=1, stale-while-revalidate=604799' }) setHeaders({ 'Cache-Control': 'public, max-age=1, stale-while-revalidate=604799' })

View File

@@ -219,7 +219,6 @@
/> />
<PageTransition> <PageTransition>
<main class="location-page"> <main class="location-page">
<section class="location-page__intro grid" bind:this={introEl}> <section class="location-page__intro grid" bind:this={introEl}>
@@ -302,7 +301,7 @@
location={location.name} location={location.name}
ratio={width / height} ratio={width / height}
date={date_taken} date={date_taken}
index={(totalPhotos - index < 10) ? '0' : ''}{totalPhotos - index} index="{(totalPhotos - index < 10) ? '0' : ''}{totalPhotos - index}"
/> />
{/each} {/each}
</section> </section>
@@ -312,7 +311,7 @@
ended={ended} ended={ended}
current={currentPhotosAmount} current={currentPhotosAmount}
total={totalPhotos} total={totalPhotos}
on:click={!ended && loadMorePhotos} on:click={() => !ended && loadMorePhotos()}
> >
{#if !ended} {#if !ended}
<p class="more">See more photos</p> <p class="more">See more photos</p>

View File

@@ -93,10 +93,10 @@
const handleKeydown = ({ key, defaultPrevented }: KeyboardEvent) => { const handleKeydown = ({ key, defaultPrevented }: KeyboardEvent) => {
if (defaultPrevented) return if (defaultPrevented) return
switch (key) { switch (key) {
case 'ArrowLeft': goToPrevious(); break; case 'ArrowLeft': goToPrevious(); break
case 'ArrowRight': goToNext(); break; case 'ArrowRight': goToNext(); break
case 'Escape': closeViewer(); break; case 'Escape': closeViewer(); break
default: return; default: return
} }
} }
@@ -105,15 +105,15 @@
// Swipe up and down on mobile/small screens // Swipe up and down on mobile/small screens
if (innerWidth < 992) { if (innerWidth < 992) {
switch (detail) { switch (detail) {
case '-y': goToNext(); break; case '-y': goToNext(); break
case 'y': goToPrevious(); break; case 'y': goToPrevious(); break
} }
} }
// Swipe left and right on larger screens // Swipe left and right on larger screens
else { else {
switch (detail) { switch (detail) {
case '-x': goToNext(); break; case '-x': goToNext(); break
case 'x': goToPrevious(); break; case 'x': goToPrevious(); break
} }
} }
} }
@@ -320,7 +320,11 @@
</ButtonCircle> </ButtonCircle>
<div class="photo-page__carousel"> <div class="photo-page__carousel">
<div class="photo-page__images" use:swipe on:swipe={handleSwipe} on:tap={toggleFullscreen}> <div class="photo-page__images"
use:swipe
on:swipe={handleSwipe}
on:tap={toggleFullscreen}
>
{#each visiblePhotos as { id, image, title }, index (id)} {#each visiblePhotos as { id, image, title }, index (id)}
<div class="photo-page__picture is-{currentIndex === 0 ? index + 1 : index}"> <div class="photo-page__picture is-{currentIndex === 0 ? index + 1 : index}">
<Image <Image
@@ -377,7 +381,8 @@
</div> </div>
{#if isFullscreen} {#if isFullscreen}
<div class="photo-page__fullscreen" bind:this={fullscreenEl} on:click={toggleFullscreen} <div class="photo-page__fullscreen" bind:this={fullscreenEl}
on:click={toggleFullscreen} on:keydown
in:fade={{ easing: quartOut, duration: 1000 }} in:fade={{ easing: quartOut, duration: 1000 }}
out:fade={{ easing: quartOut, duration: 1000, delay: 300 }} out:fade={{ easing: quartOut, duration: 1000, delay: 300 }}
> >

View File

@@ -3,7 +3,7 @@
</style> </style>
<script lang="ts"> <script lang="ts">
import { navigating, page } from '$app/stores' import { navigating } from '$app/stores'
import { onMount, afterUpdate } from 'svelte' import { onMount, afterUpdate } from 'svelte'
import { quartOut as quartOutSvelte } from 'svelte/easing' import { quartOut as quartOutSvelte } from 'svelte/easing'
import { fade, fly } from 'svelte/transition' import { fade, fly } from 'svelte/transition'
@@ -12,6 +12,7 @@
import { mailtoClipboard, map } from '$utils/functions' import { mailtoClipboard, map } from '$utils/functions'
import { getAssetUrlKey } from '$utils/api' import { getAssetUrlKey } from '$utils/api'
import { DELAY } from '$utils/constants' import { DELAY } from '$utils/constants'
import { sendEvent } from '$utils/analytics'
import { quartOut } from '$animations/easings' import { quartOut } from '$animations/easings'
// Components // Components
import Metas from '$components/Metas.svelte' import Metas from '$components/Metas.svelte'
@@ -21,7 +22,6 @@
import AboutGridPhoto from '$components/atoms/AboutGridPhoto.svelte' import AboutGridPhoto from '$components/atoms/AboutGridPhoto.svelte'
import ProcessStep from '$components/molecules/ProcessStep.svelte' import ProcessStep from '$components/molecules/ProcessStep.svelte'
import Banner from '$components/organisms/Banner.svelte' import Banner from '$components/organisms/Banner.svelte'
import { sendEvent } from '$utils/analytics';
export let data: PageData export let data: PageData
const { about, photos } = data const { about, photos } = data
@@ -223,7 +223,7 @@
{about.intro_firstphoto_caption}<br> {about.intro_firstphoto_caption}<br>
in in
<a href="/{about.intro_firstlocation.country.slug}/{about.intro_firstlocation.slug}" data-sveltekit-noscroll> <a href="/{about.intro_firstlocation.country.slug}/{about.intro_firstlocation.slug}" data-sveltekit-noscroll>
<img src="{getAssetUrlKey(about.intro_firstlocation.country.flag.id, 'square-small-jpg')}" width="32" height="32" alt="{about.intro_firstlocation.country.flag.title}"> <img src={getAssetUrlKey(about.intro_firstlocation.country.flag.id, 'square-small-jpg')} width="32" height="32" alt={about.intro_firstlocation.country.flag.title}>
<span>Naarm Australia (Melbourne)</span> <span>Naarm Australia (Melbourne)</span>
</a> </a>
</figcaption> </figcaption>

View File

@@ -14,7 +14,7 @@
import Heading from '$components/molecules/Heading.svelte' import Heading from '$components/molecules/Heading.svelte'
const { locations }: any = getContext('global') const { locations }: any = getContext('global')
const text = "Explore the globe to discover unique locations across the world" const text = 'Explore the globe to discover unique locations across the world'
</script> </script>
<Metas <Metas

View File

@@ -15,12 +15,11 @@ const cached = build.concat(files);
.then(cache => cache.addAll(cached)) .then(cache => cache.addAll(cached))
.then(() => { .then(() => {
// if you use typescript: // if you use typescript:
(self as unknown as ServiceWorkerGlobalScope).skipWaiting(); (self as unknown as ServiceWorkerGlobalScope).skipWaiting()
// self.skipWaiting(); // self.skipWaiting();
}) })
); )
} });
);
// self.addEventListener( // self.addEventListener(
// if you use typescript: // if you use typescript:
@@ -38,7 +37,7 @@ const cached = build.concat(files);
(self as unknown as ServiceWorkerGlobalScope).clients.claim() (self as unknown as ServiceWorkerGlobalScope).clients.claim()
// self.clients.claim() // self.clients.claim()
}) })
); )
}) })
@@ -110,5 +109,4 @@ async function fetchAndCache(request: Request) {
return cachedAsset || fetchAndCache(event.request) return cachedAsset || fetchAndCache(event.request)
})() })()
) )
} })
)

View File

@@ -39,7 +39,7 @@ module.exports = {
========================================= */ ========================================= */
// Use spaces over tabs // Use spaces over tabs
'no-tabs': 'error', 'no-tabs': 'error',
indent: ['error', 4], indent: ['error', 4, { SwitchCase: 1 }],
// Use single quote in javascript // Use single quote in javascript
quotes: ['error', 'single', { quotes: ['error', 'single', {
avoidEscape: true, avoidEscape: true,