You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the rule idea, format
this issue's title as Rule Request: [Rule Name] and describe:
Why should this rule be added? Share links to existing discussion about what
the community thinks about this.
Swift has introduced a very commonly used protocol named Identifiable. It is used all over the place in SwiftUI. Out of the box, this id should be allowed when type conforms to the protocol. As a user of the library, I don't want to have to have to configure the exclusion list for this rule to include id because that could potentially allow real issues to slip through.
Provide several examples of what would and wouldn't trigger violations.
Shouldn't trigger
struct TaproomAnnotation: Identifiable {
let id: UUID = UUID()
let coordinate: CLLocationCoordinate2D
}
Should trigger
struct TaproomAnnotation {
let id: UUID = UUID()
let coordinate: CLLocationCoordinate2D
}
Should the rule be configurable, if so what parameters should be configurable?
Yes, this is a proposal to allow a configuration point for the existing identifier_name rule. There would be benefits to catch names that are id outside of Identifiable types that should still flag as a warning.
Should the rule be opt-in or enabled by default? Why?
Enabled by default, it is part of the SwiftUI framework. Unlikely that Apple will break their protocol at this point and rename id to identifier.
The text was updated successfully, but these errors were encountered:
I've looked into what it might take to make this work. I'm stuck at the point where I need to get the enclosing type's information for the variable declaration being linted, but I'm not sure how to really do that.
New Issue Checklist
New rule request
Please describe the rule idea, format
this issue's title as
Rule Request: [Rule Name]
and describe:the community thinks about this.
Swift has introduced a very commonly used protocol named Identifiable. It is used all over the place in SwiftUI. Out of the box, this
id
should be allowed when type conforms to the protocol. As a user of the library, I don't want to have to have to configure the exclusion list for this rule to includeid
because that could potentially allow real issues to slip through.Shouldn't trigger
Should trigger
Yes, this is a proposal to allow a configuration point for the existing identifier_name rule. There would be benefits to catch names that are
id
outside of Identifiable types that should still flag as a warning.Enabled by default, it is part of the SwiftUI framework. Unlikely that Apple will break their protocol at this point and rename
id
toidentifier
.The text was updated successfully, but these errors were encountered: