diff --git a/eslint.config.js b/eslint.config.js index 423e5d3d54..8972146849 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -310,14 +310,9 @@ export default tseslint.config( }, ...astroConfigs.recommended, { - files: [ - "starlight_help/src/components/ZulipNote.astro", - "starlight_help/src/components/ZulipTip.astro", - "starlight_help/src/components/KeyboardTip.astro", - ], + files: ["starlight_help/src/components/ZulipNote.astro"], rules: { "import/unambiguous": "off", - "@typescript-eslint/consistent-type-assertions": "off", }, }, ); diff --git a/starlight_help/src/components/KeyboardTip.astro b/starlight_help/src/components/KeyboardTip.astro index dddf116147..e79668c933 100644 --- a/starlight_help/src/components/KeyboardTip.astro +++ b/starlight_help/src/components/KeyboardTip.astro @@ -21,22 +21,13 @@ keyboard_icon_first_child.properties.class = "zulip-unplugin-icon"; // the next line as `Keyboard tip:`. We have to edit slot HTML tree // directly instead to solve this. Same case applies for the keyboard // icon we are inserting. We just inject the icon as raw svg. -const prefix_element_list = [ - keyboard_icon_first_child, - { - type: "element", - tagName: "strong", - properties: {}, - children: [ - { - type: "text", - // Whitespace before the text to ensure space between - // this text and the preceding icon. - value: " Keyboard tip: ", - }, - ], - } as Element, -]; +const prefix_text_element: Element = { + type: "element", + tagName: "strong", + properties: {}, + children: [{type: "text", value: " Keyboard tip: "}], +}; +const prefix_element_list = [keyboard_icon_first_child, prefix_text_element]; const tree = fromHtml(await Astro.slots.render("default"), {fragment: true}); const first_element = tree.children[0]; diff --git a/starlight_help/src/components/ZulipTip.astro b/starlight_help/src/components/ZulipTip.astro index b0b74b63e1..14fb858725 100644 --- a/starlight_help/src/components/ZulipTip.astro +++ b/starlight_help/src/components/ZulipTip.astro @@ -22,22 +22,20 @@ lightbulb_icon_first_child.properties.class = // `Tip:`. We have to edit slot HTML tree directly instead to solve this. // Same case applies for the ligthbulb icon we are inserting. We just // inject the icon as raw svg. -let prefix_element_list = [ - lightbulb_icon_first_child, - { - type: "element", - tagName: "strong", - properties: {}, - children: [ - { - type: "text", - // Whitespace before the text to ensure space between - // this text and the preceding icon. - value: " Tip: ", - }, - ], - } as Element, -]; +const prefix_text_element: Element = { + type: "element", + tagName: "strong", + properties: {}, + children: [ + { + type: "text", + // Whitespace before the text to ensure space between + // this text and the preceding icon. + value: " Tip: ", + }, + ], +}; +let prefix_element_list = [lightbulb_icon_first_child, prefix_text_element]; const tree = fromHtml(await Astro.slots.render("default"), {fragment: true}); const first_element = tree.children[0]; @@ -47,14 +45,13 @@ assert.ok(first_element?.type === "element"); // where the tip contains an unordered list. Just placing the element as is without // a paragraph does not look good in that case. if (first_element.tagName !== "p") { - prefix_element_list = [ - { - type: "element", - tagName: "p", - properties: {}, - children: [...prefix_element_list], - } as Element, - ]; + const paragraph_wrapping_element: Element = { + type: "element", + tagName: "p", + properties: {}, + children: [...prefix_element_list], + }; + prefix_element_list = [paragraph_wrapping_element]; } first_element.children = [...prefix_element_list, ...first_element.children];