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: anchor_is_valid.rs
    path of file: ./repos/oxc/crates/oxc_linter/src/rules/jsx_a11y
    
    the code of the file until where you have to start completion: use oxc_ast::{
    ast::{Expression, JSXAttributeItem, JSXAttributeValue, JSXElementName, JSXExpression},
    AstKind,
};
use oxc_diagnostics::{
    miette::{self, Diagnostic},
    thiserror::Error,
};
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{
    context::LintContext,
    rule::Rule,
    utils::{get_element_type, has_jsx_prop_lowercase},
    AstNode,
};

#[derive(Debug, Error, Diagnostic)]
enum AnchorIsValidDiagnostic {
    #[error(
        "eslint-plugin-jsx-a11y(anchor-is-valid): Missing `href` attribute for the `a` element."
    )]
    #[diagnostic(severity(warning), help("Provide an href for the `a` element."))]
    MissingHrefAttribute(#[label] Span),

    #[error("eslint-plugin-jsx-a11y(anchor-is-valid): Use an incorrect href for the 'a' element.")]
    #[diagnostic(severity(warning), help("Provide a correct href for the `a` element."))]
    IncorrectHref(#[label] Span),

    #[error("eslint-plugin-jsx-a11y(anchor-is-valid):  The a element has `href` and `onClick`.")]
    #[diagnostic(severity(warning), help("Use a `button` element instead of an `a` element."))]
    CantBeAnchor(#[label] Span),
}

#[derive(Debug, Default, Clone)]
pub struct AnchorIsValid(Box<AnchorIsValidConfig>);

#[derive(Debug, Default, Clone)]
struct AnchorIsValidConfig {
    valid_hrefs: Vec<String>,
}

declare_oxc_lint!(
    /// ### What it does
    /// The HTML <a> element, with a valid href attribute, is formally defined as representing a **hyperlink**.
    /// That is, a link between one HTML document and another, or between one location inside an HTML document and another location inside the same document.
    ///
    /// While before it was possible to attach logic to an anchor element, with the advent of JSX libraries,
    /// it's now  easier to attach logic to any HT
    
    fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
        if let AstKind::JSXElement(jsx_el) = node.kind() {
            let JSXElementName::Identifier(ident) = &jsx_el.opening_element.name else { return };
            let Some(name) = &get_element_type(ctx, &jsx_el.opening_element) else { return };
            if name == "a" {
                if let Option::Some(herf_attr) =
                    has_jsx_prop_lowercase(&jsx_el.opening_element, "href")
                {
                    // Check if the 'a' element has a correct href attribute
                    match herf_attr {
                        JSXAttributeItem::Attribute(attr) => match &attr.value {
                            Some(value) => {
                                let is_empty = check_value_is_empty(value, &self.0.valid_hrefs);
                                if is_empty {
                                    if has_jsx_prop_lowercase(&jsx_el.opening_element, "onclick")
                                        .is_some()
                                    {
                                        ctx.diagnostic(AnchorIsValidDiagnostic::CantBeAnchor(
                                            ident.span,
                                        ));
                                        return;
                                    }
                                    ctx.diagnostic(AnchorIsValidDiagnostic::IncorrectHref(
                                        ident.span,
                                    ));
                                    return;
                                }
                            }
                            None => {
                                ctx.diagnostic(AnchorIsValidDiagnostic::IncorrectHref(ident.span));
                                return;
                            }
                        },
                        JSXAttributeItem::SpreadAttribute(_) => {
                            // pass
                            return;
                        }
                    }
                    return;
                }
                // Exclude '<a {...props} />' case
                let has_spreed_attr =
                    jsx_el.opening_element.attributes.iter().any(|attr| match attr {
                        JSXAttributeItem::SpreadAttribute(_) => true,
                        JSXAttributeItem::Attribute(_) => false,
                    });
                if has_spreed_attr {
                    return;
                }
                ctx.diagnostic(AnchorIsValidDiagnostic::MissingHrefAttribute(ident.span));
            }
        }
    }