SwiftLint 'attributes' rule flags property wrappers
trozware opened this issue · 2 comments
trozware commented
The SwiftLint 'attributes' rule states "Attributes should be on their own lines in functions and types, but on the same line as variables and imports"
But it flags property wrapper lines like these with warnings, even though they are not functions or types:
@AppStorage("editorFontSize") var editorFontSize: Double = 14
@SceneStorage("windowTheme") var windowTheme = "dark"
@Environment(\.dismiss) var dismiss
I have opened an issue at SwiftLint for this: realm/SwiftLint#5129 but until it is fixed, it would probably be better to remove this opt-in rule from the default yaml file.
trozware commented
After feedback from the SwiftLint team, I now see that we can get around this by adding an extra option to the attributes rule.
attributes:
always_on_same_line:
- "@IBSegueAction"
- "@IBAction"
- "@NSManaged"
- "@objc"
attributes_with_arguments_always_on_line_above: false
The last line is the addition to what was there before.