@@ -152,24 +152,26 @@ impl Rule for CatchErrorName {
152152 }
153153
154154 fn run < ' a > ( & self , node : & AstNode < ' a > , ctx : & LintContext < ' a > ) {
155- if let AstKind :: CatchParameter ( catch_param) = node. kind ( ) {
156- self . check_binding_identifier ( ctx, & catch_param. pattern . kind ) ;
157- }
158-
159- if let AstKind :: CallExpression ( call_expr) = node. kind ( )
160- && let Some ( member_expr) = call_expr. callee . as_member_expression ( )
161- {
162- if member_expr. static_property_name ( ) == Some ( "catch" )
163- && let Some ( arg) = call_expr. arguments . first ( )
164- {
165- self . check_function_arguments ( arg, ctx) ;
155+ match node. kind ( ) {
156+ AstKind :: CatchParameter ( catch_param) => {
157+ self . check_binding_identifier ( ctx, & catch_param. pattern . kind ) ;
166158 }
159+ AstKind :: CallExpression ( call_expr) => {
160+ if let Some ( member_expr) = call_expr. callee . as_member_expression ( ) {
161+ if member_expr. static_property_name ( ) == Some ( "catch" )
162+ && let Some ( arg) = call_expr. arguments . first ( )
163+ {
164+ self . check_function_arguments ( arg, ctx) ;
165+ }
167166
168- if member_expr. static_property_name ( ) == Some ( "then" )
169- && let Some ( arg) = call_expr. arguments . get ( 1 )
170- {
171- self . check_function_arguments ( arg, ctx) ;
167+ if member_expr. static_property_name ( ) == Some ( "then" )
168+ && let Some ( arg) = call_expr. arguments . get ( 1 )
169+ {
170+ self . check_function_arguments ( arg, ctx) ;
171+ }
172+ }
172173 }
174+ _ => { }
173175 }
174176 }
175177}
0 commit comments