Fix linting

This commit is contained in:
Sindre Sorhus 2022-05-03 21:58:13 +07:00
parent 94b4c9278c
commit 5e453238c1
4 changed files with 17 additions and 5 deletions

View File

@ -23,11 +23,13 @@ only_rules:
- discarded_notification_center_observer
- discouraged_assert
- discouraged_direct_init
- discouraged_none_name
- discouraged_object_literal
- discouraged_optional_boolean
- discouraged_optional_collection
- duplicate_enum_cases
- duplicate_imports
- duplicated_key_in_dictionary_literal
- dynamic_inline
- empty_collection_literal
- empty_count
@ -136,7 +138,6 @@ only_rules:
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- void_return
- weak_delegate
- xct_specific_matcher
- xctfail_message
- yoda_condition
@ -159,12 +160,14 @@ identifier_name:
excluded:
- 'x'
- 'y'
- 'z'
- 'a'
- 'b'
- 'x1'
- 'x2'
- 'y1'
- 'y2'
- 'z2'
deployment_target:
macOS_deployment_target: '10.11'
custom_rules:
@ -180,12 +183,19 @@ custom_rules:
regex: '\bNSPoint\b'
match_kinds: typeidentifier
message: 'Use CGPoint instead of NSPoint'
no_cgfloat:
regex: '\bCGFloat\b'
match_kinds: typeidentifier
message: 'Use Double instead of CGFloat'
no_cgfloat2:
regex: '\bCGFloat\('
message: 'Use Double instead of CGFloat'
swiftui_state_private:
regex: '@(State|StateObject|ObservedObject|EnvironmentObject)\s+var'
message: "SwiftUI @State/@StateObject/@ObservedObject/@EnvironmentObject properties should be private"
message: 'SwiftUI @State/@StateObject/@ObservedObject/@EnvironmentObject properties should be private'
swiftui_environment_private:
regex: '@Environment\(\\\.\w+\)\s+var'
message: "SwiftUI @Environment properties should be private"
message: 'SwiftUI @Environment properties should be private'
final_class:
regex: '^class [a-zA-Z\d]+[^{]+\{'
message: "Classes should be marked as final whenever possible. If you actually need it to be subclassable, just add `// swiftlint:disable:next final_class`."
message: 'Classes should be marked as final whenever possible. If you actually need it to be subclassable, just add `// swiftlint:disable:next final_class`.'

View File

@ -33,6 +33,7 @@ final class CallbackMenuItem: NSMenuItem {
@available(*, unavailable)
required init(coder decoder: NSCoder) {
// swiftlint:disable:next fatal_error_message
fatalError()
}

View File

@ -16,7 +16,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
],
targets: [
.target(

View File

@ -31,6 +31,7 @@ enum CarbonKeyboardShortcuts {
// `SSKS` is just short for `Sindre Sorhus Keyboard Shortcuts`.
// Using an integer now that `UTGetOSTypeFromString("SSKS" as CFString)` is deprecated.
// swiftlint:disable:next number_separator
private static let hotKeySignature: UInt32 = 1397967699 // OSType => "SSKS"
private static var hotKeyId = 0