From edc3a1d7a75e1cf6ee041a6a0b7031403051e1c0 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Mon, 19 Oct 2026 15:24:24 +0700 Subject: [PATCH] refactor(lint): drop the style-only custom SwiftLint rules --- .claude/rules/theme.md | 4 -- apple/.swiftlint.yml | 91 ------------------------------------------ 2 files changed, 95 deletions(-) diff --git a/.claude/rules/theme.md b/.claude/rules/theme.md index b4892bd9fd..5f27677cc7 100644 --- a/.claude/rules/theme.md +++ b/.claude/rules/theme.md @@ -77,7 +77,3 @@ paths: - **A synced theme is untrusted input.** `ThemeCatalog.applyRemote(category:data:)` checks, in order, the category id (never a built-in id), a 64 KB cap, the nesting depth, a full decode (a newer schema fails here), and the file's id against the category's, and never writes over bytes it has not read. A validation failure is a logged skip. Only a disk failure returns `.failed`, so the coordinator withholds the change token and the pull replays. A remote deletion moves the local file to the Trash through `removeWithoutSync(ids:)`. - **The theme ids sync; the appearance mode does not.** `AppearanceSettings` (category `appearance`) holds only the light and dark theme ids. `AppSettingsManager.appearanceMode` is device-local (`AppSettingsCategory.deviceLocal`, its own defaults key), and a received `appearance` record never changes it. Fonts are device-local too (`.claude/rules/editor.md`). - **`SyncCoordinator.themeContentKind` names `ThemeSchema.current`**, so a Mac that upgrades past a schema bump fetches the zone once and picks up the theme records its older build skipped. After the first full pull, only local themes the server lacks are marked dirty, once. - -## The lint rule - -- **The file list is closed.** SwiftLint's `theme_read_outside_content` names, in its `excluded:` list, every file that may read the theme: a slot, a `palette` or `resolved` read, `activeTheme`, a theme pair, a `ThemeScope`, a carrier, or a helper that reads it (`TreeValueTone.color`, `HighlightedSQLTextView`, `TableProEditorTheme.make()`, `EditorThemeFactory.make(resolved:highlightsCurrentLine:highlightsCurrentStatement:)`, `DetailPaneBackdropFill`, `DetailPaneStatusBarMaterial`). A new content surface joins the list in the same change, and a surface that becomes chrome leaves it. `ThemeBackdropState` and `.paneBarBackground(_:ignoresSafeAreaEdges:)` stay out of the rule's regex, because they are how chrome asks. diff --git a/apple/.swiftlint.yml b/apple/.swiftlint.yml index 3432669b86..d1d0cb0a95 100644 --- a/apple/.swiftlint.yml +++ b/apple/.swiftlint.yml @@ -321,13 +321,6 @@ custom_rules: excluded_match_kinds: [comment, doccomment] message: "Activate through AppActivationPolicyController.shared." severity: error - app_version_outside_bundle_info: - name: "App Version Outside Bundle+AppInfo" - regex: 'Bundle\.main\.(object\(forInfoDictionaryKey:|infoDictionary\?\[)\s*("CFBundle(ShortVersionString|Version)"|kCFBundle(ShortVersionString|Version)Key)' - excluded: ['.*/(Packages|Plugins)/'] - excluded_match_kinds: [comment, doccomment] - message: "Read the app version and build through Bundle+AppInfo (appVersion, buildNumber), so every caller gets the same parse and fallback." - severity: error prompt_takes_focus: name: "Prompt Takes Focus" included: ['.*/(AlertHelper|OperationConfirming)\.swift$'] @@ -335,13 +328,6 @@ custom_rules: excluded_match_kinds: [comment, doccomment] message: "A prompt asks for attention with requestAttention(), it does not take focus." severity: error - toolbar_symbol_outline: - name: "Outline Toolbar Symbol" - regex: '\A(?=[\s\S]*?\b(?:NS(?:Menu)?ToolbarItem|enum SettingsTab)\b)[\s\S]*?^(?![ \t]*//)[^\n]*?"((?:[a-z0-9]+\.)+(?:circle|fill)(?:\.[a-z0-9]+)*|(?:circle|fill)(?:\.[a-z0-9]+)+)"' - capture_group: 1 - excluded: ['.*/(Packages|Plugins)/'] - message: "A toolbar glyph is outline. Take one from ToolbarSymbols." - severity: error toolbar_item_visibility: name: "Toolbar Item Visibility" regex: '\.visibleItems\b|\.isVisible\b(?<=[Ii]tems?[ \t]{0,2}[?!]?[ \t]{0,2}\.isVisible)' @@ -359,13 +345,6 @@ custom_rules: excluded_match_kinds: [comment, doccomment] message: "Toolbar code reads no visibility beyond whether the toolbar is shown." severity: error - swiftui_toolbar_background: - name: "SwiftUI Toolbar Background" - regex: '\.toolbarBackground\(' - excluded: ['.*/(Packages|Plugins)/'] - excluded_match_kinds: [comment, doccomment] - message: "The app has no SwiftUI toolbar. The NSToolbar in MainWindowToolbar is the toolbar." - severity: error reduce_motion_gate: name: "Reduce Motion Gate" regex: '\bwithAnimation\b(?!:|\(nil\))|(?