Releases: airbnb/swift
Releases · airbnb/swift
1.0.7
What's Changed
- Update to SwiftFormat build based on 0.53.0 release by @calda in #255
- Add rule to avoid using semicolons by @calda in #260
- Fix markdown formatting of else-on-same-line rule by @calda in #258
- Add rule to insert a blank line following a switch case with a multi-line body by @calda in #259
- Update Swift version and SwiftFormat build by @calda in #264
- Add rule to use doc comments before declarations by @calda in #262
Full Changelog: 1.0.6...1.0.7
1.0.6
What's Changed
- Include version-specific package manifests when determining default minimum Swift version by @calda in #235
- Update to SwiftLint 0.52.1 by @calda in #239
- Add rule to avoid using
@unchecked Sendable
by @calda in #237 - Add rule to prefer weak captures over unowned captures by @calda in #238
- Fix issue where linter would disallow "@unchecked Sendable" string in comments by @calda in #241
- Improve discussion and examples for rule to avoid unowned captures by @calda in #240
- Fix issue where package plugin wouldn't run SwiftLint lint-only rules unless passing in
--lint
flag by @calda in #242 - Update to SwiftFormat 0.53 by @calda in #243
- Improve unit tests by @calda in #244
- Fix some typos in README by @Jager-yoo in #246
- Update Package.swift by @elfredpagan in #247
- Soften wording for rule to avoid using default in switch statements by @calda in #245
- Update to Swift 5.9 by @calda in #248
- Update omit-return rule discussion to include examples using if/swift expressions by @calda in #249
- Specify
--shortoptionals always
option explicitly since default was updated toexcept-properties
by @calda in #251 - Use
sortImports
rule instead of deprecatedsortedImports
rule by @calda in #252 - Add rule to add a line break after the assignment operator before a multi-line
if
orswitch
expressions by @calda in #253 - Add rule to prefer using if/switch expressions when initializing a new property with the result of a conditional statement by @calda in #250
- Add rules for how to wrap attributes on property declarations by @calda in #254
Full Changelog: 1.0.5...1.0.6
1.0.5
What's Changed
- Add rule that protocol composition type aliases should be sorted alphabetically by @calda in #227
- Add rule that else statements should start on the same line as previous closing brace by @calda in #229
- Add rule to add a linebreak before the else keyword in a multi-line guard statement by @calda in #228
- Add rules to discourage #file and #filePath by @jqsilver in #231
- Add
package
keyword to list of declaration categories by @calda in #232 - Add rule to omit
internal
keyword from declarations with internal access control by @calda in #233 - Add rule to prefer for loops over functional
forEach { ... }
method by @calda in #234
Full Changelog: 1.0.4...1.0.5
1.0.4
What's Changed
Swift Package Plugin
- Update linter config to ignore Carthage, Pods, and .build directories by @interactord in #219
- Update SwiftFormat version to 0.51.8 by @calda in #223
- Update SwiftFormat --swiftversion to 5.8 by @calda in #225
- Test multiple Xcode versions in CI by @calda in #224
Swift Style Guide
- Fix broken SE-0156 link by @hanton in #207
- Include a missing space after some comment delimiters by @Jager-yoo in #208
- Clarify Rule: Name unused function parameters as underscores by @Jager-yoo in #210
- Clarify Rule: Never use the default case when switching over an enum by @teddy5518 in #214
- Clarify Rule: Use Swift's automatic enum values unless they map to an external source. by @teddy5518 in #215
- Clarify Rule: Use Swift's automatic enum values unless they map to an external source. by @teddy5518 in #216
- Clarify Rule: Multi-line arrays should have each bracket on a separate line. by @teddy5518 in #217
- Clarify Rule: Use caseless enums for organizing public or internal constants and functions into namespaces. by @teddy5518 in #218
- Fix typos in README.md by @teddy5518 in #220
Full Changelog: 1.0.3...1.0.4
1.0.3
What's Changed
- Bump SwiftFormat version by @calda in #201
- Fix typos in Rule 'prefer opaque generic parameter syntax' by @Jager-yoo in #202
- Update
prefer-opaque-generic-parameters
XCTest example to pass throughfile
andline
by @bachand in #204 - Update language around when an underscore prefix may be appropriate by @bachand in #203
- Update
Package.swift
to explicitly not support Linux by @calda in #206 - Update rule for long function declarations to specify effects (
async
,throws
) should be written on the line after the closing paren by @calda in #205
Full Changelog: 1.0.2...1.0.3
1.0.2
Swift Style Guide
- Added rule to prefer shorthand
if let
optional unwrapping syntax (#192) - Added rule to prefer simplified generic extension syntax (#194)
- Added rule to prefer opaque generic parameter syntax (#193)
- Added rule to prefer trailing closure syntax for closure arguments with no parameter name (#199)
SPM package plugin
- Improved handling of
--swift-format
and--exclude
arguments (#182)
1.0.1
- The package plugin now uses precompiled binary dependencies for SwiftFormat and SwiftLint instead of compiling them from source. This resolves an issue where SPM would reject
.package(url: "https://github.com/airbnb/swift", from: "1.0.0")
as invalid. - The package plugin now automatically infers the package Swift version from the
// swift-tools-version
comment in yourPackage.swift
file. You can customize this by calling the plugin with a--swift-version
argument. - Added
XcodeCommandPlugin
to support using the package plugin in Xcode 14 project workspaces
1.0.0
🆕 Swift Package Manager command plugin
This repo now includes a Swift Package Manager command plugin that you can use to automatically reformat or lint your package according to the style guide. To use this command plugin with your package, all you need to do is add this repo as a dependency:
dependencies: [
.package(url: "https://github.com/airbnb/swift", from: "1.0.0"),
]
and then run the format
command plugin in your package directory:
$ swift package format
Usage guide
# Supported in Xcode 14+. Prompts for permission to write to the package directory.
$ swift package format
# When using the Xcode 13 toolchain, or a noninteractive shell, you must use:
$ swift package --allow-writing-to-package-directory format
# To just lint without reformatting, you can use `--lint`:
$ swift package format --lint
# By default the command plugin runs on the entire package directory.
# You can exclude directories using `exclude`:
$ swift package format --exclude Tests
# Alternatively you can explicitly list the set of paths and/or SPM targets:
$ swift package format --paths Sources Tests Package.swift
$ swift package format --targets AirbnbSwiftFormatTool