Skip to content

Releases: nicklockwood/SwiftFormat

0.58.5

17 Oct 20:17

Choose a tag to compare

  • Fixed regression with indenting of macros (introduced in 0.58.4)
  • Fixed spurious removal of return keyword inside for ... where loops
  • Fixed parsing error with for await case ... loops
  • Added XCTUnwrap to the default exclusion list for hoistTry

0.58.4

16 Oct 06:42

Choose a tag to compare

  • Whitespace is no longer added or removed from blank lines in multiline string literals
  • Fixed trailingComma rule incorrectly inserting commas inside typed throws
  • Fixed issue where opaqueGenericParameters rule could cause build errors with existential types
  • Fixed false positive with unusedArguments when argument is only referenced inside a macro
  • The noGuardInTests rule now preserves custom failure messages
  • The noGuardInTests rule no longer adds throws to test methods when not needed
  • Removed redundant "default" values from options help descriptions

0.58.3

04 Oct 13:38

Choose a tag to compare

  • Fixed parsing of [n of X] syntax for InlineArray in Swift 6.2
  • Fixed parsing error when an opening multiline string delimiter is followed by a space
  • Fixed issue where redundantInit rule could leave orphaned parentheses
  • Fixed bug where redundantInit was incorrectly applied to (Foo.self as Bar.Type) expressions
  • Fixed bug with parsing empty property accessors that broke redundantSelf rule
  • Fixed aliasing issue with acronyms rule where one acronym overlaps another
  • Fixed unexpected wrapping of closing parenthesis in wrapArguments rule
  • Added --unknown-rules option to support environments with older SwiftFormat versions

0.58.2

29 Sep 15:39

Choose a tag to compare

  • Fixed issue where modifierOrder rule confused async effect for async modifier
  • Fixed issue where testing related rules incorrectly treated functions with arguments as test cases
  • Updated redundantInit rule to apply to init calls with single trailing closure
  • Updated README.md to reflect actual precedence behavior between .swift-version files and --swift-version arguments

0.58.1

24 Sep 15:44

Choose a tag to compare

  • Fixed issue where async effect could be confused for async modifier, breaking docCommentsBeforeModifiers rule in protocol body with async functions
  • Fixed issue where wrapAttributes rule would unexpectedly wrap async effect
  • Fixed issue where .swift-version file was ignored if not also using config file
  • Fixed issue where multiple trailing closure syntax could be applied to ineligible function calls
  • Fixed issue where redundantAsync ignored await keyword in string interpolation
  • Fixed bug where acronyms rule would incorrectly always capitalize potentially matching acronyms one letter before end of identifier
  • Updated redundantLet rule to handle #Preview macro

0.58.0

23 Sep 02:17

Choose a tag to compare

  • Added noForceUnwrapInTests rule
  • Added redundantThrows rule
  • Added redundantAsync rule
  • Added preferFinalClasses rule
  • Added support for Swift 6.2 raw identifiers
  • Updated trailingCommas rule to handle cases now supported by Swift 6.2
  • Updated trailingClosures rule to support multiple trailing closures
  • Added support for filtering config file options to a specific file path glob
  • Added --allow-partial-wrapping false option to disallow partial wrapping of functions and collections
  • Updated propertyTypes rule to support array, dictionary, and set literals
  • Added organizeDeclarations threshold options to organize types without adding marks
  • Added --type-body-marks remove option to organizeDeclarations
  • Updated organizeDeclarations to support organizing protocol bodies
  • Added --blank-line-after-switch-case always option to blankLineAfterSwitchCase
  • Added --default-test-suite-attributes option to preferSwiftTesting rule
  • Renamed --markdown-files options to strict and lenient
  • Updated redundantPublic rule to apply to private types
  • Updated trailingClosures and trailingCommas rules to support optional function calls
  • Fixed bug where markTypes rule wouldn't add marks after extensions
  • Fixed issue where redundantPublic broke @_spi annotated members
  • Improved parsing of nested markdown code blocks
  • Fixed issue where hoistTry rule could break @Test attribute
  • Fixed issue where redundantVoidReturnType rule could accidentally remove closure type
  • Fix blankLinesAroundMark not ignoring trailing comments at start of scope
  • Renamed throwingTests rule to noForceTryInTests
  • Updated singlePropertyPerLine to preserve async let declarations

0.57.2

15 Jul 01:34

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

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

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

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