@@ -63,43 +63,46 @@ impl Rule for NoAsyncClientComponent {
63
63
}
64
64
65
65
// async function MyComponent() {...}; export default MyComponent;
66
- if let ExportDefaultDeclarationKind :: Identifier ( export_default_id) =
66
+ let ExportDefaultDeclarationKind :: Identifier ( export_default_id) =
67
67
& export_default_decl. declaration
68
- {
69
- let Some ( decl) = get_declaration_of_variable ( export_default_id, ctx) else {
70
- continue ;
71
- } ;
68
+ else {
69
+ continue ;
70
+ } ;
71
+ let Some ( decl) = get_declaration_of_variable ( export_default_id, ctx) else {
72
+ continue ;
73
+ } ;
72
74
73
- if let AstKind :: Function ( func) = decl. kind ( ) {
74
- if func. r#async
75
- && func
76
- . id
77
- . as_ref ( )
78
- // `func.id.name` MUST be > 0 chars
79
- . is_some_and ( |v| v. name . chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) )
80
- {
81
- ctx. diagnostic ( no_async_client_component_diagnostic (
82
- func. id . as_ref ( ) . unwrap ( ) . span ,
83
- ) ) ;
84
- }
75
+ if let AstKind :: Function ( func) = decl. kind ( ) {
76
+ if func. r#async
77
+ && func
78
+ . id
79
+ . as_ref ( )
80
+ // `func.id.name` MUST be > 0 chars
81
+ . is_some_and ( |v| v. name . chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) )
82
+ {
83
+ ctx. diagnostic ( no_async_client_component_diagnostic (
84
+ func. id . as_ref ( ) . unwrap ( ) . span ,
85
+ ) ) ;
85
86
}
87
+ }
88
+
89
+ let AstKind :: VariableDeclarator ( var_declarator) = decl. kind ( ) else {
90
+ continue ;
91
+ } ;
86
92
87
- if let AstKind :: VariableDeclarator ( var_declarator) = decl. kind ( ) {
88
- if let BindingPatternKind :: BindingIdentifier ( binding_ident) =
89
- & var_declarator. id . kind
90
- {
91
- // `binding_ident.name` MUST be > 0 chars
92
- if binding_ident. name . chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) {
93
- if let Some ( Expression :: ArrowFunctionExpression ( arrow_expr) ) =
94
- & var_declarator. init
95
- {
96
- if arrow_expr. r#async {
97
- ctx. diagnostic ( no_async_client_component_diagnostic (
98
- binding_ident. span ,
99
- ) ) ;
100
- }
101
- }
102
- }
93
+ let BindingPatternKind :: BindingIdentifier ( binding_ident) = & var_declarator. id . kind
94
+ else {
95
+ continue ;
96
+ } ;
97
+ // `binding_ident.name` MUST be > 0 chars
98
+ if binding_ident. name . chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) {
99
+ if let Some ( Expression :: ArrowFunctionExpression ( arrow_expr) ) =
100
+ & var_declarator. init
101
+ {
102
+ if arrow_expr. r#async {
103
+ ctx. diagnostic ( no_async_client_component_diagnostic (
104
+ binding_ident. span ,
105
+ ) ) ;
103
106
}
104
107
}
105
108
}
0 commit comments