From 0304c550a48b0f31ac646ed8e3326c0568210883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 2 Dec 2021 10:44:27 +0900 Subject: [PATCH] chore: Break cycles (#2941) --- .husky/pre-commit | 5 ----- Cargo.lock | 1 - crates/swc_ecma_transforms_compat/Cargo.toml | 1 - .../tests/es2015_parameters.rs | 19 ---------------- .../tests/strip.rs | 22 +++++++++++++++++++ 5 files changed, 22 insertions(+), 26 deletions(-) delete mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 0c66200ef075..000000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -# TODO: lint-staged -# cargo fmt --all -- --check \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 2e1d043a8a21..20c327460f15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2952,7 +2952,6 @@ dependencies = [ "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", "swc_ecma_transforms_testing", - "swc_ecma_transforms_typescript", "swc_ecma_utils", "swc_ecma_visit", "testing", diff --git a/crates/swc_ecma_transforms_compat/Cargo.toml b/crates/swc_ecma_transforms_compat/Cargo.toml index 96ed2897a0eb..21fa4255f25e 100644 --- a/crates/swc_ecma_transforms_compat/Cargo.toml +++ b/crates/swc_ecma_transforms_compat/Cargo.toml @@ -39,5 +39,4 @@ swc_ecma_visit = {version = "0.44.0", path = "../swc_ecma_visit"} serde_json = "1.0.66" swc_ecma_parser = {version = "0.78.0", path = "../swc_ecma_parser"} swc_ecma_transforms_testing = {version = "0.45.2", path = "../swc_ecma_transforms_testing"} -swc_ecma_transforms_typescript = {version = "0.62.0", path = "../swc_ecma_transforms_typescript"} testing = {version = "0.15.0", path = "../testing"} diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs index f284dbdbc503..0225adc55cd0 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs @@ -8,7 +8,6 @@ use swc_ecma_transforms_compat::{ es2017::async_to_generator, }; use swc_ecma_transforms_testing::{test, test_exec}; -use swc_ecma_transforms_typescript::strip; use swc_ecma_visit::Fold; fn syntax() -> Syntax { @@ -1901,24 +1900,6 @@ test_exec!( expect(t([4,5,6])).toBe(6);" ); -test!( - Syntax::Typescript(Default::default()), - |_| chain!( - strip(), - tr(Config { - ignore_function_length: true - }) - ), - fn_len_default_assignment_with_types, - "export function transformFileSync( - filename: string, - opts?: Object = {}, - ): string {}", - "export function transformFileSync(filename, opts) { - if (opts === void 0) opts = {}; - }" -); - test_exec!( syntax(), |_| tr(Config { diff --git a/crates/swc_ecma_transforms_typescript/tests/strip.rs b/crates/swc_ecma_transforms_typescript/tests/strip.rs index ec926c531c46..3a723f4ade9b 100644 --- a/crates/swc_ecma_transforms_typescript/tests/strip.rs +++ b/crates/swc_ecma_transforms_typescript/tests/strip.rs @@ -4,6 +4,7 @@ use swc_common::chain; use swc_ecma_parser::{Syntax, TsConfig}; use swc_ecma_transforms_base::resolver::resolver; use swc_ecma_transforms_compat::{ + es2015::{block_scoping, destructuring, parameters}, es2017::async_to_generator, es2020::{nullish_coalescing, optional_chaining}, }; @@ -19,6 +20,27 @@ fn tr() -> impl Fold { }) } +test!( + Syntax::Typescript(Default::default()), + |_| chain!( + strip(), + resolver(), + parameters(parameters::Config { + ignore_function_length: true + }), + destructuring(destructuring::Config { loose: false }), + block_scoping(), + ), + fn_len_default_assignment_with_types, + "export function transformFileSync( + filename: string, + opts?: Object = {}, + ): string {}", + "export function transformFileSync(filename, opts) { + if (opts === void 0) opts = {}; + }" +); + macro_rules! to { ($name:ident, $from:expr, $to:expr) => { test!(