Skip to content

Commit

Permalink
Add emptyExtension rule
Browse files Browse the repository at this point in the history
  • Loading branch information
mannylopez committed Aug 1, 2024
1 parent 77b4f2d commit b8406b8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4002,6 +4002,35 @@ _You can enable the following settings in Xcode by running [this script](resourc
```

</details>

* <a id='remove-empty-extensions'></a>(<a href='#remove-empty-extensions'>link</a>) **Remove empty, non-conforming, extensions.** [![SwiftFormat: emptyExtension](https://img.shields.io/badge/SwiftFormat-emptyExtension-008489.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#emptyExtension)

<details>

#### Why?
Improves readability since the code has no effect and should be removed for clarity.

```swift
// WRONG
extension String {}

extension [Foo: Bar] {}

extension Array where Element: Foo {}

extension String: Equatable {}

@GenerateBoilerPlate
extension Foo {}

// RIGHT
extension String: Equatable {}

@GenerateBoilerPlate
extension Foo {}
```

</details>

**[ back to top](#table-of-contents)**

Expand Down
3 changes: 2 additions & 1 deletion Sources/AirbnbSwiftFormatTool/airbnb.swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@
--rules consistentSwitchCaseSpacing
--rules semicolons
--rules propertyType
--rules blankLinesBetweenChainedFunctions
--rules blankLinesBetweenChainedFunctions
--rules emptyExtension

0 comments on commit b8406b8

Please sign in to comment.