From f37ffd89372c37b2194e3a08dd0a64cc461c8c15 Mon Sep 17 00:00:00 2001 From: Shubham Padia Date: Mon, 30 Jun 2025 07:28:40 +0000 Subject: [PATCH] help-beta: Add prettier plugin for astro files. Even though we have separate packages for `help-beta`, we have opted to put the prettier plugin and config for astro files in the main project itself, so that linting needs to be configured only at one place. --- .../src/components/EmoticonTranslations.astro | 16 +- help-beta/src/components/FlattenList.astro | 39 ++- help-beta/src/components/KeyboardTip.astro | 21 +- .../src/components/NavigationSteps.astro | 331 +++++++++--------- package.json | 1 + pnpm-lock.yaml | 41 ++- prettier.config.js | 7 + tools/lint | 17 +- version.py | 2 +- 9 files changed, 274 insertions(+), 201 deletions(-) diff --git a/help-beta/src/components/EmoticonTranslations.astro b/help-beta/src/components/EmoticonTranslations.astro index 47cdeae480..5d1bc2f307 100644 --- a/help-beta/src/components/EmoticonTranslations.astro +++ b/help-beta/src/components/EmoticonTranslations.astro @@ -1,8 +1,9 @@ --- -import EmojiCodes from '../../../static/generated/emoji/emoji_codes.json'; +import EmojiCodes from "../../../static/generated/emoji/emoji_codes.json"; -const nameToCodePoint: {[key: string]: string} = EmojiCodes["name_to_codepoint"]; -const rowHTML = (emoticon: string, codepoint: string, name: string) => (` +const nameToCodePoint: {[key: string]: string} = + EmojiCodes["name_to_codepoint"]; +const rowHTML = (emoticon: string, codepoint: string, name: string) => ` ${emoticon} @@ -12,14 +13,15 @@ const rowHTML = (emoticon: string, codepoint: string, name: string) => (` class="emoji-big"> -`); +`; let body = ""; -const emoticonConversions: {[key: string]: string} = EmojiCodes["emoticon_conversions"] +const emoticonConversions: {[key: string]: string} = + EmojiCodes["emoticon_conversions"]; Object.keys(emoticonConversions).forEach((name: string) => { const emoticon: string = emoticonConversions[name]!; - body += rowHTML(name, nameToCodePoint[emoticon.slice(1, -1)]!, emoticon) -}) + body += rowHTML(name, nameToCodePoint[emoticon.slice(1, -1)]!, emoticon); +}); --- diff --git a/help-beta/src/components/FlattenList.astro b/help-beta/src/components/FlattenList.astro index 7e8417803b..8fc6cf320e 100644 --- a/help-beta/src/components/FlattenList.astro +++ b/help-beta/src/components/FlattenList.astro @@ -1,27 +1,32 @@ --- import assert from "node:assert/strict"; -import { fromHtml } from "hast-util-from-html"; -import { toHtml } from "hast-util-to-html"; +import {fromHtml} from "hast-util-from-html"; +import {toHtml} from "hast-util-to-html"; -const tree = fromHtml(await Astro.slots.render("default"), { fragment: true }); +const tree = fromHtml(await Astro.slots.render("default"), {fragment: true}); const tree_with_removed_newlines = { - type: "root", - children: tree.children.filter((child) => { - if (child.type === "text" && child.value === "\n") { - return false; - } - return true; - }), -} + type: "root", + children: tree.children.filter((child) => { + if (child.type === "text" && child.value === "\n") { + return false; + } + return true; + }), +}; const first_element = tree_with_removed_newlines.children[0]; -assert(first_element?.type === "element" && ["ol", "ul"].includes(first_element.tagName)); +assert( + first_element?.type === "element" && + ["ol", "ul"].includes(first_element.tagName), +); const flattened = { - ...first_element, - children: tree_with_removed_newlines.children.flatMap((other) => { - assert(other.type === "element" && other.tagName === first_element.tagName); - return other.children; - }), + ...first_element, + children: tree_with_removed_newlines.children.flatMap((other) => { + assert( + other.type === "element" && other.tagName === first_element.tagName, + ); + return other.children; + }), }; --- diff --git a/help-beta/src/components/KeyboardTip.astro b/help-beta/src/components/KeyboardTip.astro index 91c02bc22a..6aa63ce5e1 100644 --- a/help-beta/src/components/KeyboardTip.astro +++ b/help-beta/src/components/KeyboardTip.astro @@ -1,9 +1,9 @@ --- -import ZulipIconsKeyboard from "~icons/zulip-icon/keyboard" +import ZulipIconsKeyboard from "~icons/zulip-icon/keyboard"; -let { title } = Astro.props; +let {title} = Astro.props; if (!title) { - title = "Keyboard Shortcut"; + title = "Keyboard Shortcut"; } --- @@ -16,10 +16,13 @@ component along with a custom icon (keyboard in out case). Link: https://github.com/withastro/starlight/pull/2261 --> diff --git a/help-beta/src/components/NavigationSteps.astro b/help-beta/src/components/NavigationSteps.astro index f866881e5f..8a2eaf0d65 100644 --- a/help-beta/src/components/NavigationSteps.astro +++ b/help-beta/src/components/NavigationSteps.astro @@ -1,5 +1,5 @@ --- -import { SHOW_RELATIVE_LINKS, SHOW_BILLING_HELP_LINKS } from "astro:env/client"; +import {SHOW_RELATIVE_LINKS, SHOW_BILLING_HELP_LINKS} from "astro:env/client"; import assert from "node:assert"; import RawZulipIconGear from "~icons/zulip-icon/gear?raw"; import RawZulipIconHash from "~icons/zulip-icon/hash?raw"; @@ -17,147 +17,147 @@ import RawZulipIconInfo from "~icons/zulip-icon/info?raw"; import RawZulipIconHelp from "~icons/zulip-icon/help?raw"; const PERSONAL_SETTINGS_TYPE = "Personal settings"; -const ORGANIZATION_SETTINGS_TYPE = "Organization settings" +const ORGANIZATION_SETTINGS_TYPE = "Organization settings"; // This list has been transformed one-off from `help_settings_links.py`, we // have added a comment in that file to update this list in case of any // changes. const setting_link_mapping: { [key: string]: { - setting_type: string, - setting_name: string, - setting_link: string, - } + setting_type: string; + setting_name: string; + setting_link: string; + }; } = { // a mapping from the setting identifier that is the same as the final URL // breadcrumb to that setting to the name of its setting type, the setting // name as it appears in the user interface, and a relative link that can // be used to get to that setting - "profile": { + profile: { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Profile", - setting_link: "/#settings/profile" + setting_link: "/#settings/profile", }, "account-and-privacy": { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Account & privacy", - setting_link: "/#settings/account-and-privacy" + setting_link: "/#settings/account-and-privacy", }, - "preferences": { + preferences: { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Preferences", - setting_link: "/#settings/preferences" + setting_link: "/#settings/preferences", }, - "notifications": { + notifications: { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Notifications", - setting_link: "/#settings/notifications" + setting_link: "/#settings/notifications", }, "your-bots": { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Bots", - setting_link: "/#settings/your-bots" + setting_link: "/#settings/your-bots", }, "alert-words": { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Alert words", - setting_link: "/#settings/alert-words" + setting_link: "/#settings/alert-words", }, "uploaded-files": { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Uploaded files", - setting_link: "/#settings/uploaded-files" + setting_link: "/#settings/uploaded-files", }, - "topics": { + topics: { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Topics", - setting_link: "/#settings/topics" + setting_link: "/#settings/topics", }, "muted-users": { setting_type: PERSONAL_SETTINGS_TYPE, setting_name: "Muted users", - setting_link: "/#settings/muted-users" + setting_link: "/#settings/muted-users", }, "organization-profile": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Organization profile", - setting_link: "/#organization/organization-profile" + setting_link: "/#organization/organization-profile", }, "organization-settings": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Organization settings", - setting_link: "/#organization/organization-settings" + setting_link: "/#organization/organization-settings", }, "organization-permissions": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Organization permissions", - setting_link: "/#organization/organization-permissions" + setting_link: "/#organization/organization-permissions", }, "default-user-settings": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Default user settings", - setting_link: "/#organization/organization-level-user-defaults" + setting_link: "/#organization/organization-level-user-defaults", }, "emoji-settings": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Custom emoji", - setting_link: "/#organization/emoji-settings" + setting_link: "/#organization/emoji-settings", }, "auth-methods": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Authentication methods", - setting_link: "/#organization/auth-methods" + setting_link: "/#organization/auth-methods", }, - "users": { + users: { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Users", - setting_link: "/#organization/users/active" + setting_link: "/#organization/users/active", }, - "deactivated": { + deactivated: { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Users", - setting_link: "/#organization/users/deactivated" + setting_link: "/#organization/users/deactivated", }, - "invitations": { + invitations: { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Users", - setting_link: "/#organization/users/invitations" + setting_link: "/#organization/users/invitations", }, "bot-list-admin": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Bots", - setting_link: "/#organization/bot-list-admin" + setting_link: "/#organization/bot-list-admin", }, "default-channels-list": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Default channels", - setting_link: "/#organization/default-channels-list" + setting_link: "/#organization/default-channels-list", }, "linkifier-settings": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Linkifiers", - setting_link: "/#organization/linkifier-settings" + setting_link: "/#organization/linkifier-settings", }, "playground-settings": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Code playgrounds", - setting_link: "/#organization/playground-settings" + setting_link: "/#organization/playground-settings", }, "profile-field-settings": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Custom profile fields", - setting_link: "/#organization/profile-field-settings" + setting_link: "/#organization/profile-field-settings", }, "data-exports-admin": { setting_type: ORGANIZATION_SETTINGS_TYPE, setting_name: "Data exports", - setting_link: "/#organization/data-exports-admin" - } + setting_link: "/#organization/data-exports-admin", + }, }; type RelativeLinkInfo = { - label: string; - relative_link: string; + label: string; + relative_link: string; }; const default_template_for_relative_links = ` @@ -165,130 +165,129 @@ const default_template_for_relative_links = `
  • Click on the gear (${RawZulipIconGear}) icon in the upper right corner of the web or desktop app.
  • Select {item}.
  • -` +`; const relative_link_mapping: Record< - string, - { - data: Record; - template: string; - is_link_relative: () => boolean; - } + string, + { + data: Record; + template: string; + is_link_relative: () => boolean; + } > = { - gear: { - data: { - "channel-settings": { - label: `${RawZulipIconHash} Channel settings`, - relative_link: "/#channels/subscribed", - }, - settings: { - label: `${RawZulipIconTool} Personal Settings`, - relative_link: "/#settings/profile", - }, - "organization-settings": { - label: `${RawZulipIconBuilding} Organization settings`, - relative_link: "/#organization/organization-profile", - }, - "group-settings": { - label: `${RawZulipIconUserGroupCog} Group settings`, - relative_link: "/#groups/your", - }, - stats: { - label: `${RawZulipIconBarChart} Usage statistics`, - relative_link: "/stats", - }, - integrations: { - label: `${RawZulipIconGitPullRequest} Integrations`, - relative_link: "/integrations/", - }, - "about-zulip": { - label: "About Zulip", - relative_link: "/#about-zulip", - }, + gear: { + data: { + "channel-settings": { + label: `${RawZulipIconHash} Channel settings`, + relative_link: "/#channels/subscribed", + }, + settings: { + label: `${RawZulipIconTool} Personal Settings`, + relative_link: "/#settings/profile", + }, + "organization-settings": { + label: `${RawZulipIconBuilding} Organization settings`, + relative_link: "/#organization/organization-profile", + }, + "group-settings": { + label: `${RawZulipIconUserGroupCog} Group settings`, + relative_link: "/#groups/your", + }, + stats: { + label: `${RawZulipIconBarChart} Usage statistics`, + relative_link: "/stats", + }, + integrations: { + label: `${RawZulipIconGitPullRequest} Integrations`, + relative_link: "/integrations/", + }, + "about-zulip": { + label: "About Zulip", + relative_link: "/#about-zulip", + }, + }, + template: default_template_for_relative_links, + is_link_relative: () => SHOW_RELATIVE_LINKS, }, - template: default_template_for_relative_links, - is_link_relative: () => SHOW_RELATIVE_LINKS, - }, - "gear-billing": { - data: { - plans: { - label: `${RawZulipIconRocket} Plans and pricing`, - relative_link: "/plans/", - }, - billing: { - label: `${RawZulipIconCreditCard} Billing`, - relative_link: "/billing/", - }, + "gear-billing": { + data: { + plans: { + label: `${RawZulipIconRocket} Plans and pricing`, + relative_link: "/plans/", + }, + billing: { + label: `${RawZulipIconCreditCard} Billing`, + relative_link: "/billing/", + }, + }, + template: default_template_for_relative_links, + is_link_relative: () => SHOW_RELATIVE_LINKS && SHOW_BILLING_HELP_LINKS, }, - template: default_template_for_relative_links, - is_link_relative: () => SHOW_RELATIVE_LINKS && SHOW_BILLING_HELP_LINKS, - }, - help: { - data: { - "keyboard-shortcuts": { - label: `${RawZulipIconKeyboard} Keyboard shortcuts`, - relative_link: "/#keyboard-shortcuts", - }, - "message-formatting": { - label: `${RawZulipIconEdit} Message formatting`, - relative_link: "/#message-formatting", - }, - "search-filters": { - label: `${RawZulipIconManageSearch} Search filters`, - relative_link: "/#search-operators", - }, - "about-zulip": { - label: `${RawZulipIconInfo} About Zulip`, - relative_link: "/#about-zulip", - }, - }, - template: ` + help: { + data: { + "keyboard-shortcuts": { + label: `${RawZulipIconKeyboard} Keyboard shortcuts`, + relative_link: "/#keyboard-shortcuts", + }, + "message-formatting": { + label: `${RawZulipIconEdit} Message formatting`, + relative_link: "/#message-formatting", + }, + "search-filters": { + label: `${RawZulipIconManageSearch} Search filters`, + relative_link: "/#search-operators", + }, + "about-zulip": { + label: `${RawZulipIconInfo} About Zulip`, + relative_link: "/#about-zulip", + }, + }, + template: `
    1. Click on the Help menu (${RawZulipIconHelp}) icon in the upper right corner of the app.
    2. Select {item}.
    `, - is_link_relative: () => SHOW_RELATIVE_LINKS, - }, - channel: { - data: { - all: { - label: "All", - relative_link: "/#channels/all", - }, - "not-subscribed": { - label: "Not subscribed", - relative_link: "/#channels/notsubscribed", - }, + is_link_relative: () => SHOW_RELATIVE_LINKS, }, - template: ` + channel: { + data: { + all: { + label: "All", + relative_link: "/#channels/all", + }, + "not-subscribed": { + label: "Not subscribed", + relative_link: "/#channels/notsubscribed", + }, + }, + template: `
    1. Click on the gear (${RawZulipIconGear}) icon in the upper right corner of the web or desktop app.
    2. Select ${RawZulipIconHash} Channel settings.
    3. Click {item} in the upper left.
    `, - is_link_relative: () => SHOW_RELATIVE_LINKS, - }, - group: { - data: { - all: { - label: "All groups", - relative_link: "/#groups/all", - }, + is_link_relative: () => SHOW_RELATIVE_LINKS, }, - template: ` + group: { + data: { + all: { + label: "All groups", + relative_link: "/#groups/all", + }, + }, + template: `
    1. Click on the gear (${RawZulipIconGear}) icon in the upper right corner of the web or desktop app.
    2. Select ${RawZulipIconUserGroupCog} Group settings.
    3. Click {item} in the upper left.
    `, - is_link_relative: () => SHOW_RELATIVE_LINKS, - }, + is_link_relative: () => SHOW_RELATIVE_LINKS, + }, }; - const getSettingsMarkdown = (setting_type: string, setting_name: string) => `
    1. @@ -302,22 +301,19 @@ const getSettingsMarkdown = (setting_type: string, setting_name: string) => ` On the left, click ${setting_name}.
    -` +`; const getSettingsHTML = ( - setting_key: string, - SHOW_RELATIVE_LINKS: boolean + setting_key: string, + SHOW_RELATIVE_LINKS: boolean, ): string => { - const { - setting_type, - setting_name, - setting_link, - } = setting_link_mapping[setting_key]!; + const {setting_type, setting_name, setting_link} = + setting_link_mapping[setting_key]!; if (!SHOW_RELATIVE_LINKS) { return getSettingsMarkdown(setting_type, setting_name); } - + const relativeLink = `${setting_name}`; // The "Bots" label appears in both Personal and @@ -326,32 +322,43 @@ const getSettingsHTML = ( // As for the the case of "Users", it refers to the Users tab in // organization settings. Since the users tab has multiple sub tabs // like active, deactivated etc., we need a way to point to them. - const label = (setting_name === "Bots" || setting_name === "Users") - ? `Navigate to the ${relativeLink} tab of the ${setting_type} menu.` - : `Go to ${relativeLink}.`; + const label = + setting_name === "Bots" || setting_name === "Users" + ? `Navigate to the ${relativeLink} tab of the ${setting_type} menu.` + : `Go to ${relativeLink}.`; return `
    1. ${label}
    `; -} +}; -const RELATIVE_NAVIGATION_HANDLERS_BY_TYPE: Record string> = {}; +const RELATIVE_NAVIGATION_HANDLERS_BY_TYPE: Record< + string, + (key: string) => string +> = {}; for (const type in relative_link_mapping) { - const { data, template, is_link_relative } = relative_link_mapping[type]!; + const {data, template, is_link_relative} = relative_link_mapping[type]!; - RELATIVE_NAVIGATION_HANDLERS_BY_TYPE[type] = (key: string) => { - const { label, relative_link } = data[key]!; - const formattedItem = is_link_relative() ? `${label}` : `${label}`; - return template.replace("{item}", formattedItem); - }; + RELATIVE_NAVIGATION_HANDLERS_BY_TYPE[type] = (key: string) => { + const {label, relative_link} = data[key]!; + const formattedItem = is_link_relative() + ? `${label}` + : `${label}`; + return template.replace("{item}", formattedItem); + }; } -const { identifier } = Astro.props; +const {identifier} = Astro.props; const navigation_link_type = identifier.split("/")[0]; -if (navigation_link_type !== "settings" && navigation_link_type !== "relative" ) { - throw new Error("Invalid navigation link type. Only `settings` or `relative` is allowed."); +if ( + navigation_link_type !== "settings" && + navigation_link_type !== "relative" +) { + throw new Error( + "Invalid navigation link type. Only `settings` or `relative` is allowed.", + ); } let resultHTML: string | undefined; @@ -363,6 +370,6 @@ if (navigation_link_type === "settings") { resultHTML = RELATIVE_NAVIGATION_HANDLERS_BY_TYPE[link_type]!(key); } assert(resultHTML !== undefined); - --- + diff --git a/package.json b/package.json index 62e83a896d..d5bfc73002 100644 --- a/package.json +++ b/package.json @@ -148,6 +148,7 @@ "openapi-examples-validator": "^6.0.1", "preact": "^10.24.3", "prettier": "~3.5.3", + "prettier-plugin-astro": "^0.14.1", "puppeteer": "^24.1.1", "source-map": "npm:source-map-js@^1.2.1", "stylelint": "^16.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d65c258ab6..acdfa07a7b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -464,6 +464,9 @@ importers: prettier: specifier: ~3.5.3 version: 3.5.3 + prettier-plugin-astro: + specifier: ^0.14.1 + version: 0.14.1 puppeteer: specifier: ^24.1.1 version: 24.10.2(typescript@5.8.3) @@ -511,7 +514,7 @@ importers: dependencies: '@astrojs/check': specifier: ^0.9.3 - version: 0.9.4(prettier@3.5.3)(typescript@5.8.3) + version: 0.9.4(prettier-plugin-astro@0.14.1)(prettier@3.5.3)(typescript@5.8.3) '@astrojs/starlight': specifier: ^0.34.2 version: 0.34.4(astro@5.10.1(@types/node@22.15.33)(encoding@0.1.13)(jiti@1.21.7)(rollup@4.44.0)(sass@1.89.2)(terser@5.43.1)(typescript@5.8.3)(yaml@2.8.0)) @@ -7571,6 +7574,10 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-plugin-astro@0.14.1: + resolution: {integrity: sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==} + engines: {node: ^14.15.0 || >=16.0.0} + prettier@2.8.7: resolution: {integrity: sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==} engines: {node: '>=10.13.0'} @@ -8012,6 +8019,9 @@ packages: rw@1.3.3: resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==} + s.color@0.0.15: + resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + safe-array-concat@1.1.3: resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==} engines: {node: '>=0.4'} @@ -8037,6 +8047,9 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + sass-formatter@0.7.9: + resolution: {integrity: sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==} + sass@1.89.2: resolution: {integrity: sha512-xCmtksBKd/jdJ9Bt9p7nPKiuqrlBMBuuGkQlkhZjjQk3Ty48lv93k5Dq6OPkKt4XwxDJ7tvlfrTa1MPA9bf+QA==} engines: {node: '>=14.0.0'} @@ -8455,6 +8468,9 @@ packages: stylis@4.2.0: resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==} + suf-log@2.5.3: + resolution: {integrity: sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==} + supercluster@7.1.5: resolution: {integrity: sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==} @@ -9679,9 +9695,9 @@ snapshots: '@csstools/css-tokenizer': 3.0.4 lru-cache: 10.4.3 - '@astrojs/check@0.9.4(prettier@3.5.3)(typescript@5.8.3)': + '@astrojs/check@0.9.4(prettier-plugin-astro@0.14.1)(prettier@3.5.3)(typescript@5.8.3)': dependencies: - '@astrojs/language-server': 2.15.4(prettier@3.5.3)(typescript@5.8.3) + '@astrojs/language-server': 2.15.4(prettier-plugin-astro@0.14.1)(prettier@3.5.3)(typescript@5.8.3) chokidar: 4.0.3 kleur: 4.1.5 typescript: 5.8.3 @@ -9694,7 +9710,7 @@ snapshots: '@astrojs/internal-helpers@0.6.1': {} - '@astrojs/language-server@2.15.4(prettier@3.5.3)(typescript@5.8.3)': + '@astrojs/language-server@2.15.4(prettier-plugin-astro@0.14.1)(prettier@3.5.3)(typescript@5.8.3)': dependencies: '@astrojs/compiler': 2.12.2 '@astrojs/yaml2ts': 0.2.2 @@ -9716,6 +9732,7 @@ snapshots: vscode-uri: 3.1.0 optionalDependencies: prettier: 3.5.3 + prettier-plugin-astro: 0.14.1 transitivePeerDependencies: - typescript @@ -18087,6 +18104,12 @@ snapshots: prelude-ls@1.2.1: {} + prettier-plugin-astro@0.14.1: + dependencies: + '@astrojs/compiler': 2.12.2 + prettier: 3.5.3 + sass-formatter: 0.7.9 + prettier@2.8.7: optional: true @@ -18705,6 +18728,8 @@ snapshots: rw@1.3.3: {} + s.color@0.0.15: {} + safe-array-concat@1.1.3: dependencies: call-bind: 1.0.8 @@ -18732,6 +18757,10 @@ snapshots: safer-buffer@2.1.2: {} + sass-formatter@0.7.9: + dependencies: + suf-log: 2.5.3 + sass@1.89.2: dependencies: chokidar: 4.0.3 @@ -19312,6 +19341,10 @@ snapshots: stylis@4.2.0: {} + suf-log@2.5.3: + dependencies: + s.color: 0.0.15 + supercluster@7.1.5: dependencies: kdbush: 3.0.0 diff --git a/prettier.config.js b/prettier.config.js index 0cef0d8890..efed6d9006 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,6 +1,7 @@ export default { bracketSpacing: false, trailingComma: "all", + plugins: ["prettier-plugin-astro"], overrides: [ { files: ["tsconfig.json"], @@ -15,5 +16,11 @@ export default { embeddedLanguageFormatting: "off", }, }, + { + files: "*.astro", + options: { + parser: "astro", + }, + }, ], }; diff --git a/tools/lint b/tools/lint index 19b64290ca..602e8a8029 100755 --- a/tools/lint +++ b/tools/lint @@ -56,6 +56,7 @@ def run() -> None: "yml", ], "frontend": [ + "astro", "cjs", "css", "cts", @@ -166,7 +167,21 @@ def run() -> None: linter_config.external_linter( "prettier", ["node_modules/.bin/prettier", "--cache", "--check", "--log-level=warn"], - ["cjs", "css", "cts", "flow", "js", "json", "md", "mjs", "mts", "ts", "yaml", "yml"], + [ + "astro", + "cjs", + "css", + "cts", + "flow", + "js", + "json", + "md", + "mjs", + "mts", + "ts", + "yaml", + "yml", + ], fix_arg=["--write"], description="Formats CSS, JavaScript, YAML", ) diff --git a/version.py b/version.py index 9ecf238178..c0221c9630 100644 --- a/version.py +++ b/version.py @@ -49,4 +49,4 @@ API_FEATURE_LEVEL = 398 # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = (333, 3) # bumped 2025-06-25 to upgrade JavaScript dependencies +PROVISION_VERSION = (333, 4) # bumped 2025-06-30 to add prettier-plugin-astro