-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy path.swiftlint.yml
More file actions
134 lines (114 loc) · 5.36 KB
/
Copy path.swiftlint.yml
File metadata and controls
134 lines (114 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
cyclomatic_complexity:
warning: 15
error: 20
function_body_length:
warning: 75
error: 100
disabled_rules:
- todo
- trailing_whitespace
- trailing_comma
- trailing_newline
- identifier_name
- type_name
- multiple_closures_with_trailing_closure
- type_body_length
- line_length
- opening_brace
- leading_whitespace
- void_function_in_ternary
opt_in_rules:
- sorted_imports
included:
- ios
excluded:
- .build
- "**/build"
- "**/.build"
- "**/checkouts"
- "**/SourcePackages"
- derived_data
- DerivedData
- ios/Packages/SnapshotTestingLib
- ios/build
- vendor/bundle
- ios-framework/build
custom_rules:
no_theme_property_wrapper:
name: "Legacy @Theme property wrapper"
regex: '@Theme\s+(private\s+)?var'
message: "Use .appHeadline(), .foregroundStyle(.appPrimary), or @Environment(\\.appTheme) instead."
severity: error
no_hardcoded_font_size:
name: "Hardcoded font size"
regex: '\.font\(\.system\(size:\s*\d'
message: "Use theme typography (theme.typography.x) or an .app*() modifier."
severity: error
no_semantic_system_font:
name: "Semantic system font"
regex: '\.font\(\.(largeTitle|title|title2|title3|headline|subheadline|body|callout|footnote|caption|caption2)\)'
message: "Use .textStyle(theme.typography.x) or an .app*() typography modifier instead of system semantic fonts."
severity: error
no_font_with_typography_token:
name: "Typography token in .font()"
regex: '\.font\([^)]*typography'
message: "Apply typography with .textStyle(theme.typography.x), not .font(...). .font() drops the token's tracking and line height. Use .textStyle(...) for Text and SF Symbols alike."
severity: error
no_inline_font_construction:
name: "Inline font construction"
regex: '\.font\(\s*(?:Font\.|\.)(?!system\b)\w+\('
message: "Do not build fonts inline in views, for example .font(.workSans(...)) or .font(.custom(...)). Apply a typography token with .textStyle(theme.typography.x)."
severity: error
no_literal_foreground_color:
name: "Literal foregroundColor"
regex: '\.foregroundColor\((Color\.|\.)(white|black|gray|red|blue|green|yellow|orange|pink|purple|accentColor)[\.)]'
message: "Use .foregroundStyle(.appPrimary/.appOnSurface/...) instead."
severity: error
no_literal_foreground_style:
name: "Literal foregroundStyle system color"
regex: '\.foregroundStyle\((Color\.|\.)(black|gray|red|blue|green|yellow|orange|pink|purple|secondary|primary|accentColor)[\.)]'
message: "Use .foregroundStyle(.appOnSurface/.appOnSurfaceVariant/...) or theme.colors.* instead. .white is allowed for always-light foregrounds over imagery."
severity: error
no_system_tint:
name: "System tint color"
regex: '\.tint\((Color\.|\.)(accentColor|white|black|gray|red|blue|green|yellow|orange|pink|purple|secondary|primary)[\.)]'
message: "Use theme.colors.* (e.g., .tint(theme.colors.accent)) instead of system colors."
severity: error
no_literal_background:
name: "Literal background color"
regex: '\.background\((Color\.|\.)(white|black|gray|red|blue|green|yellow|orange|pink|purple|secondary|primary|accentColor)[\.)]'
message: "Use .background(.appBackground/.appSurface/...) or theme.colors.* instead of system colors."
severity: error
no_literal_fill:
name: "Literal fill color"
regex: '\.fill\((Color\.|\.)(white|black|gray|red|blue|green|yellow|orange|pink|purple|secondary|primary|accentColor)[\.)]'
message: "Use theme.colors.* or .app*() style modifiers instead of system colors in .fill()."
severity: error
no_literal_stroke:
name: "Literal stroke color"
regex: '\.(stroke|strokeBorder)\((Color\.|\.)(white|black|gray|red|blue|green|yellow|orange|pink|purple|secondary|primary|accentColor)[\.,)]'
message: "Use theme.colors.* or .app*() style modifiers instead of system colors in .stroke()/.strokeBorder()."
severity: error
no_literal_border:
name: "Literal border color"
regex: '\.border\((Color\.|\.)(white|black|gray|red|blue|green|yellow|orange|pink|purple|secondary|primary|accentColor)[\.,)]'
message: "Use theme.colors.* or .app*() style modifiers instead of system colors in .border()."
severity: error
no_raw_color_init:
name: "Raw Color/UIColor initializer in view code"
regex: '\b(Color|UIColor)\((red|white|hue): *-?[0-9]'
excluded: ".*(Theme|DesignSystem)/Colors/.*"
message: "Define new colors in the DesignSystem color schemes, not inline with raw RGB/grayscale initializers."
severity: error
no_uikit_system_color:
name: "UIKit system color in view code"
regex: 'Color\(UIColor\.|Color\(uiColor:|Color\(\.system'
excluded: ".*(Theme|DesignSystem)/Colors/.*"
message: "Use theme.colors.* or .app*() style modifiers instead of UIKit system colors."
severity: error
no_hex_color_in_views:
name: "Hex Color initializer in view code"
regex: 'Color\(hex:'
excluded: ".*(Theme|DesignSystem)/Colors/.*"
message: "Hex colors belong in theme implementations, not in views."
severity: error