Skip to content

Releases: nicklockwood/SwiftFormat

0.57.2

15 Jul 01:34
Compare
Choose a tag to compare
  • Updated trailingCommas rule to handle function declarations with generic arguments.
  • Updated --trailing-commas always to preserve trailing commas rather than unnecessarily removing trailing commas in some edge cases.
  • Fixed spurious deprecation message when using some non-deprecated options.

0.57.1

14 Jul 13:47
Compare
Choose a tag to compare
  • Fixed issue where trailing commas were unexpectedly removed from initializer argument lists when using --trailing-commas always.
  • Fixed issue where redundantPublic rule didn't handle extensions on types defined in public extensions.
  • Added @Bindable to list of SwiftUI property wrappers used by organizeDeclarations rule.
  • Fixed case-sensitivity issue with preferFileMacro rule.

0.57.0

13 Jul 18:33
Compare
Choose a tag to compare
  • Options now use --kebab-case. Existing option names without dashes remain supported for backwards compatibility. Some options have been renamed to improve clarity.
  • Added support for :this and :previous in comment directives.
  • Added support for formatting code blocks in Markdown files.
  • Added support for multiple --config file arguments.
  • Added singlePropertyPerLine rule to convert property declarations defining multiple properties into separate declarations.
  • Added redundantMemberwiseInit rule to remove explicit memberwise initializers that are identical to the struct's compiler-synthesized initializer.
  • Added redundantPublic rule to remove public access control from properties of internal types.
  • Added modifiersOnSameLine rule to keep declaration modifiers on the same line.
  • Added throwingTests rule to prefer using try and throws in unit tests rather than try!.
  • Added noGuardInTests rule to prefer convert guard statements in unit tests to try #require(...) / #expect(...) or try XCTUnwrap(...) / XCTAssert(...).
  • Added urlMacro rule to convert URL(string: "...")! initializers to a provided #URL("...") macro.
  • Added --trailing-commas collections-only and --trailing-commas multi-element-lists options to trailingCommas rule.
  • Added --type-blank-lines insert option to blankLinesAtStartOfScope and blankLinesAtEndOfScope rules.
  • Added --wrap-string-interpolation option to support disabling line wrapping within string interpolation.
  • Added --line-between-guards option to blankLinesAfterGuardStatements rule.
  • Added support for SARIF output format.
  • Improved performance of the docComments rule.
  • Fixed bug in docComments rule where trailing comments would be converted to doc comments.
  • Fixed bug where redundantNilInit rule would ignore type bodies with conformances.
  • Fixed bug where wrapEnumCases didn't handle some nested types correctly.
  • Fixed issue where # characters in config files couldn't be escaped.
  • Fixed issue where SwiftFormat for Xcode app would generate invalid config files with unescaped # characters.
  • Fixed issue where --wrap-return-type never didn't respect --allman true.

0.56.4

15 Jun 16:16
Compare
Choose a tag to compare
  • Fixed issue where trailingCommas rule would not insert trailing commas in function declarations with return type
  • Fixed issue where trailingCommas rule would not insert trailing commas in array literals following ! operator
  • Fixed issue where unusedArguments rule would ignore function declarations with trailing commas
  • Fixed issue where void rule would not handle () types in typealiases
  • Fixed issue where redundantLet rule did not detect code inside result builders when nested in conditional compilation blocks

0.56.3

05 Jun 01:16
Compare
Choose a tag to compare
  • Fixed issue where trailingCommas rule would insert commas in closure types and tuple types used in typealaises (not supported in Swift 6.1)

0.56.2

27 May 13:36
Compare
Choose a tag to compare
  • Fixed issues where trailingCommas rule would insert commas in @escpaing or @Sendable closure types (not supported in Swift 6.1)
  • Fixed issue where privateStateVariables rule handled @Previewable attributes on previous line incorrectly

0.56.1

14 May 02:58
Compare
Choose a tag to compare
  • Fixed several issues where trailingCommas rule would insert commas in places not actually supported by Swift 6.1
  • Fixed issue where --wrapeffects option would incorrectly unwrap async let properties following function call
  • Fixed issue where redundantEquatable rule would incorrectly remove == implementation in favor of synthesized implementation even if type contained non-Equatable properties like tuples
  • Fixed issue where extensionAccessControl rule would incorrectly hoist public ACL in @preconcurrency conformances
  • Fixed issue where organizeDeclarations rule would sometimes break property declarations with if expression values

0.56.0

13 May 03:21
Compare
Choose a tag to compare
  • Added wrapMultilineFunctionChains rule to wrap chained method calls
  • Added environmentEntry rule to update SwiftUI EnvironmentValues definitions to use the @Entry macro
  • Added redundantEquatable rule to remove explicit Equatable conformances that would be compiler-synthesized
  • Added preferSwiftTesting rule to migrate XCTest-based tests to Swift Testing
  • Added swiftTestingTestCaseNames rule to remove redundant "test" prefix from Swift Testing test case methods
  • Added preferCountWhere rule to prefer count(where:) over filter(_:).count
  • Added fileMacro rule to prefer either #file or #fileID, which have the same behavior in Swift 6 and later
  • Added blankLinesAfterGuardStatements rule to remove blank lines between consecuitve guard statements, and add blank line after last guard statement.
  • Added privateStateVariables rule to add private access control to @State properties
  • Added emptyExtensions rule to remove extensions that contain no declarations or conformances
  • Added --preserveacronyms option to acronyms rule
  • Added --wrapreturntype never option to wrapArguments rule
  • Updated trailingCommas to support Swift 6.1 trailing comma functionality
  • opaqueGenericParameters now supports protocol requirements without a body
  • --wrapeffects and --wrapreturntype now support protocol requirements and closure types
  • Fixed indentation of trailing closures after chained multiline method call when using same-line closing parens
  • blankLinesAtStartOfScope rule now supports switch cases and closure capture / parameter lists
  • Fixed issue where type under organizeDeclarations line count threshold would ignore swiftformat:sort directives
  • Fixed issue where organizeDeclarations rule would unexpectedly remove non-mark comments
  • Compiling SwiftFormat now requires Swift 5.7+
  • SwiftFormat prerelease builds can now be installed via Homebrew using brew install swiftformat --head. Prerelease builds are subject to breaking changes.

0.55.6

02 May 21:44
Compare
Choose a tag to compare
  • Fixed parsing bugs related to parameter packs (repeat, each keywords)
  • Fixed bug where propertyTypes rule could cause build failure in properties with some type
  • Fixed bug where --callsiteparen balanced would have no effect when using --closingparen same-line
  • Fatal error messages now include the name of the currently-running rule
  • Docker build now uses Swift 6.0.3

0.55.5

20 Jan 23:55
Compare
Choose a tag to compare
  • Fixed bug with yodaConditions rule mangling generic function calls
  • Fixed indenting of guard else or opening brace following if/switch expression
  • The organizeDeclarations rule no longer treats properties with didSet as computed
  • Improved formatting support for async and throwing closures