-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add explicit category ordering configuration for organizeDeclarations rule #280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for keeping this up to date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @calda !
@@ -27,6 +27,8 @@ | |||
--structthreshold 20 # organizeDeclarations | |||
--enumthreshold 20 # organizeDeclarations | |||
--organizetypes class,struct,enum,extension,actor # organizeDeclarations | |||
--visibilityorder beforeMarks,instanceLifecycle,open,public,package,internal,fileprivate,private # organizeDeclarations | |||
--typeorder nestedType,staticProperty,staticPropertyWithBody,classPropertyWithBody,instanceProperty,instancePropertyWithBody,staticMethod,classMethod,instanceMethod # organizeDeclarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@calda is it expected that there is no classProperty
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no such thing as a stored class property (aka a class property without a body)! Found this out when I was first working on the organizeDeclarations
rule: https://forums.swift.org/t/class-properties/16539
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Good to know.
As of nicklockwood/SwiftFormat#1736, the
organizeDeclarations
rule is now fully configurable, and lets you specify the sort order of declarations. The default behavior of theorganizeDeclarations
is now different from the behavior defined in our style guide. To keep the behavior we want, we can provide our own configuration explicitly.The corresponding configuration that matches our style guide is: