From 6d20f6e09bbe9dc848a560cb885f083dd70e4cd6 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Wed, 12 Jan 2022 17:04:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20some=20lint=20/=20formatte?= =?UTF-8?q?r=20errors,=20ESLint=20plugin=20Svelte3=20still=20not=20working?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/package.json | 2 +- app/yarn.lock | 6 ------ src/auth.ts | 4 ++-- src/providers/base.ts | 2 +- src/providers/oauth2.base.ts | 6 ++++-- src/providers/oauth2.ts | 2 +- src/providers/twitter.ts | 2 +- 8 files changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0986a12..74acad7 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ SvelteKitAuth also comes with first-class support for Typescript out of the box, SvelteKitAuth is very easy to setup! All you need to do is instantiate the `SvelteKitAuth` class, and configure it with some default providers, as well as a JWT secret key used to verify the cookies: -_**Warning**: env variables prefixed with `VITE_` can be exposed and leaked into client-side bundles if they are referenced in any client-side code. Make sure this is not the case, or consider using an alternative method such as loading them via dotenv directly instead._ +_**Warning**: env variables prefixed with `VITE_` can be exposed and leaked into client-side bundles if they are referenced in any client-side code. Make sure this is not the case, or consider using an alternative method such as loading them via dotenv directly instead.\_ ```ts export const appAuth = new SvelteKitAuth({ diff --git a/app/package.json b/app/package.json index 4659d25..f5c792f 100644 --- a/app/package.json +++ b/app/package.json @@ -5,7 +5,7 @@ "dev": "svelte-kit dev", "build": "svelte-kit build", "preview": "svelte-kit preview", - "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .", + "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore --config .eslintrc.cjs .", "format": "prettier --write --plugin-search-dir=. ." }, "devDependencies": { diff --git a/app/yarn.lock b/app/yarn.lock index dfa041d..6665d82 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -3441,12 +3441,6 @@ simple-swizzle@^0.2.2: cookie "^0.4.1" jsonwebtoken "^8.5.1" -"sk-auth@file:../": - version "0.3.7" - dependencies: - cookie "^0.4.1" - jsonwebtoken "^8.5.1" - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" diff --git a/src/auth.ts b/src/auth.ts index 64e49fa..fe1fd58 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,7 +1,7 @@ import type { GetSession, RequestHandler } from "@sveltejs/kit"; import type { EndpointOutput } from "@sveltejs/kit/types/endpoint"; -import { RequestHeaders } from '@sveltejs/kit/types/helper'; -import { ServerRequest } from '@sveltejs/kit/types/hooks'; +import { RequestHeaders } from "@sveltejs/kit/types/helper"; +import { ServerRequest } from "@sveltejs/kit/types/hooks"; import cookie from "cookie"; import * as jsonwebtoken from "jsonwebtoken"; import type { JWT, Session } from "./interfaces"; diff --git a/src/providers/base.ts b/src/providers/base.ts index b1b52f3..f678d36 100644 --- a/src/providers/base.ts +++ b/src/providers/base.ts @@ -1,5 +1,5 @@ import type { EndpointOutput } from "@sveltejs/kit"; -import { ServerRequest } from '@sveltejs/kit/types/hooks'; +import { ServerRequest } from "@sveltejs/kit/types/hooks"; import type { Auth } from "../auth"; import type { CallbackResult } from "../types"; diff --git a/src/providers/oauth2.base.ts b/src/providers/oauth2.base.ts index 9f7ee93..5f94029 100644 --- a/src/providers/oauth2.base.ts +++ b/src/providers/oauth2.base.ts @@ -1,5 +1,5 @@ import type { EndpointOutput } from "@sveltejs/kit/types/endpoint"; -import { ServerRequest } from '@sveltejs/kit/types/hooks'; +import { ServerRequest } from "@sveltejs/kit/types/hooks"; import type { Auth } from "../auth"; import type { CallbackResult } from "../types"; import { Provider, ProviderConfig } from "./base"; @@ -35,7 +35,9 @@ export abstract class OAuth2BaseProvider< async signin(request: ServerRequest, auth: Auth): Promise { const { method, url } = request; - const state = [`redirect=${url.searchParams.get("redirect") ?? this.getUri(auth, "/", url.host)}`].join(","); + const state = [ + `redirect=${url.searchParams.get("redirect") ?? this.getUri(auth, "/", url.host)}`, + ].join(","); const base64State = Buffer.from(state).toString("base64"); const nonce = Math.round(Math.random() * 1000).toString(); // TODO: Generate random based on user values const authUrl = await this.getAuthorizationUrl(request, auth, base64State, nonce); diff --git a/src/providers/oauth2.ts b/src/providers/oauth2.ts index 7062e50..2ff400b 100644 --- a/src/providers/oauth2.ts +++ b/src/providers/oauth2.ts @@ -1,4 +1,4 @@ -import { ServerRequest } from '@sveltejs/kit/types/hooks'; +import { ServerRequest } from "@sveltejs/kit/types/hooks"; import type { Auth } from "../auth"; import { ucFirst } from "../helpers"; import { OAuth2BaseProvider, OAuth2BaseProviderConfig, OAuth2Tokens } from "./oauth2.base"; diff --git a/src/providers/twitter.ts b/src/providers/twitter.ts index b7574e2..9649e83 100644 --- a/src/providers/twitter.ts +++ b/src/providers/twitter.ts @@ -1,4 +1,4 @@ -import { ServerRequest } from '@sveltejs/kit/types/hooks'; +import { ServerRequest } from "@sveltejs/kit/types/hooks"; import type { Auth } from "../auth"; import type { CallbackResult } from "../types"; import { OAuth2BaseProvider, OAuth2BaseProviderConfig } from "./oauth2.base";