You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: use_hook_at_top_level.rs
    path of file: ./repos/biome/crates/biome_js_analyze/src/semantic_analyzers/correctness
    
    the code of the file until where you have to start completion: use crate::react::hooks::{is_react_component, is_react_hook, is_react_hook_call};
use crate::semantic_services::{SemanticModelBuilderVisitor, SemanticServices};
use biome_analyze::RuleSource;
use biome_analyze::{
    context::RuleContext, declare_rule, AddVisitor, FromServices, MissingServicesDiagnostic, Phase,
    Phases, QueryMatch, Queryable, Rule, RuleDiagnostic, RuleKey, ServiceBag, Visitor,
    VisitorContext, VisitorFinishContext,
};
use biome_console::
    
    fn diagnostic(_: &RuleContext<Self>, suggestion: &Self::State) -> Option<RuleDiagnostic> {
        match suggestion {
            Suggestion::None {
                hook_name_range,
                path,
                early_return,
                is_nested,
            } => {
                let call_depth = path.len() - 1;

                let mut diag = if *is_nested {
                    RuleDiagnostic::new(
                        rule_category!(),
                        hook_name_range,
                        markup! {
                            "This hook is being called from a nested function, but all hooks must be called unconditionally from the top-level component."
                        },
                    )
                } else if call_depth == 0 {
                    RuleDiagnostic::new(
                        rule_category!(),
                        hook_name_range,
                        markup! {
                            "This hook is being called conditionally, but all hooks must be called in the exact same order in every component render."
                        },
                    )
                } else {
                    RuleDiagnostic::new(
                        rule_category!(),
                        hook_name_range,
                        markup! {
                            "This hook is being called indirectly and conditionally, but all hooks must be called in the exact same order in every component render."
                        },
                    )
                };

                for (i, range) in path.iter().skip(1).enumerate() {
                    let msg = if i == 0 {
                        markup! {
                            "This is the call path until the hook."
                        }
                    } else {
                        markup! {}
                    };

                    diag = diag.detail(range, msg);
                }

                if let Some(range) = early_return {
                    diag = diag.detail(
                        range,
                        markup! { "Hooks should not be called after an early return." },
                    )
                }

                let diag = diag.note(
                    markup! {
                        "For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order."
                    },
                ).note(
                    markup! {
                        "See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level"
                    },
                );
                Some(diag)
            }
        }
    }