Add custom prettierrc

This commit is contained in:
Melon 2022-10-30 16:58:12 +00:00
parent fd2252bdad
commit 99c2ae6e33
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
11 changed files with 46 additions and 33 deletions

13
.prettierrc Normal file
View File

@ -0,0 +1,13 @@
{
"printWidth": 150,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"requirePragma": false,
"insertPragma": false
}

View File

@ -1,4 +1,4 @@
import { loginStore, type LoginStore } from "../stores/login"; import {loginStore, type LoginStore} from "../stores/login";
export function URL() { export function URL() {
return import.meta.env.VITE_API_URL; return import.meta.env.VITE_API_URL;
@ -20,7 +20,7 @@ export async function sendSessionRequest(path: string, opt: RequestInit) {
// Create jwt refresh request // Create jwt refresh request
let refHead = new Headers(); let refHead = new Headers();
setLoginHeaders(headers, true); setLoginHeaders(headers, true);
let y = await sendApiRequest("/v1/marigold/auth/refresh", { method: "POST", headers: refHead }); let y = await sendApiRequest("/v1/marigold/auth/refresh", {method: "POST", headers: refHead});
// Success // Success
if (y.status === 200) { if (y.status === 200) {

View File

@ -1,4 +1,4 @@
import { sendSessionRequest } from "./api"; import {sendSessionRequest} from "./api";
export async function postLogin(data: object, token?: string) { export async function postLogin(data: object, token?: string) {
let headers = new Headers(); let headers = new Headers();
@ -6,12 +6,12 @@ export async function postLogin(data: object, token?: string) {
headers.set("Content-Type", "application/json"); headers.set("Content-Type", "application/json");
if (token !== undefined) headers.set("Authorization", "Bearer " + token); if (token !== undefined) headers.set("Authorization", "Bearer " + token);
let z = await sendSessionRequest("/v1/marigold/auth/login", { method: "POST", headers, body: JSON.stringify(data) }); let z = await sendSessionRequest("/v1/marigold/auth/login", {method: "POST", headers, body: JSON.stringify(data)});
return await z.json(); return await z.json();
} }
export async function getUser(id: string | number) { export async function getUser(id: string | number) {
let z = await sendSessionRequest("/v1/marigold/user/" + id, { method: "GET" }); let z = await sendSessionRequest("/v1/marigold/user/" + id, {method: "GET"});
if (z.status != 200) throw new Error("Request failed"); if (z.status != 200) throw new Error("Request failed");
return await z.json(); return await z.json();
} }

View File

@ -1,13 +1,13 @@
import { sendApiRequest, sendSessionRequest } from "./api"; import {sendApiRequest, sendSessionRequest} from "./api";
export async function getOAuthApp(id: string) { export async function getOAuthApp(id: string) {
let z = await sendSessionRequest("/v1/marigold/app/" + id, { method: "GET" }); let z = await sendSessionRequest("/v1/marigold/app/" + id, {method: "GET"});
if (z.status != 200) throw new Error("Request failed"); if (z.status != 200) throw new Error("Request failed");
return await z.json(); return await z.json();
} }
export async function getOAuthScopes() { export async function getOAuthScopes() {
let z = await sendApiRequest("/v1/marigold/scopes", { method: "GET" }); let z = await sendApiRequest("/v1/marigold/scopes", {method: "GET"});
if (z.status != 200) throw new Error("Request failed"); if (z.status != 200) throw new Error("Request failed");
return await z.json(); return await z.json();
} }

View File

@ -1,13 +1,13 @@
/* fallback */ /* fallback */
@font-face { @font-face {
font-family: 'Material Symbols Outlined'; font-family: "Material Symbols Outlined";
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url(~/assets/material-symbols.woff2) format('woff2'); src: url(~/assets/material-symbols.woff2) format("woff2");
} }
@mixin mso { @mixin mso {
font-family: 'Material Symbols Outlined'; font-family: "Material Symbols Outlined";
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
font-size: 24px; font-size: 24px;
@ -18,6 +18,6 @@
white-space: nowrap; white-space: nowrap;
word-wrap: normal; word-wrap: normal;
direction: ltr; direction: ltr;
-moz-font-feature-settings: 'liga'; -moz-font-feature-settings: "liga";
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }

View File

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

View File

@ -1,4 +1,4 @@
import { writable } from "svelte/store"; import {writable} from "svelte/store";
export interface LoginStore { export interface LoginStore {
access: string; access: string;
@ -12,7 +12,7 @@ export const loginStore = writable<LoginStore>(
} catch (_) { } catch (_) {
return null; return null;
} }
})() })(),
); );
loginStore.subscribe((value) => localStorage.setItem("login-session", JSON.stringify(value))); loginStore.subscribe(value => localStorage.setItem("login-session", JSON.stringify(value)));

View File

@ -1,7 +1,7 @@
import sveltePreprocess from 'svelte-preprocess' import sveltePreprocess from "svelte-preprocess";
export default { export default {
// Consult https://github.com/sveltejs/svelte-preprocess // Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors // for more information about preprocessors
preprocess: sveltePreprocess() preprocess: sveltePreprocess(),
} };

View File

@ -6,7 +6,7 @@
"module": "ESNext", "module": "ESNext",
"resolveJsonModule": true, "resolveJsonModule": true,
"baseUrl": "./src", "baseUrl": "./src",
"paths": { "~/*": ["./*"] }, "paths": {"~/*": ["./*"]},
/** /**
* Typecheck JS in `.svelte` and `.js` files by default. * Typecheck JS in `.svelte` and `.js` files by default.
* Disable checkJs if you'd like to use dynamic types in JS. * Disable checkJs if you'd like to use dynamic types in JS.
@ -18,5 +18,5 @@
"isolatedModules": true "isolatedModules": true
}, },
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte", "src/**/*.mjs"], "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte", "src/**/*.mjs"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{"path": "./tsconfig.node.json"}]
} }

View File

@ -1,7 +1,7 @@
import { defineConfig } from "vite"; import {defineConfig} from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte"; import {svelte} from "@sveltejs/vite-plugin-svelte";
import sveltePreprocess from "svelte-preprocess"; import sveltePreprocess from "svelte-preprocess";
import { resolve as pathResolve } from "path"; import {resolve as pathResolve} from "path";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
@ -16,7 +16,7 @@ export default defineConfig({
}), }),
}), }),
], ],
optimizeDeps: { exclude: ["svelte-navigator"] }, optimizeDeps: {exclude: ["svelte-navigator"]},
resolve: { resolve: {
alias: { alias: {
"~": pathResolve(__dirname, "src"), "~": pathResolve(__dirname, "src"),