diff --git a/README.md b/README.md index a83c4f4..a2c9b58 100644 --- a/README.md +++ b/README.md @@ -4002,6 +4002,25 @@ _You can enable the following settings in Xcode by running [this script](resourc ``` + +* (link) **Remove empty extensions that define no properties, functions, or conformances.** [![SwiftFormat: emptyExtension](https://img.shields.io/badge/SwiftFormat-emptyExtension-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#emptyExtension) + +
+ + #### Why? + Improves readability since the code has no effect and should be removed for clarity. + + ```swift + // WRONG: The first extension is empty and redundant. + extension Planet {} + + extension Planet: Equatable {} + + // RIGHT: Empty extensions that add a protocol conformance aren't redundant. + extension Planet: Equatable {} + ``` + +
**[⬆ back to top](#table-of-contents)** diff --git a/Sources/AirbnbSwiftFormatTool/airbnb.swiftformat b/Sources/AirbnbSwiftFormatTool/airbnb.swiftformat index a0f76d6..c9a0cdc 100644 --- a/Sources/AirbnbSwiftFormatTool/airbnb.swiftformat +++ b/Sources/AirbnbSwiftFormatTool/airbnb.swiftformat @@ -108,4 +108,5 @@ --rules consistentSwitchCaseSpacing --rules semicolons --rules propertyType ---rules blankLinesBetweenChainedFunctions \ No newline at end of file +--rules blankLinesBetweenChainedFunctions +--rules emptyExtension