swift /
airbnb.swiftformat
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152# Exclude checkout directories for common package managers
--exclude Carthage,Pods,.build
# options
--swift-version 6.2
--language-mode 5
--self remove # redundantSelf
--import-grouping testable-bottom # sortedImports
--trailing-commas multi-element-lists # trailingCommas
--trim-whitespace always # trailingSpace
--indent 2 #indent
--ifdef no-indent #indent
--indent-strings true #indent
--wrap-arguments before-first # wrapArguments
--wrap-parameters before-first # wrapArguments
--wrap-collections before-first # wrapArguments
--wrap-conditions before-first # wrapArguments
--wrap-return-type never #wrapArguments
--wrap-effects never #wrapArguments
--closing-paren balanced # wrapArguments
--call-site-paren balanced # wrapArguments
--wrap-type-aliases before-first # wrapArguments
--allow-partial-wrapping false # wrapArguments
--func-attributes prev-line # wrapAttributes
--computed-var-attributes prev-line # wrapAttributes
--stored-var-attributes same-line # wrapAttributes
--complex-attributes prev-line # wrapAttributes
--type-attributes prev-line # wrapAttributes
--wrap-ternary before-operators # wrap
--wrap-string-interpolation preserve # wrap
--mark-struct-threshold 20 # organizeDeclarations
--mark-enum-threshold 20 # organizeDeclarations
--organize-types class,struct,enum,extension,actor,protocol # organizeDeclarations
--visibility-order beforeMarks,instanceLifecycle,open,public,package,internal,fileprivate,private # organizeDeclarations
--type-order nestedType,staticProperty,staticPropertyWithBody,classPropertyWithBody,swiftUIPropertyWrapper,instanceProperty,instancePropertyWithBody,staticMethod,classMethod,instanceMethod # organizeDeclarations
--sort-swiftui-properties first-appearance-sort #organizeDeclarations
--type-body-marks remove #organizeDeclarations
--extension-acl on-declarations # extensionAccessControl
--pattern-let inline # hoistPatternLet
--property-types inferred # redundantType, propertyTypes
--type-blank-lines preserve # blankLinesAtStartOfScope, blankLinesAtEndOfScope
--empty-braces spaced # emptyBraces
--ranges preserve # spaceAroundOperators
--operator-func no-space # spaceAroundOperators
--some-any disabled # opaqueGenericParameters
--else-position same-line # elseOnSameLine
--guard-else next-line # elseOnSameLine
--single-line-for-each convert # preferForLoop
--short-optionals always # typeSugar
--semicolons never # semicolons
--doc-comments preserve # docComments
--prefer-synthesized-init-for-internal-structs View,ViewBuilder # redundantMemberwiseInit
# Customized default modifier order to put `override` after access control
--modifier-order private,fileprivate,internal,package,public,open,private(set),fileprivate(set),internal(set),package(set),public(set),open(set),override,final,dynamic,optional,required,convenience,indirect,isolated,nonisolated,nonisolated(unsafe),lazy,weak,unowned,unowned(safe),unowned(unsafe),static,class,borrowing,consuming,mutating,nonmutating,prefix,infix,postfix,async # modifierOrder
# We recommend a max width of 100 but _strictly enforce_ a max width of 130
--max-width 130 # wrap
# rules
--rules anyObjectProtocol
--rules blankLinesBetweenScopes
--rules consecutiveSpaces
--rules consecutiveBlankLines
--rules duplicateImports
--rules extensionAccessControl
--rules environmentEntry
--rules hoistPatternLet
--rules indent
--rules markTypes
--rules organizeDeclarations
--rules redundantParens
--rules redundantReturn
--rules redundantSelf
--rules redundantType
--rules redundantPattern
--rules redundantGet
--rules redundantFileprivate
--rules redundantRawValues
--rules redundantEquatable
--rules sortImports
--rules sortDeclarations
--rules strongifiedSelf
--rules trailingCommas
--rules trailingSpace
--rules linebreakAtEndOfFile
--rules typeSugar
--rules wrap
--rules wrapMultilineStatementBraces
--rules wrapArguments
--rules wrapAttributes
--rules wrapEnumCases
--rules singlePropertyPerLine
--rules braces
--rules redundantClosure
--rules redundantInit
--rules redundantVoidReturnType
--rules redundantOptionalBinding
--rules redundantInternal
--rules redundantPublic
--rules redundantProperty
--rules unusedArguments
--rules spaceInsideBrackets
--rules spaceInsideBraces
--rules spaceAroundBraces
--rules spaceInsideParens
--rules spaceAroundParens
--rules spaceAroundOperators
--rules enumNamespaces
--rules blockComments
--rules docComments
--rules docCommentsBeforeModifiers
--rules spaceAroundComments
--rules spaceInsideComments
--rules blankLinesAtStartOfScope
--rules blankLinesAtEndOfScope
--rules emptyBraces
--rules andOperator
--rules opaqueGenericParameters
--rules genericExtensions
--rules trailingClosures
--rules elseOnSameLine
--rules sortTypealiases
--rules preferForLoop
--rules conditionalAssignment
--rules wrapMultilineConditionalAssignment
--rules wrapFunctionBodies
--rules wrapPropertyBodies
--rules void
--rules blankLineAfterSwitchCase
--rules consistentSwitchCaseSpacing
--rules semicolons
--rules propertyTypes
--rules blankLinesBetweenChainedFunctions
--rules emptyExtensions
--rules preferCountWhere
--rules swiftTestingTestCaseNames
--rules modifiersOnSameLine
--rules noForceTryInTests
--rules noForceUnwrapInTests
--rules redundantThrows
--rules redundantAsync
--rules noGuardInTests
--rules testSuiteAccessControl
--rules validateTestCases
--rules redundantMemberwiseInit
--rules redundantBreak
--rules redundantTypedThrows
--rules preferFinalClasses
--rules simplifyGenericConstraints
--rules redundantViewBuilder