-import SourceKittenFramework
+import SwiftSyntax
 
-public struct ExplicitEnumRawValueRule: ASTRule, OptInRule, ConfigurationProviderRule {
+public struct ExplicitEnumRawValueRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule {
     public var configuration = SeverityConfiguration(.warning)
 
     public init() {}

            "NSDecimalNumber", "NSInteger", "String"
        ]

        let enumInheritedTypesSet = Set(dictionary.inheritedTypes)

        guard !implicitRawValueSet.isDisjoint(with: enumInheritedTypesSet) else {
            return []
        }

        let violations = violatingOffsetsForEnum(dictionary: dictionary)
        return violations.map {
            StyleViolation(ruleDescription: Self.description,
                           severity: configuration.severity,
                           location: Location(file: file, byteOffset: $0))
        }
    }

    private func violatingOffsetsForEnum(dictionary: SourceKittenDictionary) -> [ByteCount] {
        let locs = substructureElements(of: dictionary, matching: .enumcase)
            .compactMap { substructureElements(of: $0, matching: .enumelement) }
            .flatMap(enumElementsMissingInitExpr)
            .compactMap { $0.offset }

        return locs
    }

    private func substructureElements(of dict: SourceKittenDictionary,
                                      matching kind: SwiftDeclarationKind) -> [SourceKittenDictionary] {
        return dict.substructure
            .filter { $0.declarationKind == kind }
    }

    private func enumElementsMissingInitExpr(
        _ enumElements: [SourceKittenDictionary]) -> [SourceKittenDictionary] {
        return enumElements
            .filter { !$0.elements.contains { $0.kind == "source.lang.swift.structure.elem.init_expr" } }
    }
}

            enum Numbers: Decimal {
              case ↓one, ↓two
            }
            """),
            Example("""
            enum Outer {
                enum Numbers: Decimal {
                  case ↓one, ↓two
                }
            }
            """)
        ]
    )

    public func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor? {
        Visitor(viewMode: .sourceAccurate)
    }
}

private extension ExplicitEnumRawValueRule {
    final class Visitor: SyntaxVisitor, ViolationsSyntaxVisitor {
        private(set) var violationPositions: [AbsolutePosition] = []

        override func visitPost(_ node: EnumCaseElementSyntax) {
            if node.rawValue == nil,
               let enclosingEnum = Syntax(node).enclosingEnum(),
               let inheritance = enclosingEnum.inheritanceClause,
               inheritance.supportsRawValue {
                violationPositions.append(node.identifier.positionAfterSkippingLeadingTrivia)
            }
        }
    }
}

private extension Syntax {
    func enclosingEnum() -> EnumDeclSyntax? {
        if let node = self.as(EnumDeclSyntax.self) {
            return node
        }

        return parent?.enclosingEnum()
    }
}

private extension TypeInheritanceClauseSyntax {
    var supportsRawValue: Bool {
        // Check if it's an enum which supports raw values
        let implicitRawValueSet: Set<String> = [
            "Int", "Int8", "Int16", "Int32", "Int64",
