diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d2f5af4..7182233 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,13 +1,25 @@ module.exports = { - extends: 'standard-with-typescript', parser: '@typescript-eslint/parser', - parserOptions: { // add these parser options - project: ['./tsconfig.json'] + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + extraFileExtensions: ['.svelte'] }, + extends: ['standard-with-typescript'], plugins: [ 'svelte3', '@typescript-eslint' ], + // Disable these rules: import/first, import/no-duplicates, import/no-mutable-exports, import/no-unresolved, import/prefer-default-export + // Reference: https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/OTHER_PLUGINS.md#eslint-plugin-import + rules: { + 'import/first': 'off', + 'import/no-duplicates': 'off', + 'import/no-mutable-exports': 'off', + 'import/no-unresolved': 'off', + 'import/prefer-default-export': 'off', + 'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 2, maxEOF: 0 }] // See: https://github.com/sveltejs/eslint-plugin-svelte3/issues/41 + }, overrides: [ { files: [ diff --git a/src/App.svelte b/src/App.svelte index 20c4a14..5bcf594 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,20 +1,20 @@ diff --git a/src/lib/Chat.svelte b/src/lib/Chat.svelte index 5b356b8..7b35049 100644 --- a/src/lib/Chat.svelte +++ b/src/lib/Chat.svelte @@ -1,12 +1,12 @@ {#each chat.messages as message} - {#if message.role === "user"} + {#if message.role === 'user'} - {:else if message.role === "system" || message.role === "error"} + {:else if message.role === 'system' || message.role === 'error'}
{/if} @@ -473,15 +474,15 @@ rows="1" on:keydown={(e) => { // Only send if Enter is pressed, not Shift+Enter - if (e.key === "Enter" && !e.shiftKey) { - submitForm(); - e.preventDefault(); + if (e.key === 'Enter' && !e.shiftKey) { + submitForm() + e.preventDefault() } }} on:input={(e) => { // Resize the textarea to fit the content - auto is important to reset the height after deleting content - input.style.height = "auto"; - input.style.height = input.scrollHeight + "px"; + input.style.height = 'auto' + input.style.height = input.scrollHeight + 'px' }} bind:this={input} /> @@ -506,8 +507,8 @@