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: namespace.rs
    path of file: ./repos/oxc/crates/oxc_linter/src/rules/import
    
    the code of the file until where you have to start completion: use oxc_ast::AstKind;
use oxc_diagnostics::{
    miette::{self, Diagnostic},
    thiserror::Error,
};
use oxc_macros::declare_oxc_lint;
use oxc_span::{CompactStr, GetSpan, Span};
use oxc_syntax::module_record::ImportImportName;

use crate::{context::LintContext, rule::Rule};

#[derive(Debug, Error, Diagnostic)]
enum NamespaceDiagnostic {
    #[error("eslint-plugin-import(namespace): {1:?} not found in imported namespace {2:?}.")]
    #[diagnostic(severity(warning))]
    NoExport(#[label] Span, CompactStr, CompactStr),
    #[error("eslint-plugin-import(namespace): Unable to validate computed reference to imported namespace {1:?}
    .")]
    #[diagnostic(severity(warning))]
    ComputedReference(#[label] Span, CompactStr),
    #[error("eslint-plugin-import(namespace): Assignment to member of namespace {1:?}.'")]
    #[diagnostic(severity(warning))]
    Assignment(#[label] Span, CompactStr),
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md>
#[derive(Debug, Default, Clone)]
pub struct Namespace;

declare_oxc_lint!(
    /// ### What it does
    /// Enforces names exist at the time they are dereferenced, when imported as a full namespace (i.e. import * as foo from './foo'; foo.bar(); will report if bar is not exported by ./foo.).
    /// Will report at the import declaration if there are no exported names found.
    /// Also, will report for computed references (i.e. foo["bar"]()).
    /// Reports on assignment to a member of an imported namespace.
    Namespace,
    nursery
);

impl Rule for Namespace {
    fn run_once(&self, ctx: &LintContext<'_>) {
        ctx.semantic().module_record().import_entries.iter().for_each(|entry| {
            if !matches!(entry.import_name, ImportImportName::NamespaceObject) {
                return;
            }
            let source = entry.module_request.name();
            let module_record = ctx.semantic().module_record();
            let Some(module) = module_record.loaded_modules.get(source) else {
                return;
            };

            if module.not_esm {
                return;
            }

            let Some(symbol_id) =
            
    
    fn run_once(&self, ctx: &LintContext<'_>) {
        ctx.semantic().module_record().import_entries.iter().for_each(|entry| {
            if !matches!(entry.import_name, ImportImportName::NamespaceObject) {
                return;
            }
            let source = entry.module_request.name();
            let module_record = ctx.semantic().module_record();
            let Some(module) = module_record.loaded_modules.get(source) else {
                return;
            };

            if module.not_esm {
                return;
            }

            let Some(symbol_id) =
                ctx.semantic().symbols().get_symbol_id_from_span(&entry.local_name.span())
            else {
                return;
            };

            let check_binding_exported = |name: &str, span| {
                if module.exported_bindings.get(name).is_some() {
                    return;
                }
                ctx.diagnostic(NamespaceDiagnostic::NoExport(span, name.into(), source.clone()));
            };

            ctx.symbols().get_resolved_references(symbol_id).for_each(|reference| {
                if let Some(node) = ctx.nodes().parent_node(reference.node_id()) {
                    let name = entry.local_name.name();

                    match node.kind() {
                        AstKind::MemberExpression(member) => {
                            if matches!(
                                ctx.nodes().parent_kind(node.id()),
                                Some(AstKind::SimpleAssignmentTarget(_))
                            ) {
                                ctx.diagnostic(NamespaceDiagnostic::Assignment(
                                    member.span(),
                                    name.clone(),
                                ));
                            };

                            // TODO: Support allow_computed option
                            if member.is_computed() {
                                return ctx.diagnostic(NamespaceDiagnostic::ComputedReference(
                                    member.span(),
                                    name.clone(),
                                ));
                            }

                            if let Some((span, name)) = member.static_property_info() {
                                check_binding_exported(name, span);
                            }
                        }

                        AstKind::JSXMemberExpressionObject(_) => {
                            if let Some(AstKind::JSXMemberExpression(expr)) =
                                ctx.nodes().parent_kind(node.id())
                            {
                                check_binding_exported(&expr.property.name, expr.property.span);
                            }
                        }
                        _ => {}
                    }
                }
            });
        });
    }