From 8d3b8fd8aa9603f5377f1b37963190ac2c01e9dd Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Fri, 31 Dec 2021 11:38:06 +0100 Subject: npm run format --- web/pw-server/.eslintrc.cjs | 36 ++++----- web/pw-server/.prettierrc | 8 +- web/pw-server/src/app.html | 20 ++--- web/pw-server/src/lib/auth.ts | 6 +- web/pw-server/src/routes/bots/[bot_id].svelte | 4 +- web/pw-server/src/routes/bots/index.svelte | 108 +++++++++++++------------- web/pw-server/src/routes/login.svelte | 56 ++++++------- web/pw-server/src/routes/register.svelte | 54 ++++++------- web/pw-server/svelte.config.js | 77 +++++++++--------- web/pw-server/tsconfig.json | 46 +++++------ 10 files changed, 206 insertions(+), 209 deletions(-) (limited to 'web') diff --git a/web/pw-server/.eslintrc.cjs b/web/pw-server/.eslintrc.cjs index 3ccf435..09dcc6a 100644 --- a/web/pw-server/.eslintrc.cjs +++ b/web/pw-server/.eslintrc.cjs @@ -1,20 +1,20 @@ module.exports = { - root: true, - parser: '@typescript-eslint/parser', - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - plugins: ['svelte3', '@typescript-eslint'], - ignorePatterns: ['*.cjs'], - overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], - settings: { - 'svelte3/typescript': () => require('typescript') - }, - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020 - }, - env: { - browser: true, - es2017: true, - node: true - } + root: true, + parser: "@typescript-eslint/parser", + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], + plugins: ["svelte3", "@typescript-eslint"], + ignorePatterns: ["*.cjs"], + overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }], + settings: { + "svelte3/typescript": () => require("typescript"), + }, + parserOptions: { + sourceType: "module", + ecmaVersion: 2020, + }, + env: { + browser: true, + es2017: true, + node: true, + }, }; diff --git a/web/pw-server/.prettierrc b/web/pw-server/.prettierrc index cdb1126..8b9522d 100644 --- a/web/pw-server/.prettierrc +++ b/web/pw-server/.prettierrc @@ -1,6 +1,6 @@ { - "useTabs": false, - "singleQuote": false, - "trailingComma": "es5", - "printWidth": 100 + "useTabs": false, + "singleQuote": false, + "trailingComma": "es5", + "printWidth": 100 } diff --git a/web/pw-server/src/app.html b/web/pw-server/src/app.html index 9c8080f..32f9591 100644 --- a/web/pw-server/src/app.html +++ b/web/pw-server/src/app.html @@ -1,13 +1,13 @@ - - - - - - %svelte.head% - - -
%svelte.body%
- + + + + + + %svelte.head% + + +
%svelte.body%
+ diff --git a/web/pw-server/src/lib/auth.ts b/web/pw-server/src/lib/auth.ts index 436ec66..3f77c58 100644 --- a/web/pw-server/src/lib/auth.ts +++ b/web/pw-server/src/lib/auth.ts @@ -1,7 +1,7 @@ export function set_session_token(token: string) { - window.localStorage.setItem('session', token); + window.localStorage.setItem("session", token); } export function get_session_token(): string | null { - return window.localStorage.getItem('session'); -} \ No newline at end of file + return window.localStorage.getItem("session"); +} diff --git a/web/pw-server/src/routes/bots/[bot_id].svelte b/web/pw-server/src/routes/bots/[bot_id].svelte index 2556d73..955f1c6 100644 --- a/web/pw-server/src/routes/bots/[bot_id].svelte +++ b/web/pw-server/src/routes/bots/[bot_id].svelte @@ -1,6 +1,6 @@
- - - + + +
diff --git a/web/pw-server/src/routes/login.svelte b/web/pw-server/src/routes/login.svelte index 197238e..09b1834 100644 --- a/web/pw-server/src/routes/login.svelte +++ b/web/pw-server/src/routes/login.svelte @@ -1,46 +1,46 @@ {#if loggedIn()} - you are logged in + you are logged in {/if}
- - - - - + + + + +
diff --git a/web/pw-server/src/routes/register.svelte b/web/pw-server/src/routes/register.svelte index a21cf65..6344399 100644 --- a/web/pw-server/src/routes/register.svelte +++ b/web/pw-server/src/routes/register.svelte @@ -1,38 +1,38 @@

Register

- - - - - + + + + +
diff --git a/web/pw-server/svelte.config.js b/web/pw-server/svelte.config.js index 14e6a05..0c0c40c 100644 --- a/web/pw-server/svelte.config.js +++ b/web/pw-server/svelte.config.js @@ -1,49 +1,46 @@ -import adapter from '@sveltejs/adapter-auto'; -import preprocess from 'svelte-preprocess'; +import adapter from "@sveltejs/adapter-auto"; +import preprocess from "svelte-preprocess"; // import { svelte } from '@sveltejs/vite-plugin-svelte' -import { viteCommonjs } from '@originjs/vite-plugin-commonjs' -import wasmPack from 'vite-plugin-wasm-pack'; - +import { viteCommonjs } from "@originjs/vite-plugin-commonjs"; +import wasmPack from "vite-plugin-wasm-pack"; /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors - preprocess: preprocess(), - - kit: { - adapter: adapter(), + // Consult https://github.com/sveltejs/svelte-preprocess + // for more information about preprocessors + preprocess: preprocess(), - // hydrate the
element in src/app.html - target: '#svelte', - ssr: false, - vite: { - plugins: [ - // svelte(), - // wasmPack([], ["planetwars-rs"]), - viteCommonjs({ - transformMixedEsModules: true, - }), - ], - build: { - commonjsOptions: { - transformMixedEsModules: true, - }, - }, - server: { - proxy: { - "/api/": "http://localhost:9000", - "/ws": "ws://localhost:9000/ws", - }, - fs: { - // Allow serving files from one level up to the project root - allow: ['..'] - } - }, - } - - }, + kit: { + adapter: adapter(), + // hydrate the
element in src/app.html + target: "#svelte", + ssr: false, + vite: { + plugins: [ + // svelte(), + // wasmPack([], ["planetwars-rs"]), + viteCommonjs({ + transformMixedEsModules: true, + }), + ], + build: { + commonjsOptions: { + transformMixedEsModules: true, + }, + }, + server: { + proxy: { + "/api/": "http://localhost:9000", + "/ws": "ws://localhost:9000/ws", + }, + fs: { + // Allow serving files from one level up to the project root + allow: [".."], + }, + }, + }, + }, }; export default config; diff --git a/web/pw-server/tsconfig.json b/web/pw-server/tsconfig.json index 0555d52..b74bddb 100644 --- a/web/pw-server/tsconfig.json +++ b/web/pw-server/tsconfig.json @@ -1,31 +1,31 @@ { - "compilerOptions": { - "moduleResolution": "node", - "module": "es2020", - "lib": ["es2020", "DOM"], - "target": "es2020", - /** + "compilerOptions": { + "moduleResolution": "node", + "module": "es2020", + "lib": ["es2020", "DOM"], + "target": "es2020", + /** 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", - "isolatedModules": true, - "resolveJsonModule": true, - /** + "importsNotUsedAsValues": "error", + "isolatedModules": true, + "resolveJsonModule": true, + /** To have warnings/errors of the Svelte compiler at the correct position, enable source maps by default. */ - "sourceMap": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "baseUrl": ".", - "allowJs": true, - "checkJs": true, - "paths": { - "$lib": ["src/lib"], - "$lib/*": ["src/lib/*"] - } - }, - "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"] + "sourceMap": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "baseUrl": ".", + "allowJs": true, + "checkJs": true, + "paths": { + "$lib": ["src/lib"], + "$lib/*": ["src/lib/*"] + } + }, + "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"] } -- cgit v1.2.3