ronantakizawa/codereview-bench huggingface dataset:
Repository: swc-project/swc
File: crates/swc_ecma_minifier/src/compress/optimize/util.rs (Rust)

Code before:
            }
        }
    }

    fn visit_mut_var_declarators(&mut self, n: &mut Vec<VarDeclarator>) {
        n.visit_mut_children_with(self);

        n.retain(|v| !v.name.is_invalid());
    }

    fn visit_mut_prop(&mut self, n: &mut Prop) {
        n.visit_mut_children_with(self);

        if let Prop::Shorthand(i) = n {
            if let Some(expr) = self.lits.get(&i.to_id()) {
                let key = if i.sym == "__proto__" {
                    PropName::Computed(ComputedPropName {
                        span: i.span,
                        expr: Box::new(Expr::Lit(Lit::Str(Str {
                            span: i.span,
                            value: i.sym.clone(),
                            raw: None,
                        }))),
                    })
                } else {
                    i.take().into()
                };
                *n = Prop::KeyValue(KeyValueProp {
                    key,
                    value: expr.clone(),
                });
                self.changed = true;
            }
        }
    }
}

pub(crate) struct NormalMultiReplacer<'a> {
    pub vars: &'a mut FxHashMap<Id, Box<Expr>>,
    pub changed: bool,
    should_consume: bool,
}

impl<'a> NormalMultiReplacer<'a> {
    /// `worked` will be changed to `true` if any replacement is done
    pub fn new(vars: &'a mut FxHashMap<Id, Box<Expr>>, should_consume: bool) -> Self {
        NormalMultiReplacer {
            vars,
            should_consume,
            changed: false,
        }

Review comment (suggestion):
No need to take the prop name and set it again. I think it's better to write everything in `if i.sym == "__proto__"` body and avoid unnecessary  `self.changed = true`

Code after:
            }
        }
    }

    fn visit_mut_var_declarators(&mut self, n: &mut Vec<VarDeclarator>) {
        n.visit_mut_children_with(self);

        n.retain(|v| !v.name.is_invalid());
    }

    fn visit_mut_prop(&mut self, n: &mut Prop) {
        n.visit_mut_children_with(self);

        if let Prop::Shorthand(i) = n {
            if let Some(expr) = self.lits.get(&i.to_id()) {
                let key = prop_name_from_ident(i.take());
                *n = Prop::KeyValue(KeyValueProp {
                    key,
                    value: expr.clone(),
                });
                self.changed = true;
            }
        }
    }
}

pub(crate) struct NormalMultiReplacer<'a> {
    pub vars: &'a mut FxHashMap<Id, Box<Expr>>,
    pub changed: bool,
    should_consume: bool,
}

impl<'a> NormalMultiReplacer<'a> {
    /// `worked` will be changed to `true` if any replacement is done
    pub fn new(vars: &'a mut FxHashMap<Id, Box<Expr>>, should_consume: bool) -> Self {
        NormalMultiReplacer {
            vars,
            should_consume,
            changed: false,
        }
    }

    fn var(&mut self, i: &Id) -> Option<Box<Expr>> {
        let mut e = self.vars.remove(i)?;

        e.visit_mut_children_with(self);

        let e = if self.should_consume {
            e
        } else {
            let new_e = e.clone();
Repository: swc-project/swc
File: crates/swc_ecma_minifier/src/compress/optimize/inline.rs (Rust)

Code before:
            return Some(
                is_arrow_body_simple_enough_for_copy(&b.left)?
                    + is_arrow_body_simple_enough_for_copy(&b.right)?
                    + 2,
            )
        }
        _ => {}
    }

    None
}

fn is_block_stmt_of_fn_simple_enough_for_copy(b: &BlockStmt) -> Option<u8> {
    if b.stmts.len() == 1 {
        if let Stmt::Return(ret) = &b.stmts[0] {
            return ret
                .arg
                .as_deref()
                .map_or(Some(0), is_arrow_body_simple_enough_for_copy);
        }
    }

    None
}

fn arrow_simple_ident(arr: &ArrowExpr) -> Box<dyn Iterator<Item = &Ident> + '_> {
    if arr.is_async {
        return Box::new(std::iter::empty());
    }

    let expr = match &*arr.body {
        BlockStmtOrExpr::BlockStmt(s) => {
            if let &[Stmt::Return(ReturnStmt { arg: Some(arg), .. })] = &&*s.stmts {
                &**arg
            } else {
                return Box::new(std::iter::empty());
            }
        }
        BlockStmtOrExpr::Expr(e) => &**e,
        #[cfg(swc_ast_unknown)]
        _ => panic!("unable to access unknown nodes"),
    };

    arrow_simple_body_ident(expr)
}

fn arrow_simple_body_ident(b: &Expr) -> Box<dyn Iterator<Item = &Ident> + '_> {
    match b {
        Expr::Ident(ident) => Box::new(std::iter::once(ident)),
        Expr::Member(MemberExpr { obj, prop, .. }) if !prop.is_computed() => {
            arrow_simple_body_ident(obj)

Review comment (suggestion):
This `Box<dyn` isn't ideal, but I couldn't think of a better way

Code after:
fn is_arrow_body_simple_enough_for_copy(e: &Expr) -> Option<u8> {
    match e {
        Expr::Ident(..) | Expr::Lit(..) => return Some(1),
        Expr::Member(MemberExpr { obj, prop, .. }) if !prop.is_computed() => {
            return Some(is_arrow_body_simple_enough_for_copy(obj)? + 2)
        }
        Expr::Call(c) => {
            let mut cost = is_arrow_body_simple_enough_for_copy(c.callee.as_expr()?.deref())?;
            for arg in &c.args {
                let arg_cost = is_arrow_body_simple_enough_for_copy(&arg.expr)?;
                cost += arg_cost;
                cost += if arg.spread.is_some() { 3 } else { 0 };
            }

            return Some(cost + 2);
        }
        Expr::Unary(u) => return Some(is_arrow_body_simple_enough_for_copy(&u.arg)? + 1),

        Expr::Bin(b) => {
            return Some(
                is_arrow_body_simple_enough_for_copy(&b.left)?
                    + is_arrow_body_simple_enough_for_copy(&b.right)?
                    + 2,
            )
        }
        _ => {}
    }

    None
}

fn is_block_stmt_of_fn_simple_enough_for_copy(b: &BlockStmt) -> Option<u8> {
    if b.stmts.len() == 1 {
        if let Stmt::Return(ret) = &b.stmts[0] {
            return ret
                .arg
                .as_deref()
                .map_or(Some(0), is_arrow_body_simple_enough_for_copy);
        }
    }

    None
}
Repository: swc-project/swc
File: crates/swc_ecma_lexer/src/error.rs (Rust)

Code before:
    TS2369,
    TS2371,
    TS2406,
    TS2410,
    TS2414,
    TS2427,
    TS2452,
    TS2483,
    TS2491,
    TS2499,
    TS2703,
    TS4112,
    TS8038,
    TS18010,
    TSTypeAnnotationAfterAssign,
    TsNonNullAssertionNotAllowed(Atom),

    WithLabel {
        inner: Box<Error>,
        span: Span,
        note: &'static str,
    },

    ReservedTypeAssertion,
    ReservedArrowTypeParam,
    TypeArgumentListCannotBeEmpty,
}

impl SyntaxError {
    #[cold]
    #[inline(never)]
    pub fn msg(&self) -> Cow<'static, str> {
        match self {
            SyntaxError::PrivateNameInInterface => {
                "private names are not allowed in interface".into()
            }
            SyntaxError::TopLevelAwaitInScript => {
                "top level await is only allowed in module".into()
            }
            SyntaxError::LegacyDecimal => {
                "Legacy decimal escape is not permitted in strict mode".into()
            }
            SyntaxError::LegacyOctal => {
                "Legacy octal escape is not permitted in strict mode".into()
            }
            SyntaxError::InvalidIdentChar => "Invalid character in identifier".into(),
            SyntaxError::ExpectedDigit { radix } => format!(
                "Expected {} digit",
                match radix {
                    2 => "a binary",
                    8 => "an octal",

Review comment (suggestion):
Can you rename it to be consistent with other variants? Other variants are kind of error rather than a statement

Code after:
    TS2369,
    TS2371,
    TS2406,
    TS2410,
    TS2414,
    TS2427,
    TS2452,
    TS2483,
    TS2491,
    TS2499,
    TS2703,
    TS4112,
    TS8038,
    TS18010,
    TSTypeAnnotationAfterAssign,
    TsNonNullAssertionNotAllowed(Atom),

    WithLabel {
        inner: Box<Error>,
        span: Span,
        note: &'static str,
    },

    ReservedTypeAssertion,
    ReservedArrowTypeParam,
    EmptyTypeArgumentList,
}

impl SyntaxError {
    #[cold]
    #[inline(never)]
    pub fn msg(&self) -> Cow<'static, str> {
        match self {
            SyntaxError::PrivateNameInInterface => {
                "private names are not allowed in interface".into()
            }
            SyntaxError::TopLevelAwaitInScript => {
                "top level await is only allowed in module".into()
            }
            SyntaxError::LegacyDecimal => {
                "Legacy decimal escape is not permitted in strict mode".into()
            }
            SyntaxError::LegacyOctal => {
                "Legacy octal escape is not permitted in strict mode".into()
            }
            SyntaxError::InvalidIdentChar => "Invalid character in identifier".into(),
            SyntaxError::ExpectedDigit { radix } => format!(
                "Expected {} digit",
                match radix {
                    2 => "a binary",
                    8 => "an octal",
Repository: swc-project/swc
File: crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-regexp/output.mjs (JavaScript)

Code before:
import "core-js/modules/es.regexp.constructor.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.regexp.to-string.js";
var a = RegExp("(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})", "u");
var b = RegExp(".", "s");
var c = RegExp(".", "imsuy");
console.log(a.unicode);
console.log(b.dotAll);
console.log(c.sticky);
console.log(c.ignoreCase);


Review comment (suggestion):
The output shows inconsistent behavior where variable `c` is transformed to `new RegExp(...)` while variables `a` and `b` on lines 4-5 are transformed to `RegExp(...)` without the `new` keyword. Since the transformation code creates a `CallExpr` without `new`, this suggests an unintended change in behavior. Please verify that this test output is correct or investigate why the `new` keyword is being added for this specific case.
```suggestion
var c = RegExp(".", "imsuy");
```

Code after:
import "core-js/modules/es.regexp.constructor.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.regexp.to-string.js";
var a = RegExp("(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})", "u");
var b = RegExp(".", "s");
var c = new RegExp(".", "imsuy");
console.log(a.unicode);
console.log(b.dotAll);
console.log(c.sticky);
console.log(c.ignoreCase);
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/typescript/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct TypescriptOptions {}

pub fn hook(options: TypescriptOptions) -> impl VisitMutHook<TraverseCtx> {
    TypeScriptPass { options }
}

struct TypeScriptPass {
    options: TypescriptOptions,
}

impl VisitMutHook<TraverseCtx> for TypeScriptPass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct TypescriptOptions {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct TypescriptOptions {}

pub fn hook(options: TypescriptOptions) -> impl VisitMutHook<TraverseCtx> {
    TypeScriptPass { options }
}

struct TypeScriptPass {
    options: TypescriptOptions,
}

impl VisitMutHook<TraverseCtx> for TypeScriptPass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/es2026/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct Es2026Options {}

pub fn hook(options: Es2026Options) -> impl VisitMutHook<TraverseCtx> {
    Es2026Pass { options }
}

struct Es2026Pass {
    options: Es2026Options,
}

impl VisitMutHook<TraverseCtx> for Es2026Pass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2026Options {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2026Options {}

pub fn hook(options: Es2026Options) -> impl VisitMutHook<TraverseCtx> {
    Es2026Pass { options }
}

struct Es2026Pass {
    options: Es2026Options,
}

impl VisitMutHook<TraverseCtx> for Es2026Pass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/es2022/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct Es2022Options {}

pub fn hook(options: Es2022Options) -> impl VisitMutHook<TraverseCtx> {
    Es2022Pass { options }
}

struct Es2022Pass {
    options: Es2022Options,
}

impl VisitMutHook<TraverseCtx> for Es2022Pass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2022Options {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2022Options {}

pub fn hook(options: Es2022Options) -> impl VisitMutHook<TraverseCtx> {
    Es2022Pass { options }
}

struct Es2022Pass {
    options: Es2022Options,
}

impl VisitMutHook<TraverseCtx> for Es2022Pass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/es2020/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct Es2020Options {}

pub fn hook(options: Es2020Options) -> impl VisitMutHook<TraverseCtx> {
    Es2020Pass { options }
}

struct Es2020Pass {
    options: Es2020Options,
}

impl VisitMutHook<TraverseCtx> for Es2020Pass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2020Options {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2020Options {}

pub fn hook(options: Es2020Options) -> impl VisitMutHook<TraverseCtx> {
    Es2020Pass { options }
}

struct Es2020Pass {
    options: Es2020Options,
}

impl VisitMutHook<TraverseCtx> for Es2020Pass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/es2019/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct Es2019Options {}

pub fn hook(options: Es2019Options) -> impl VisitMutHook<TraverseCtx> {
    Es2019Pass { options }
}

struct Es2019Pass {
    options: Es2019Options,
}

impl VisitMutHook<TraverseCtx> for Es2019Pass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2019Options {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2019Options {}

pub fn hook(options: Es2019Options) -> impl VisitMutHook<TraverseCtx> {
    Es2019Pass { options }
}

struct Es2019Pass {
    options: Es2019Options,
}

impl VisitMutHook<TraverseCtx> for Es2019Pass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/es2018/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct Es2018Options {}

pub fn hook(options: Es2018Options) -> impl VisitMutHook<TraverseCtx> {
    Es2018Pass { options }
}

struct Es2018Pass {
    options: Es2018Options,
}

impl VisitMutHook<TraverseCtx> for Es2018Pass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2018Options {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2018Options {}

pub fn hook(options: Es2018Options) -> impl VisitMutHook<TraverseCtx> {
    Es2018Pass { options }
}

struct Es2018Pass {
    options: Es2018Options,
}

impl VisitMutHook<TraverseCtx> for Es2018Pass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/es2016/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct Es2016Options {}

pub fn hook(options: Es2016Options) -> impl VisitMutHook<TraverseCtx> {
    Es2016Pass { options }
}

struct Es2016Pass {
    options: Es2016Options,
}

impl VisitMutHook<TraverseCtx> for Es2016Pass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2016Options {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Es2016Options {}

pub fn hook(options: Es2016Options) -> impl VisitMutHook<TraverseCtx> {
    Es2016Pass { options }
}

struct Es2016Pass {
    options: Es2016Options,
}

impl VisitMutHook<TraverseCtx> for Es2016Pass {}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/options/mod.rs (Rust)

Code before:
pub use crate::{
    bugfix::BugfixOptions, decorators::DecoratorOptions, es2015::Es2015Options,
    es2016::Es2016Options, es2017::Es2017Options, es2018::Es2018Options, es2019::Es2019Options,
    es2020::Es2020Options, es2021::Es2021Options, es2022::Es2022Options, es2026::Es2026Options,
    jsx::JsxOptions, regexp::RegExpOptions, typescript::TypescriptOptions,
};

#[derive(Debug, Default)]
pub struct Options {
    pub typescript: Option<TypescriptOptions>,
    pub decorator: Option<DecoratorOptions>,
    pub jsx: Option<JsxOptions>,

    pub env: EnvOptions,
}

#[derive(Debug, Default)]
pub struct EnvOptions {
    pub es2026: Es2026Options,
    pub es2022: Es2022Options,
    pub es2021: Es2021Options,
    pub es2020: Es2020Options,
    pub es2019: Es2019Options,
    pub es2018: Es2018Options,
    pub es2017: Es2017Options,
    pub es2016: Es2016Options,
    pub es2015: Es2015Options,
    pub regexp: RegExpOptions,
    pub bugfix: BugfixOptions,
}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Options {
```

Code after:
pub use crate::{
    bugfix::BugfixOptions, decorators::DecoratorOptions, es2015::Es2015Options,
    es2016::Es2016Options, es2017::Es2017Options, es2018::Es2018Options, es2019::Es2019Options,
    es2020::Es2020Options, es2021::Es2021Options, es2022::Es2022Options, es2026::Es2026Options,
    jsx::JsxOptions, regexp::RegExpOptions, typescript::TypescriptOptions,
};

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Options {
    pub typescript: Option<TypescriptOptions>,
    pub decorator: Option<DecoratorOptions>,
    pub jsx: Option<JsxOptions>,

    pub env: EnvOptions,
}

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct EnvOptions {
    pub es2026: Es2026Options,
    pub es2022: Es2022Options,
    pub es2021: Es2021Options,
    pub es2020: Es2020Options,
    pub es2019: Es2019Options,
    pub es2018: Es2018Options,
    pub es2017: Es2017Options,
    pub es2016: Es2016Options,
    pub es2015: Es2015Options,
    pub regexp: RegExpOptions,
    pub bugfix: BugfixOptions,
}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/options/mod.rs (Rust)

Code before:
pub use crate::{
    bugfix::BugfixOptions, decorators::DecoratorOptions, es2015::Es2015Options,
    es2016::Es2016Options, es2017::Es2017Options, es2018::Es2018Options, es2019::Es2019Options,
    es2020::Es2020Options, es2021::Es2021Options, es2022::Es2022Options, es2026::Es2026Options,
    jsx::JsxOptions, regexp::RegExpOptions, typescript::TypescriptOptions,
};

#[derive(Debug, Default)]
pub struct Options {
    pub typescript: Option<TypescriptOptions>,
    pub decorator: Option<DecoratorOptions>,
    pub jsx: Option<JsxOptions>,

    pub env: EnvOptions,
}

#[derive(Debug, Default)]
pub struct EnvOptions {
    pub es2026: Es2026Options,
    pub es2022: Es2022Options,
    pub es2021: Es2021Options,
    pub es2020: Es2020Options,
    pub es2019: Es2019Options,
    pub es2018: Es2018Options,
    pub es2017: Es2017Options,
    pub es2016: Es2016Options,
    pub es2015: Es2015Options,
    pub regexp: RegExpOptions,
    pub bugfix: BugfixOptions,
}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct EnvOptions {
```

Code after:
pub use crate::{
    bugfix::BugfixOptions, decorators::DecoratorOptions, es2015::Es2015Options,
    es2016::Es2016Options, es2017::Es2017Options, es2018::Es2018Options, es2019::Es2019Options,
    es2020::Es2020Options, es2021::Es2021Options, es2022::Es2022Options, es2026::Es2026Options,
    jsx::JsxOptions, regexp::RegExpOptions, typescript::TypescriptOptions,
};

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Options {
    pub typescript: Option<TypescriptOptions>,
    pub decorator: Option<DecoratorOptions>,
    pub jsx: Option<JsxOptions>,

    pub env: EnvOptions,
}

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct EnvOptions {
    pub es2026: Es2026Options,
    pub es2022: Es2022Options,
    pub es2021: Es2021Options,
    pub es2020: Es2020Options,
    pub es2019: Es2019Options,
    pub es2018: Es2018Options,
    pub es2017: Es2017Options,
    pub es2016: Es2016Options,
    pub es2015: Es2015Options,
    pub regexp: RegExpOptions,
    pub bugfix: BugfixOptions,
}
Repository: swc-project/swc
File: crates/swc_ecma_transformer/src/jsx/mod.rs (Rust)

Code before:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
pub struct JsxOptions {}

pub fn hook(options: JsxOptions) -> impl VisitMutHook<TraverseCtx> {
    JsxPass { options }
}

struct JsxPass {
    options: JsxOptions,
}

impl VisitMutHook<TraverseCtx> for JsxPass {}


Review comment (bug):
The `#[non_exhaustive]` attribute should be placed on a separate line from `#[derive(Debug, Default)]` for better readability and consistency with Rust formatting conventions. It should be:
```rust
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct JsxOptions {}
```

Code after:
use swc_ecma_hooks::VisitMutHook;

use crate::TraverseCtx;

#[derive(Debug, Default)]
#[non_exhaustive]
pub struct JsxOptions {}

pub fn hook(options: JsxOptions) -> impl VisitMutHook<TraverseCtx> {
    JsxPass { options }
}

struct JsxPass {
    options: JsxOptions,
}

impl VisitMutHook<TraverseCtx> for JsxPass {}