diff --git a/website/biome.json b/website/biome.json deleted file mode 100644 index 208387f061..0000000000 --- a/website/biome.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "vcs": { - "enabled": true, - "clientKind": "git", - "useIgnoreFile": true - }, - "files": { - "ignoreUnknown": false, - "ignore": [] - }, - "formatter": { - "enabled": true, - "indentStyle": "tab" - }, - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true - } - }, - "javascript": { - "formatter": { - "quoteStyle": "double" - } - } -} diff --git a/website/biome.jsonc b/website/biome.jsonc new file mode 100644 index 0000000000..b2245dd590 --- /dev/null +++ b/website/biome.jsonc @@ -0,0 +1,40 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.0.6/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "ignoreUnknown": false, + "includes": ["**"] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "assist": { "actions": { "source": { "organizeImports": "on" } } }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "style": { + "noParameterAssign": "error", + "useAsConstAssertion": "error", + "useDefaultParameterLast": "error", + "useEnumInitializers": "error", + "useSelfClosingElements": "error", + "useSingleVarDeclarator": "error", + "noUnusedTemplateLiteral": "error", + "useNumberNamespace": "error", + "noInferrableTypes": "error", + "noUselessElse": "error" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/website/bun.lockb b/website/bun.lockb index ccd850768f..15759e43fe 100755 Binary files a/website/bun.lockb and b/website/bun.lockb differ diff --git a/website/package.json b/website/package.json index 1b168e89c3..be3a308670 100644 --- a/website/package.json +++ b/website/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "devDependencies": { - "@biomejs/biome": "1.9.4", + "@biomejs/biome": "2.0.6", "@hono/ssg-plugins-essential": "^0.1.0", "@hono/vite-dev-server": "^0.20.1", "@hono/vite-ssg": "^0.2.0", diff --git a/website/src/components/icons/index.ts b/website/src/components/icons/index.ts index 0c685a4edd..45ed58a0a7 100644 --- a/website/src/components/icons/index.ts +++ b/website/src/components/icons/index.ts @@ -1,19 +1,19 @@ // Tabler Icons // https://tabler.io/icons -export { HomeIcon } from "./HomeIcon"; + +export { AlertTriangleIcon } from "./AlertTriangleIcon"; export { CaretRightCircleIcon } from "./CaretRightCircleIcon"; -export { InfoCircleIcon } from "./InfoCircleIcon"; -export { HelpCircleIcon } from "./HelpCircleIcon"; export { ChevronLeftIcon } from "./ChevronLeftIcon"; export { ChevronRightIcon } from "./ChevronRightIcon"; -export { AlertTriangleIcon } from "./AlertTriangleIcon"; -export { MenuIcon } from "./MenuIcon"; export { CloseIcon } from "./CloseIcon"; -export { SearchIcon } from "./SearchIcon"; -export { LanguageIcon } from "./LanguageIcon"; -export { WorldIcon } from "./WorldIcon"; - +export { DiscordIcon } from "./DiscordIcon"; // Simple Icons // https://simpleicons.org/ export { GitHubIcon } from "./GitHubIcon"; -export { DiscordIcon } from "./DiscordIcon"; +export { HelpCircleIcon } from "./HelpCircleIcon"; +export { HomeIcon } from "./HomeIcon"; +export { InfoCircleIcon } from "./InfoCircleIcon"; +export { LanguageIcon } from "./LanguageIcon"; +export { MenuIcon } from "./MenuIcon"; +export { SearchIcon } from "./SearchIcon"; +export { WorldIcon } from "./WorldIcon"; diff --git a/website/src/components/templates/FuncTemplate.tsx b/website/src/components/templates/FuncTemplate.tsx index e2aae8cb5c..d7d303b92c 100644 --- a/website/src/components/templates/FuncTemplate.tsx +++ b/website/src/components/templates/FuncTemplate.tsx @@ -102,16 +102,14 @@ function ScopedDefinitions({ {parent ? ( // Currently, the scope has at most two levels. // Therefore, it is sufficient to only annotate the direct `parent`. - <> - - + ) : ( )} - {scope.map((method, index) => { + {scope.map((method, _index) => { const methodId = `${parentId}definitions-${method.name}`; return ( diff --git a/website/src/components/templates/GroupTemplate.tsx b/website/src/components/templates/GroupTemplate.tsx index 017239d76d..5533a942c4 100644 --- a/website/src/components/templates/GroupTemplate.tsx +++ b/website/src/components/templates/GroupTemplate.tsx @@ -34,7 +34,7 @@ export const GroupTemplate: FC = ({ <>

Function

- {content.functions.map((method, index) => ( + {content.functions.map((method, _index) => (

{method.name} diff --git a/website/src/components/templates/TypeTemplate.tsx b/website/src/components/templates/TypeTemplate.tsx index 95c834f6e8..39eeb280e1 100644 --- a/website/src/components/templates/TypeTemplate.tsx +++ b/website/src/components/templates/TypeTemplate.tsx @@ -57,7 +57,7 @@ export const TypeTemplate: FC = ({

- {content.scope.map((method, index) => ( + {content.scope.map((method, _index) => (

= ({ }) => { return (
- {func.params.map((param, index) => ( + {func.params.map((param, _index) => (
    - {docs?.map((firstLevel, idx) => ( + {docs?.map((firstLevel, _idx) => ( <> {firstLevel.part && (
  • - {firstLevel.children.map((secondLevel, idx2) => ( + {firstLevel.children.map((secondLevel, _idx2) => (
    {secondLevel.part && (
  • @@ -112,7 +112,7 @@ export const SideNavigation = ({ x-transition:enter-end="opacity-100 transform translate-y-0" > {secondLevel.children.map( - (thirdLevel, idx3) => ( + (thirdLevel, _idx3) => (
    {thirdLevel.part && (
  • diff --git a/website/src/components/ui/common/index.ts b/website/src/components/ui/common/index.ts index 8c5250386d..114638e8c8 100644 --- a/website/src/components/ui/common/index.ts +++ b/website/src/components/ui/common/index.ts @@ -1,9 +1,9 @@ -export { SiteNoticeBanner } from "./SiteNoticeBanner"; -export { Header } from "./Header"; -export { SiteTitle } from "./SiteTitle"; -export { SideNavigation, type SideNavigationProps } from "./SideNavigation"; export { Breadcrumbs, type BreadcrumbsProps } from "./Breadcrumbs"; -export { TableOfContents, type TableOfContentsProps } from "./TableOfContents"; export { Footer } from "./Footer"; +export { Header } from "./Header"; export { SearchWindow } from "./SearchWindow"; +export { SideNavigation, type SideNavigationProps } from "./SideNavigation"; +export { SiteNoticeBanner } from "./SiteNoticeBanner"; +export { SiteTitle } from "./SiteTitle"; +export { TableOfContents, type TableOfContentsProps } from "./TableOfContents"; export { TranslationStatusAlert } from "./TranslationStatusAlert"; diff --git a/website/src/globals.css b/website/src/globals.css index 742c9ee185..51382e61a1 100644 --- a/website/src/globals.css +++ b/website/src/globals.css @@ -46,8 +46,9 @@ code, pre, kbd, samp { - font-family: "Cascadia Mono", SFMono-Regular, Menlo, Monaco, Consolas, - "Liberation Mono", "Courier New", monospace; + font-family: + "Cascadia Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", + "Courier New", monospace; } /* Information box */ diff --git a/website/src/index.tsx b/website/src/index.tsx index 3901f8cc93..791e147c21 100644 --- a/website/src/index.tsx +++ b/website/src/index.tsx @@ -1,6 +1,8 @@ import { serveStatic } from "@hono/node-server/serve-static"; import { Hono } from "hono"; import { appendTrailingSlash, trimTrailingSlash } from "hono/trailing-slash"; +// Documentation generated by typst-docs. +import docsJson from "../../docs.json"; import { CategoryTemplate, FuncTemplate, @@ -16,8 +18,6 @@ import { isPageOfKind } from "./utils/isPageOfKind"; import { removeBasePath } from "./utils/path"; import { registerRoutes } from "./utils/translationStatus"; -// Documentation generated by typst-docs. -import docsJson from "../../docs.json"; const docs = docsJson as unknown as Page[]; const [flattenedPages, pagePaths] = flattenDocs(docs); @@ -89,7 +89,7 @@ if (import.meta.env.DEV) { rewriteRequestPath: (path) => { return path.slice(basePath.length); }, - onNotFound: (path, c) => { + onNotFound: (path, _c) => { console.log( `${path} is not found while trying to serve a static asset`, ); diff --git a/website/src/translation/en-US.tsx b/website/src/translation/en-US.tsx index 65fe5b7164..e0f46b4d29 100644 --- a/website/src/translation/en-US.tsx +++ b/website/src/translation/en-US.tsx @@ -1,3 +1,4 @@ +import { Fragment } from "hono/jsx/jsx-runtime"; import type { TooltipProps } from "../components/ui/Tooltip"; import { githubOrganizationUrl } from "../metadata"; import type { TranslationComponent, TranslationObject } from "./"; @@ -39,148 +40,158 @@ export const translation: TranslationObject = { export const Translation: TranslationComponent = (props) => { switch (props.translationKey) { case "definition": - return <>Definition; + return Definition; case "constructor": - return <>Constructor; + return Constructor; case "definitionOf": return ( - <> + {props.name} Definition - + ); case "search": - return <>Search; + return Search; case "defaultValue": - return <>Default value:; + return Default value:; case "stringValues": - return <>Available string values:; + return Available string values:; case "showExample": - return <>Show example; + return Show example; case "tableOfContents": - return <>On this page; + return On this page; case "nextPage": - return <>Next page; + return Next page; case "previousPage": - return <>Previous page; + return Previous page; case "referenceDescription": return ( - <> + Detailed reference for all Typst syntax, concepts, types, and functions. - + ); case "tutorialDescription": - return <>Learn how to use Typst step by step.; + return Learn how to use Typst step by step.; case "tutorial": - return <>Tutorial; + return Tutorial; case "openOfficialDocs": - return <>Open official docs; + return Open official docs; case "reference": - return <>Reference; + return Reference; case "typstOfficialDocs": - return <>Typst official docs; + return Typst official docs; case "typstOfficialWebsite": - return <>Typst official website; + return Typst official website; case "untranslated": - return <>Untranslated; + return Untranslated; case "untranslatedMessage": return ( - <> + This page has not been translated yet. The original content is shown. - + ); case "communityContent": - return <>Community original content; + return Community original content; case "contentAddedByCommunity": return ( - <> + This page contains content that is not part of the official documentation, added independently by the community. - + ); case "partiallyTranslated": - return <>Partially translated; + return Partially translated; case "partiallyTranslatedMessage": return ( - <> + This page is partially translated. Some original content is included. - + ); case "translated": - return <>Translated; + return Translated; case "translatedMessage": - return <>This page has been translated into English.; + return This page has been translated into English.; case "elementFunction": - return <>Element; + return Element; case "elementFunctionDescription": return ( - <> + Element functions can be customized with set and{" "} show rules. - + ); case "contextFunction": - return <>Context; + return Context; case "contextFunctionDescription": - return <>Context functions can only be used when the context is known.; + return ( + + Context functions can only be used when the context is known. + + ); case "definitionTooltip": - return <>Definition; + return Definition; case "definitionTooltipDescription": return ( - <> + These functions and types can have related definitions. To access a definition, specify the name of the function or type, followed by the definition name separated by a period. - + ); case "argument": - return <>Parameter; + return Parameter; case "argumentDescription": return ( - <> + Parameters are input values for functions. Specify them in parentheses after the function name. - + ); case "variadic": - return <>Variadic; + return Variadic; case "variadicDescription": - return <>Variadic parameters can be specified multiple times.; + return ( + + Variadic parameters can be specified multiple times. + + ); case "positional": - return <>Positional; + return Positional; case "positionalDescription": return ( - <> + Positional parameters can be set by specifying them in order, omitting the parameter name. - + ); case "required": - return <>Required; + return Required; case "requiredDescription": return ( - <>Required parameters must be specified when calling the function. + + Required parameters must be specified when calling the function. + ); case "document": - return <>Document; + return Document; case "langVersion": - return <>English; + return English; case "translationRate": - return <>Translated; + return Translated; case "settable": - return <>Settable; + return Settable; case "settableDescription": return ( - <> + Settable parameters can be set using the set rule, changing the default value used thereafter. - + ); case "siteNoticeBannerTitle": - return <>Info; + return Info; case "siteNoticeBannerDescription": return ( - <> + This site is generated using the static site generator developed by the Typst Community. Please adjust the text content of this banner according to your usage @@ -191,13 +202,13 @@ export const Translation: TranslationComponent = (props) => { Issue #874 on typst/typst . - + ); case "footer": return ( - <> + Translated by Typst Community - + ); default: return null; diff --git a/website/src/translation/index.tsx b/website/src/translation/index.tsx index a724f67c88..375fe759f6 100644 --- a/website/src/translation/index.tsx +++ b/website/src/translation/index.tsx @@ -83,4 +83,4 @@ export type TranslationComponent = FC; /** * Switch translation language here. */ -export { translation, Translation } from "./ja-JP"; +export { Translation, translation } from "./ja-JP"; diff --git a/website/src/translation/ja-JP.tsx b/website/src/translation/ja-JP.tsx index ef201c7594..4340e6e33d 100644 --- a/website/src/translation/ja-JP.tsx +++ b/website/src/translation/ja-JP.tsx @@ -1,3 +1,4 @@ +import { Fragment } from "hono/jsx/jsx-runtime"; import type { TooltipProps } from "../components/ui/Tooltip"; import { discordServerUrl, @@ -44,137 +45,149 @@ export const translation: TranslationObject = { export const Translation: TranslationComponent = (props) => { switch (props.translationKey) { case "definition": - return <>定義; + return 定義; case "constructor": - return <>コンストラクタ; + return コンストラクタ; case "definitionOf": return ( - <> + {props.name}の定義 - + ); case "search": - return <>検索; + return 検索; case "defaultValue": - return <>デフォルト値:; + return デフォルト値:; case "stringValues": - return <>使用可能な文字列値:; + return 使用可能な文字列値:; case "showExample": - return <>例を表示; + return 例を表示; case "tableOfContents": - return <>目次; + return 目次; case "nextPage": - return <>次のページ; + return 次のページ; case "previousPage": - return <>前のページ; + return 前のページ; case "referenceDescription": return ( - <> + Typstのあらゆる構文、概念、型、関数についての詳細なリファレンスです。 - + ); case "tutorialDescription": - return <>一歩一歩、Typstの使い方を学びましょう。; + return 一歩一歩、Typstの使い方を学びましょう。; case "tutorial": - return <>チュートリアル; + return チュートリアル; case "openOfficialDocs": - return <>原文(英語)を開く; + return 原文(英語)を開く; case "reference": - return <>リファレンス; + return リファレンス; case "typstOfficialDocs": - return <>Typst公式ドキュメント; + return Typst公式ドキュメント; case "typstOfficialWebsite": - return <>Typst公式サイト; + return Typst公式サイト; case "untranslated": - return <>未翻訳; + return 未翻訳; case "untranslatedMessage": return ( - <>このページはまだ翻訳されていません。原文の内容が表示されています。 + + このページはまだ翻訳されていません。原文の内容が表示されています。 + ); case "communityContent": - return <>日本語版オリジナル; + return 日本語版オリジナル; case "contentAddedByCommunity": return ( - <> + このページの内容は公式ドキュメントには含まれておらず、日本語コミュニティが独自に追加したものです。 - + ); case "partiallyTranslated": - return <>部分的に翻訳済み; + return 部分的に翻訳済み; case "partiallyTranslatedMessage": return ( - <> + このページは部分的に翻訳されています。一部原文の内容が含まれています。 - + ); case "translated": - return <>翻訳済み; + return 翻訳済み; case "translatedMessage": - return <>このページは日本語に翻訳済みです。; + return このページは日本語に翻訳済みです。; case "elementFunction": - return <>要素関数; + return 要素関数; case "elementFunctionDescription": return ( - <> + 要素関数はsetルールやshow ルールでカスタマイズできます。 - + ); case "contextFunction": - return <>コンテキスト関数; + return コンテキスト関数; case "contextFunctionDescription": return ( - <>コンテキスト関数は、コンテキストが既知の場合にのみ使用できます。 + + コンテキスト関数は、コンテキストが既知の場合にのみ使用できます。 + ); case "definitionTooltip": - return <>定義; + return 定義; case "definitionTooltipDescription": return ( - <> + これらの関数や型には、関連する定義を持たせることができます。定義にアクセスするには、対象の関数や型の名前を指定した後に、ピリオド区切りで定義名を記述します。 - + ); case "argument": - return <>引数; + return 引数; case "argumentDescription": return ( - <>引数は関数への入力値です。関数名の後に括弧で囲んで指定します。 + + 引数は関数への入力値です。関数名の後に括弧で囲んで指定します。 + ); case "variadic": - return <>可変長引数; + return 可変長引数; case "variadicDescription": - return <>可変長引数は複数回指定することができます。; + return 可変長引数は複数回指定することができます。; case "positional": - return <>位置引数; + return 位置引数; case "positionalDescription": return ( - <>位置引数は順序通りに指定することで、引数名を省略して設定できます。 + + 位置引数は順序通りに指定することで、引数名を省略して設定できます。 + ); case "required": - return <>必須引数; + return 必須引数; case "requiredDescription": - return <>必須引数は、関数を呼び出す際に必ず指定しなければなりません。; + return ( + + 必須引数は、関数を呼び出す際に必ず指定しなければなりません。 + + ); case "document": - return <>ドキュメント; + return ドキュメント; case "langVersion": - return <>日本語版; + return 日本語版; case "translationRate": - return <>翻訳率; + return 翻訳率; case "settable": - return <>設定可能引数; + return 設定可能引数; case "settableDescription": return ( - <> + 設定可能引数は、set ルールを用いて設定でき、それ以降で使用するデフォルト値を変更できます。 - + ); case "siteNoticeBannerTitle": - return <>情報 / Info; + return 情報 / Info; case "siteNoticeBannerDescription": return ( - <> + 当サイトは、Typst GmbHの許諾を得て、日本語コミュニティ「 Typst Japanese Community」が Typst v{version}の公式ドキュメント @@ -196,14 +209,14 @@ export const Translation: TranslationComponent = (props) => { our GitHub repository for both translation improvements and website enhancements. Feel free to join{" "} our Discord server "Kumihan Club". - + ); case "footer": return ( - <> + Translated by{" "} Typst Japanese Community - + ); default: return null; diff --git a/website/src/utils/flattenDocs.test.ts b/website/src/utils/flattenDocs.test.ts index 1b31031c60..17fecc7594 100644 --- a/website/src/utils/flattenDocs.test.ts +++ b/website/src/utils/flattenDocs.test.ts @@ -153,7 +153,7 @@ describe("flattenDocs", () => { const child = createMockPage("/a/b/", "B", [grandChild]); const parent = createMockPage("/a/", "A", [child]); - const [flattenedPages, pagePaths] = flattenDocs([parent]); + const [_flattenedPages, pagePaths] = flattenDocs([parent]); expect(pagePaths[0]).toEqual([parent]); expect(pagePaths[1]).toEqual([parent, child]); diff --git a/website/vite.config.ts b/website/vite.config.ts index ec3ba25bbc..1dd932bd2a 100644 --- a/website/vite.config.ts +++ b/website/vite.config.ts @@ -2,8 +2,7 @@ import { rmSync, symlinkSync } from "node:fs"; import { resolve } from "node:path"; import { robotsTxtPlugin } from "@hono/ssg-plugins-essential/robots-txt"; import { sitemapPlugin } from "@hono/ssg-plugins-essential/sitemap"; -import { defaultOptions } from "@hono/vite-dev-server"; -import devServer from "@hono/vite-dev-server"; +import devServer, { defaultOptions } from "@hono/vite-dev-server"; import ssg from "@hono/vite-ssg"; import tailwindcss from "@tailwindcss/vite"; import { defineConfig } from "vite";