From 61be9fcdfa8557b064dd9523c22e491a7def5067 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 20 Aug 2026 15:57:56 +0200 Subject: [PATCH] chore: update eslint and stylelint configs and re-sync `modern-normalize` (#38982) - update the vendored `modern-normalize` to v3.0.1 - require descriptions for lint disables in TS and CSS, same as we already have in Go. - disable core rules covered by `regexp/*` and `unicorn/*`, and ones that cannot fire - stop applying vitest rules to the playwright files in `tests/e2e` - enable 7 stylelint rules, mostly `no-unknown` and `no-invalid` checks - drop 2 unnecessary vendor prefixes (safari v17+, chrome v120+) - look up ids via `querySelector` with `CSS.escape` instead of `getElementById` - remove stale doc about `@ts-expect-error`, it's forbidden - misc dev doc fixes Every declaration that `modern-normalize` v3 removes was checked against chromium, webkit and firefox defaults first. The `hr` color and the `:-moz-focusring` outline are kept as documented deviations, dropping those does change rendering. --------- Signed-off-by: silverwind Co-authored-by: wxiaoguang --- docs/guidelines-frontend.md | 15 +++-- eslint.config.ts | 13 ++-- stylelint.config.ts | 8 +++ tests/e2e/file-view-render.test.ts | 2 +- tests/e2e/webauthn.test.ts | 2 +- .../unescaped-html-literal.test.ts | 2 +- web_src/css/base.css | 1 - web_src/css/font_i18n.css | 40 ++++++------ web_src/css/modules/button.css | 2 +- web_src/css/modules/form.css | 1 - web_src/css/modules/normalize.css | 65 ++++--------------- web_src/js/features/admin/config.ts | 2 +- web_src/js/features/common-page.ts | 13 ++-- web_src/js/features/comp/EditorMarkdown.ts | 2 +- web_src/js/features/comp/LabelEdit.ts | 2 +- web_src/js/features/repo-diff.ts | 6 +- web_src/js/features/repo-editor.ts | 2 +- web_src/js/features/repo-issue-list.ts | 2 +- web_src/js/features/repo-projects.ts | 6 +- web_src/js/features/tribute.ts | 2 +- web_src/js/globals.ts | 2 +- web_src/js/index.ts | 2 +- web_src/js/markup/anchors.ts | 6 +- web_src/js/markup/render-iframe.test.ts | 2 +- .../fetch-action.test.ts} | 2 +- .../fetch-action.ts} | 18 +++-- web_src/js/modules/fetch.ts | 2 +- web_src/js/modules/user-settings.ts | 2 +- web_src/js/modules/worker.test.ts | 2 +- web_src/js/swagger.ts | 2 +- web_src/js/utils/image.test.ts | 2 +- web_src/js/webcomponents/overflow-menu.ts | 4 +- 32 files changed, 97 insertions(+), 137 deletions(-) rename web_src/js/{features/common-fetch-action.test.ts => modules/fetch-action.test.ts} (97%) rename web_src/js/{features/common-fetch-action.ts => modules/fetch-action.ts} (96%) diff --git a/docs/guidelines-frontend.md b/docs/guidelines-frontend.md index 61a801ba384..68b33481843 100644 --- a/docs/guidelines-frontend.md +++ b/docs/guidelines-frontend.md @@ -6,7 +6,7 @@ and testing see [development.md](development.md) and [testing.md](testing.md). ## Background -The frontend uses [Vue 3](https://vuejs.org/), [Fomantic-UI](https://fomantic-ui.com/) (built on jQuery) +The frontend uses [Vue 3](https://vuejs.org/), hard-forked Fomantic-UI (built on jQuery) and [Tailwind CSS](https://tailwindcss.com/). Pages are rendered with Go HTML templates. Source files live in: @@ -44,8 +44,10 @@ Gitea uses Vue 3 **without** JSX to keep HTML and JavaScript separate. ## Gitea-specific conventions - Keep features in their own files or directories. -- Use kebab-case for HTML `id`s and classes, ideally with 2-3 feature keywords. +- Use kebab-case for HTML `id`s and classes with 2-3 feature keywords. - Prefix classes to avoid short-name conflicts between different frameworks. +- Our framework can automatically link "input" and "label" if they are the children of a `.field` element, + no need to write `id`/`for` attributes for them unless there are reasons to do so. - Create a new class name when overriding framework styles instead of editing the framework's own classes, or fix the framework's source to fix all cases. - Prefer semantic elements such as `