diff --git a/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js b/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js index 6ab149afde2ae..470e3cec8b94e 100644 --- a/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js +++ b/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js @@ -15,7 +15,7 @@ const jestPackageJson = class A { #testerConfig; constructor() { - let basePath: string | undefined = + let basePath = this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir; } } diff --git a/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js.snap b/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js.snap index 73253a29d488c..e033f3433064a 100644 --- a/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js.snap +++ b/crates/oxc_formatter/tests/fixtures/js/comments/assignments.js.snap @@ -19,11 +19,33 @@ const jestPackageJson = class A { #testerConfig; constructor() { - let basePath: string | undefined = + let basePath = this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir; } } ==================== Output ==================== +var longlonglonglonglonglong = + /*#__PURE__*/ _interopDefaultLegacy(aaaaaaaaaaaaaaa); +var short = /*#__PURE__*/ _interopDefaultLegacy(b); + +const jestPackageJson = + // eslint-disable-next-line @typescript-eslint/no-require-imports + require(jestPath); + +{ + sourcemap = + /** @type {'inline' | 'hidden' | 'sourcemap'} */ ( + process.env.WORKER_MODE + ) || sourcemap; +} + +class A { + #testerConfig; + constructor() { + let basePath = + this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir; + } +} ===================== End ===================== diff --git a/crates/oxc_formatter/tests/fixtures/js/comments/yield.js b/crates/oxc_formatter/tests/fixtures/js/comments/yield.js deleted file mode 100644 index 97ed80160798b..0000000000000 --- a/crates/oxc_formatter/tests/fixtures/js/comments/yield.js +++ /dev/null @@ -1,60 +0,0 @@ -function *t1() { - yield ( - // comment - a as any - ); -} -function *t2() { - yield ( - // comment - a as any - ) + 1; -} -function *t3() { - yield ( - // comment - a as any - ) ? 0 : 1; -} -function *t4() { - yield ( - // comment - a as any - ).b; -} -function *t5() { - yield ( - // comment - a as any - )[a]; -} -function *t6() { - yield ( - // comment - a as any - )(); -} -function *t7() { - yield ( - // comment - a as any - )``; -} -function *t8() { - yield ( - // comment - a as any - ) as any; -} -function *t9() { - yield ( - // comment - a as any - ) satisfies any; -} -function *t10() { - yield ( - // comment - a as any - )!; -} diff --git a/crates/oxc_formatter/tests/fixtures/js/comments/yield.js.snap b/crates/oxc_formatter/tests/fixtures/js/comments/yield.js.snap deleted file mode 100644 index 7afe572f7d686..0000000000000 --- a/crates/oxc_formatter/tests/fixtures/js/comments/yield.js.snap +++ /dev/null @@ -1,68 +0,0 @@ ---- -source: crates/oxc_formatter/tests/fixtures/mod.rs ---- -==================== Input ==================== -function *t1() { - yield ( - // comment - a as any - ); -} -function *t2() { - yield ( - // comment - a as any - ) + 1; -} -function *t3() { - yield ( - // comment - a as any - ) ? 0 : 1; -} -function *t4() { - yield ( - // comment - a as any - ).b; -} -function *t5() { - yield ( - // comment - a as any - )[a]; -} -function *t6() { - yield ( - // comment - a as any - )(); -} -function *t7() { - yield ( - // comment - a as any - )``; -} -function *t8() { - yield ( - // comment - a as any - ) as any; -} -function *t9() { - yield ( - // comment - a as any - ) satisfies any; -} -function *t10() { - yield ( - // comment - a as any - )!; -} - -==================== Output ==================== - -===================== End ===================== diff --git a/crates/oxc_formatter/tests/fixtures/ts/comments/assignments.ts b/crates/oxc_formatter/tests/fixtures/ts/comments/assignments.ts new file mode 100644 index 0000000000000..6ab149afde2ae --- /dev/null +++ b/crates/oxc_formatter/tests/fixtures/ts/comments/assignments.ts @@ -0,0 +1,21 @@ +var longlonglonglonglonglong = /*#__PURE__*/_interopDefaultLegacy(aaaaaaaaaaaaaaa); +var short = /*#__PURE__*/_interopDefaultLegacy(b); + +const jestPackageJson = + // eslint-disable-next-line @typescript-eslint/no-require-imports + require(jestPath); + +{ + sourcemap = + /** @type {'inline' | 'hidden' | 'sourcemap'} */ ( + process.env.WORKER_MODE + ) || sourcemap; +} + +class A { + #testerConfig; + constructor() { + let basePath: string | undefined = + this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir; + } +} diff --git a/crates/oxc_formatter/tests/fixtures/ts/comments/assignments.ts.snap b/crates/oxc_formatter/tests/fixtures/ts/comments/assignments.ts.snap new file mode 100644 index 0000000000000..375a6cce7230b --- /dev/null +++ b/crates/oxc_formatter/tests/fixtures/ts/comments/assignments.ts.snap @@ -0,0 +1,51 @@ +--- +source: crates/oxc_formatter/tests/fixtures/mod.rs +--- +==================== Input ==================== +var longlonglonglonglonglong = /*#__PURE__*/_interopDefaultLegacy(aaaaaaaaaaaaaaa); +var short = /*#__PURE__*/_interopDefaultLegacy(b); + +const jestPackageJson = + // eslint-disable-next-line @typescript-eslint/no-require-imports + require(jestPath); + +{ + sourcemap = + /** @type {'inline' | 'hidden' | 'sourcemap'} */ ( + process.env.WORKER_MODE + ) || sourcemap; +} + +class A { + #testerConfig; + constructor() { + let basePath: string | undefined = + this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir; + } +} + +==================== Output ==================== +var longlonglonglonglonglong = + /*#__PURE__*/ _interopDefaultLegacy(aaaaaaaaaaaaaaa); +var short = /*#__PURE__*/ _interopDefaultLegacy(b); + +const jestPackageJson = + // eslint-disable-next-line @typescript-eslint/no-require-imports + require(jestPath); + +{ + sourcemap = + /** @type {'inline' | 'hidden' | 'sourcemap'} */ ( + process.env.WORKER_MODE + ) || sourcemap; +} + +class A { + #testerConfig; + constructor() { + let basePath: string | undefined = + this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir; + } +} + +===================== End =====================