Fix #36 - added ESlint config with ts-standard + svelte support

This commit is contained in:
Niek van der Maas
2023-03-20 13:42:47 +01:00
parent eef03cd1b6
commit 0d2e3109e8
12 changed files with 2677 additions and 41 deletions

View File

@@ -12,9 +12,9 @@
$: apiKey = $apiKeyStorage;
// Check if the API key is passed in as a "key" query parameter - if so, save it
const urlParams = new URLSearchParams(window.location.search);
const urlParams: URLSearchParams = new URLSearchParams(window.location.search);
if (urlParams.has("key")) {
apiKeyStorage.set(urlParams.get("key")!);
apiKeyStorage.set(urlParams.get("key") as string);
}
</script>

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { addChat, apiKeyStorage } from "./Storage.svelte";
import { apiKeyStorage } from './Storage.svelte'
$: apiKey = $apiKeyStorage;
$: apiKey = $apiKeyStorage
</script>
<article class="message">
@@ -22,7 +22,7 @@
<form
class="field has-addons has-addons-right"
on:submit|preventDefault={(event) => {
apiKeyStorage.set(event.target[0].value);
apiKeyStorage.set(event.target[0].value)
}}
>
<p class="control is-expanded">
@@ -52,7 +52,7 @@
<article class="message is-info">
<div class="message-body">
Select an existing chat on the sidebar, or
<a href={"#/chat/new"}>create a new chat</a>
<a href={'#/chat/new'}>create a new chat</a>
</div>
</article>
{/if}

View File

@@ -1,10 +1,10 @@
<script lang="ts">
import logo from "../assets/logo.svg";
import logo from '../assets/logo.svg'
</script>
<nav class="navbar" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href={"#/"}>
<a class="navbar-item" href={'#/'}>
<img src={logo} alt="ChatGPT-web" width="28" height="28" />
<p class="ml-2 is-size-4 has-text-weight-bold">ChatGPT-web</p>
</a>

View File

@@ -1,8 +1,8 @@
<script lang="ts">
import { addChat } from "./Storage.svelte";
import { addChat } from './Storage.svelte'
import { replace } from 'svelte-spa-router'
// Create the new chat instance then redirect to it
const chatId = addChat();
replace(`/chat/${chatId}`);
const chatId = addChat()
replace(`/chat/${chatId}`)
</script>

View File

@@ -1,8 +1,8 @@
import "./app.scss";
import App from "./App.svelte";
import './app.scss'
import App from './App.svelte'
const app = new App({
target: document.getElementById("app"),
});
target: document.getElementById('app') as HTMLElement
})
export default app;
export default app

View File

@@ -1,12 +1,12 @@
import Home from "./lib/Home.svelte";
import Chat from "./lib/Chat.svelte";
import NewChat from "./lib/NewChat.svelte";
import Home from './lib/Home.svelte'
import Chat from './lib/Chat.svelte'
import NewChat from './lib/NewChat.svelte'
export default {
'/': Home,
'/': Home,
'/chat/new': NewChat,
'/chat/:chatId': Chat,
'/chat/new': NewChat,
'/chat/:chatId': Chat,
'*': Home,
};
'*': Home
}