-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
file_types_order: false positive with PreviewProvider subclasses in SwiftUI #2860
Comments
Fixing this rule will become even more of an issue with SwiftUI with structs derived from
|
@timbms I agree that it doesn't make sense to put the |
@weakfl That's actually the expected behavior. When there are multiple classes within a file, the class whose names matches the file name is considered to be the main type and thus other types (including classes) are declared The best way to make sure the rule works correctly is to use it together with the File Name rule and to separate main types always into their own files, only keeping supporting types in a single file with the main type. |
@weakfl And I find it counter-intuitive to find two main types in a single Swift file. A subclass should always be in its own file in my opinion. At least in projects where it would make sense to enable this rule. |
Fixes #2860. Co-authored-by: Paul Taykalo <tt.kilew@gmail.com>
Fixes realm#2860. Co-authored-by: Paul Taykalo <tt.kilew@gmail.com>
New Issue Checklist
Describe the bug
file_types_order
triggers when multiple classes are declared in the same file:Environment
0.35.0
Homebrew
The text was updated successfully, but these errors were encountered: