From 32ec2cf9644c85a557ada91ed505f223563b79a7 Mon Sep 17 00:00:00 2001 From: aumetra Date: Sat, 30 Nov 2024 19:05:20 +0100 Subject: [PATCH] add prettier config --- kitsune/.prettierrc | 11 +++ kitsune/package.json | 1 + kitsune/templates/base.html | 4 +- kitsune/templates/oauth/consent.html | 107 ++++++++++++++------------- kitsune/templates/oauth/login.html | 80 ++++++++++---------- kitsune/templates/oauth/token.html | 18 +++-- pnpm-lock.yaml | 12 +++ 7 files changed, 130 insertions(+), 103 deletions(-) create mode 100644 kitsune/.prettierrc diff --git a/kitsune/.prettierrc b/kitsune/.prettierrc new file mode 100644 index 00000000..05e6e405 --- /dev/null +++ b/kitsune/.prettierrc @@ -0,0 +1,11 @@ +{ + "overrides": [ + { + "files": ["*.html"], + "options": { + "parser": "jinja-template" + } + } + ], + "plugins": ["prettier-plugin-jinja-template"] +} diff --git a/kitsune/package.json b/kitsune/package.json index 507b6091..57f952f7 100644 --- a/kitsune/package.json +++ b/kitsune/package.json @@ -11,6 +11,7 @@ "@tailwindcss/typography": "^0.5.15", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "prettier": "^3.4.1", + "prettier-plugin-jinja-template": "^2.0.0", "prettier-plugin-tailwindcss": "^0.6.9", "tailwindcss": "^3.4.15" } diff --git a/kitsune/templates/base.html b/kitsune/templates/base.html index e8c82c8c..01d25fb3 100644 --- a/kitsune/templates/base.html +++ b/kitsune/templates/base.html @@ -5,10 +5,10 @@ - {% block title %} {% endblock %} + {% block title %}{% endblock %} - {% block body %} {% endblock %} + {% block body %}{% endblock %} diff --git a/kitsune/templates/oauth/consent.html b/kitsune/templates/oauth/consent.html index 98ba48f3..debecf9f 100644 --- a/kitsune/templates/oauth/consent.html +++ b/kitsune/templates/oauth/consent.html @@ -1,64 +1,65 @@ {% extends "base.html" %} -
-{% block title %} OAuth Login {% endblock %} +{% block title %} + OAuth Login +{% endblock %} -
-{% block body %} {% macro add_query_params() %} - - - - - - +{% macro add_query_params() %} + + + + + + {% endmacro %} -
-

Kitsune

+{% block body %} +
+

Kitsune

-
-
- {{app_name}} wants the - following access to your Kitsune account: -

-
    - {% for scope in scopes %} -
  • {{ scope }}
  • - {% endfor %} -
-
+
+
+ {{ app_name }} wants the + following access to your Kitsune account: +

+
    + {% for scope in scopes %} +
  • {{ scope }}
  • + {% endfor %} +
+
-
- {{ add_query_params() }} - - -
+
+ {{ add_query_params() }} + + +
-
- {{ add_query_params() }} - - -
+
+ {{ add_query_params() }} + + +
-
- Authenticated as - {{ authenticated_username }} ~ - Logout +
+ Authenticated as + {{ authenticated_username }} ~ + Logout +
-
-
+
{% endblock %} diff --git a/kitsune/templates/oauth/login.html b/kitsune/templates/oauth/login.html index bc3e2a6b..d5ee690a 100644 --- a/kitsune/templates/oauth/login.html +++ b/kitsune/templates/oauth/login.html @@ -1,49 +1,49 @@ {% extends "base.html" %} -
-{% block title %}OAuth Login{% endblock %} +{% block title %} + OAuth Login +{% endblock %} -
{% block body %} -
-

Kitsune

+
+

Kitsune

- {% if flash_messages|length != 0 %} -
    - {% for (_level, msg) in flash_messages %} -
  • {{msg}}
  • - {% endfor %} -
- {% endif %} + {% if flash_messages|length != 0 %} +
    + {% for (_level, msg) in flash_messages %} +
  • {{ msg }}
  • + {% endfor %} +
+ {% endif %} -
- - - -
-
+ +
{% endblock %} diff --git a/kitsune/templates/oauth/token.html b/kitsune/templates/oauth/token.html index 24bb43aa..54ee814f 100644 --- a/kitsune/templates/oauth/token.html +++ b/kitsune/templates/oauth/token.html @@ -1,14 +1,16 @@ {% extends "base.html" %} -
-{% block title %} OAuth Token {% endblock %} +{% block title %} + OAuth Token +{% endblock %} -
{% block body %} -

{{domain}}

+

{{ domain }}

-
-

Copy & Paste this token into {{app_name}}

- {{token}} -
+
+

+ Copy & Paste this token into {{ app_name }} +

+ {{ token }} +
{% endblock %} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 724afc5f..b09bfdec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: prettier: specifier: ^3.4.1 version: 3.4.1 + prettier-plugin-jinja-template: + specifier: ^2.0.0 + version: 2.0.0(prettier@3.4.1) prettier-plugin-tailwindcss: specifier: ^0.6.9 version: 0.6.9(@trivago/prettier-plugin-sort-imports@4.3.0(prettier@3.4.1))(prettier-plugin-astro@0.14.1)(prettier-plugin-css-order@2.1.2(postcss@8.4.49)(prettier@3.4.1))(prettier-plugin-svelte@3.3.2(prettier@3.4.1)(svelte@5.2.9))(prettier@3.4.1) @@ -3040,6 +3043,11 @@ packages: peerDependencies: prettier: 3.x + prettier-plugin-jinja-template@2.0.0: + resolution: {integrity: sha512-REZDAcZuOUvMDaPS47/GNRLKvbxh9DO9euXhWA7gJGqTLGzHPK2Z841F8I4bxsR7e2lqnHezkQ8GcWaKekKBVQ==, tarball: https://registry.npmjs.org/prettier-plugin-jinja-template/-/prettier-plugin-jinja-template-2.0.0.tgz} + peerDependencies: + prettier: ^3.0.0 + prettier-plugin-svelte@3.3.2: resolution: {integrity: sha512-kRPjH8wSj2iu+dO+XaUv4vD8qr5mdDmlak3IT/7AOgGIMRG86z/EHOLauFcClKEnOUf4A4nOA7sre5KrJD4Raw==, tarball: https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.3.2.tgz} peerDependencies: @@ -7503,6 +7511,10 @@ snapshots: transitivePeerDependencies: - postcss + prettier-plugin-jinja-template@2.0.0(prettier@3.4.1): + dependencies: + prettier: 3.4.1 + prettier-plugin-svelte@3.3.2(prettier@3.4.1)(svelte@5.2.9): dependencies: prettier: 3.4.1