Skip to content
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

SwiftLint 'attributes' rule flags property wrappers #365

Closed
trozware opened this issue Jul 17, 2023 · 2 comments
Closed

SwiftLint 'attributes' rule flags property wrappers #365

trozware opened this issue Jul 17, 2023 · 2 comments

Comments

@trozware
Copy link

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
Copy link
Author

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.

@trozware
Copy link
Author

I've created a pull request with this addition: #367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant