Skip to content

Commit

Permalink
chore(transformer): disable class properties transform from the targe…
Browse files Browse the repository at this point in the history
…t API (#7487)
  • Loading branch information
Boshen committed Nov 26, 2024
1 parent 713e210 commit 45ef3eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/oxc_transformer/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ impl From<ESTarget> for TransformOptions {
fn from(target: ESTarget) -> Self {
let mut engine_targets = EngineTargets::default();
engine_targets.insert(Engine::Es, target.version());
Self { env: EnvOptions::from(engine_targets), ..Self::default() }
let mut env = EnvOptions::from(engine_targets);
env.es2022.class_properties = None;
Self { env, ..Self::default() }
}
}

Expand Down
7 changes: 7 additions & 0 deletions crates/oxc_transformer/tests/integrations/es_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ fn es_target() {
}
}

#[test]
fn no_class_properties() {
let code = "class Foo { #a; }";
let options = TransformOptions::from(ESTarget::from_str("es2015").unwrap());
assert_eq!(test(code, &options), Ok(codegen(code, SourceType::mjs())));
}

#[test]
fn target_list_pass() {
// https://vite.dev/config/build-options.html#build-target
Expand Down

0 comments on commit 45ef3eb

Please sign in to comment.