From dc2bdbe6a4c498dc31e7a168c9a405f66abc40f7 Mon Sep 17 00:00:00 2001 From: Markus Ahlstrand Date: Fri, 20 Dec 2024 09:39:49 +0100 Subject: [PATCH] fix: formatting --- .eslintrc.json | 23 +++++++++++++++++++++++ package.json | 2 ++ src/controllers/email.ts | 30 +++++++++++++++--------------- yarn.lock | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..6f61eb852 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,23 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint", "prettier"], + "rules": { + "prettier/prettier": "error", + "@typescript-eslint/no-unused-vars": "warn", + "no-console": "warn" + } +} diff --git a/package.json b/package.json index 85f4e2d44..03c319e3c 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,8 @@ "classnames": "^2.5.1", "dotenv": "16.4.7", "eslint": "9.17.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.2", "husky": "9.1.7", "i18next": "24.1.2", diff --git a/src/controllers/email.ts b/src/controllers/email.ts index f68f1e117..d748a0d44 100644 --- a/src/controllers/email.ts +++ b/src/controllers/email.ts @@ -21,14 +21,14 @@ export async function sendCode( ctx: Context<{ Bindings: Env; Variables: Var }>, client: Client, to: string, - code: string + code: string, ) { const { env } = ctx; const logo = getClientLogoPngGreyBg( client.tenant.logo || "https://assets.sesamy.com/static/images/sesamy/logo-translucent.png", - env.IMAGE_PROXY_URL + env.IMAGE_PROXY_URL, ); const sendCodeUniversalTemplate = engine.parse(codeV2); @@ -85,7 +85,7 @@ export async function sendLink( client: Client, to: string, code: string, - authParams: AuthParams + authParams: AuthParams, ) { const { env } = ctx; @@ -99,7 +99,7 @@ export async function sendLink( const logo = getClientLogoPngGreyBg( client.tenant.logo || "https://assets.sesamy.com/static/images/sesamy/logo-translucent.png", - env.IMAGE_PROXY_URL + env.IMAGE_PROXY_URL, ); const sendCodeUniversalTemplate = engine.parse(linkV2); @@ -159,12 +159,12 @@ export async function sendResetPassword( to: string, // auth0 just has a ticket, but we have a code and a state code: string, - state: string + state: string, ) { const logo = getClientLogoPngGreyBg( client.tenant.logo || "https://assets.sesamy.com/static/images/sesamy/logo-translucent.png", - env.IMAGE_PROXY_URL + env.IMAGE_PROXY_URL, ); // the auth0 link looks like this: https://auth.sesamy.dev/u/reset-verify?ticket={ticket}# @@ -186,7 +186,7 @@ export async function sendResetPassword( passwordResetTitle: t("password_reset_title", options), resetPasswordEmailClickToReset: t( "reset_password_email_click_to_reset", - options + options, ), resetPasswordEmailReset: t("reset_password_email_reset", options), supportInfo: t("support_info", options), @@ -196,7 +196,7 @@ export async function sendResetPassword( const passwordResetBody = await engine.render( sendPasswordResetUniversalTemplate, - data + data, ); await env.sendEmail(env, client, { @@ -222,12 +222,12 @@ export async function sendValidateEmailAddress( client: Client, to: string, code: string, - state: string + state: string, ) { const logo = getClientLogoPngGreyBg( client.tenant.logo || "https://assets.sesamy.com/static/images/sesamy/logo-translucent.png", - env.IMAGE_PROXY_URL + env.IMAGE_PROXY_URL, ); const sendEmailValidationUniversalTemplate = engine.parse(verifyEmail); @@ -254,7 +254,7 @@ export async function sendValidateEmailAddress( const emailValidationBody = await engine.render( sendEmailValidationUniversalTemplate, - data + data, ); await env.sendEmail(env, client, { @@ -280,19 +280,19 @@ export async function sendSignupValidateEmailAddress( client: Client, to: string, code: string, - state: string + state: string, ) { const logo = getClientLogoPngGreyBg( client.tenant.logo || "https://assets.sesamy.com/static/images/sesamy/logo-translucent.png", - env.IMAGE_PROXY_URL + env.IMAGE_PROXY_URL, ); // we have not checked the route name that auth0 uses const signupUrl = `${env.ISSUER}u/signup?state=${state}&code=${code}`; const sendEmailValidationUniversalTemplate = engine.parse( - preSignupVerification + preSignupVerification, ); const options = { @@ -316,7 +316,7 @@ export async function sendSignupValidateEmailAddress( const emailValidationBody = await engine.render( sendEmailValidationUniversalTemplate, - data + data, ); await env.sendEmail(env, client, { diff --git a/yarn.lock b/yarn.lock index 30aa5d7d6..8e420a496 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1302,6 +1302,11 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@planetscale/database@1.19.0": version "1.19.0" resolved "https://registry.yarnpkg.com/@planetscale/database/-/database-1.19.0.tgz#67aeb66dd67fa7f9235e7d7447e9de34e438e2da" @@ -3389,6 +3394,19 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +eslint-config-prettier@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + +eslint-plugin-prettier@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95" + integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.9.1" + eslint-plugin-react@^7.37.2: version "7.37.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.37.2.tgz#cd0935987876ba2900df2f58339f6d92305acc7a" @@ -3600,6 +3618,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -6677,6 +6700,13 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + prettier-plugin-tailwindcss@0.6.9: version "0.6.9" resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.9.tgz#db84c32918eae9b44e5a5f0aa4d1249cc39fa739" @@ -7687,6 +7717,14 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +synckit@^0.9.1: + version "0.9.2" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" + integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + tailwindcss@3.4.16: version "3.4.16" resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.16.tgz#35a7c3030844d6000fc271878db4096b6a8d2ec9"