realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.46k stars 2.2k forks source link

Rule Request: Alphabetise struct property let / vars. #5541

Open JulesMoorhouse opened 2 months ago

JulesMoorhouse commented 2 months ago

New Issue Checklist

New rule request

Sort let and var propery name alapbetically. However, exclude SwiftUI Views as this would cause an issue with trailing closure syntax. Also id and identifier should be allowed as first items

Triggering:

public struct EmailViewItems: Identifiable {
    public let id = UUID()
    public let button: String
    public let appName: String
    public let address: String

public struct EmailViewItems {
    public let button: String
    public let appName: String
    public let address: String
    public let id = UUID()

Non-triggering:

public struct EmailViewItems: Identifiable {
    public let id = UUID()
    public let appName: String
    public let address: String
    public let button: String

public struct EmailViewItems {
    public let id = UUID()
    public let appName: String
    public let address: String
    public let button: String

struct Icon: View {
    private var image: Image
    private var width: CGFloat
    private var height: CGFloat