This repository has been archived by the owner on May 7, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
312 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
root: true | ||
env: | ||
browser: true | ||
es2020: true | ||
node: true | ||
extends: | ||
- eslint:recommended | ||
parser: '@typescript-eslint/parser' | ||
parserOptions: | ||
sourceType: module | ||
ecmaVersion: 2020 | ||
plugins: [svelte3] | ||
plugins: [svelte3, '@typescript-eslint'] | ||
extends: | ||
- eslint:recommended | ||
- plugin:@typescript-eslint/recommended | ||
overrides: | ||
- files: ['*.svelte'] | ||
processor: svelte3/svelte3 | ||
settings: | ||
svelte3/typescript: true | ||
rules: | ||
indent: [error, 2, SwitchCase: 1] | ||
quotes: [error, backtick, avoidEscape: true] | ||
semi: [error, never] | ||
linebreak-style: [error, unix] | ||
no-console: [error, allow: [warn, error]] | ||
no-var: error | ||
spaced-comment: [error, always] | ||
# allow triple slash for typescript file referencing https://git.io/JCeqO | ||
spaced-comment: [error, always, { markers: [/] }] | ||
globals: | ||
$$props: false # declare the Svelte $$props object as a non-writable global variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="@sveltejs/kit" /> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// https://kit.svelte.dev/docs#hooks-getsession | ||
export function getSession(): Record<string, string> { | ||
const keys = [`ALGOLIA_APP_ID`, `ALGOLIA_SEARCH_KEY`] | ||
|
||
for (const key of keys) { | ||
if (!process.env[key]) { | ||
// eslint-disable-next-line no-console | ||
console.error(`missing secret key: ${key}`) | ||
} | ||
} | ||
|
||
const session = Object.fromEntries(keys.map((key) => [key, process.env[key] as string])) | ||
|
||
return session | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function onClickOutside( | ||
node: HTMLElement, | ||
cb?: () => void | ||
): { destroy(): void } { | ||
const dispatchOnClickOutside = (event: Event) => { | ||
const clickWasOutside = node && !node.contains(event.target as Node) | ||
|
||
if (clickWasOutside && !event.defaultPrevented) { | ||
node.dispatchEvent(new CustomEvent(`clickOutside`)) | ||
if (cb) cb() | ||
} | ||
} | ||
|
||
document.addEventListener(`click`, dispatchOnClickOutside) | ||
|
||
return { | ||
destroy() { | ||
document.removeEventListener(`click`, dispatchOnClickOutside) | ||
}, | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"module": "es2020", | ||
"target": "es2020", | ||
"moduleResolution": "node", // needed for import { ... } from 'svelte' in TS files | ||
|
||
// Svelte Preprocess cannot figure out whether you have a value or a type, so tell TypeScript | ||
// to enforce using `import type` instead of `import` for Types. | ||
"importsNotUsedAsValues": "error", | ||
|
||
// To have warnings/errors of the Svelte compiler at the correct position, | ||
// enable source maps by default. | ||
"sourceMap": true, | ||
|
||
"forceConsistentCasingInFileNames": true | ||
} | ||
} |
Oops, something went wrong.