-import SourceKittenFramework
+import SwiftSyntax
 
 private func wrapInSwitch(_ str: String, file: StaticString = #file, line: UInt = #line) -> Example {
     return Example("""

    """, file: file, line: line)
}

public struct SwitchCaseOnNewlineRule: ASTRule, ConfigurationProviderRule, OptInRule {
    public var configuration = SeverityConfiguration(.warning)

    public init() {}

        ]
    )

    public func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor? {
        file.locationConverter.map {
            Visitor(locationConverter: $0)
        }
    }
}

private extension SwitchCaseOnNewlineRule {
    final class Visitor: SyntaxVisitor, ViolationsSyntaxVisitor {
        private(set) var violationPositions: [AbsolutePosition] = []
        private let locationConverter: SourceLocationConverter

        init(locationConverter: SourceLocationConverter) {
            self.locationConverter = locationConverter
            super.init(viewMode: .sourceAccurate)
        }

        override func visitPost(_ node: SwitchCaseSyntax) {
            guard let caseEndLine = locationConverter.location(for: node.label.endPositionBeforeTrailingTrivia).line,
                  case let statementsPosition = node.statements.positionAfterSkippingLeadingTrivia,
                  let statementStartLine = locationConverter.location(for: statementsPosition).line,
                  statementStartLine == caseEndLine else {
                return
            }

            violationPositions.append(node.positionAfterSkippingLeadingTrivia)
        }
    }
}
