Remove typescript-only directory (#19636)
This commit is contained in:
1 parent
8f8fa1b026
commit
3bbb8159eb
16 files changed
+294
-402
No files matched your search
@@ -85,12 +85,11 @@ const disabledTests = new Map(
|
||||
"typescript/module/module_nested.ts",
|
||||
"typescript/custom/stability/moduleBlock.ts",
|
||||
"typescript/interface2/module.ts",
|
||||
"typescript/typescript-only/",
|
||||
],
|
||||
oxc: [],
|
||||
"oxc-ts": ["typescript/typescript-only/"],
|
||||
yuku: [],
|
||||
"yuku-ts": ["typescript/typescript-only/"],
|
||||
"oxc-ts": [],
|
||||
yuku: ["js/await/await-with-parens.js"],
|
||||
"yuku-ts": ["js/await/await-with-parens.js"],
|
||||
hermes: [
|
||||
...commentClosureTypecaseTests,
|
||||
|
||||
@@ -100,10 +99,12 @@ const disabledTests = new Map(
|
||||
|
||||
// Different result
|
||||
"flow/hook/comments-before-arrow.js",
|
||||
"js/await/like-call.js",
|
||||
],
|
||||
flow: [
|
||||
// Parsing to different ASTs
|
||||
"js/decorators/member-expression.js",
|
||||
"js/decorators/member-expression.js", // Parsing to different ASTs
|
||||
"js/await/await-with-parens.js",
|
||||
"js/await/like-call.js",
|
||||
],
|
||||
typescript: [
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/11389
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`await-with-parens.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
function foo(promise) { await (promise); }
|
||||
|
||||
function a() {
|
||||
return await (1)
|
||||
}
|
||||
|
||||
() => { await (x) };
|
||||
|
||||
function foo2() {
|
||||
await
|
||||
(foo);
|
||||
}
|
||||
|
||||
export class C {
|
||||
p = await (0);
|
||||
}
|
||||
|
||||
await (0);
|
||||
|
||||
=====================================output=====================================
|
||||
function foo(promise) {
|
||||
await(promise);
|
||||
}
|
||||
|
||||
function a() {
|
||||
return await(1);
|
||||
}
|
||||
|
||||
() => {
|
||||
await(x);
|
||||
};
|
||||
|
||||
function foo2() {
|
||||
await(foo);
|
||||
}
|
||||
|
||||
export class C {
|
||||
p = await(0);
|
||||
}
|
||||
|
||||
await 0;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`await-with-parens.js format[espree] 1`] = `
|
||||
"Cannot use keyword 'await' outside an async function (1:25)
|
||||
> 1 | function foo(promise) { await (promise); }
|
||||
| ^
|
||||
2 |
|
||||
3 | function a() {
|
||||
4 | return await (1)
|
||||
Cause: Cannot use keyword 'await' outside an async function"
|
||||
`;
|
||||
|
||||
exports[`await-with-parens.js format[hermes] 1`] = `
|
||||
"'await' not in an async function (15:7)
|
||||
13 |
|
||||
14 | export class C {
|
||||
> 15 | p = await (0);
|
||||
| ^
|
||||
16 | }
|
||||
17 |
|
||||
18 | await (0);
|
||||
Cause: 'await' not in an async function (15:6)
|
||||
p = await (0);
|
||||
^~~~~~~~~"
|
||||
`;
|
||||
|
||||
exports[`await-with-parens.js format[meriyah] 1`] = `
|
||||
"Await is only valid in async functions (1:25)
|
||||
> 1 | function foo(promise) { await (promise); }
|
||||
| ^^^^^
|
||||
2 |
|
||||
3 | function a() {
|
||||
4 | return await (1)
|
||||
Cause: [1:24-1:29]: Await is only valid in async functions"
|
||||
`;
|
||||
|
||||
exports[`like-call.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
await (1)
|
||||
|
||||
=====================================output=====================================
|
||||
await 1;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
+1
-1
@@ -6,7 +6,7 @@ function a() {
|
||||
|
||||
() => { await (x) };
|
||||
|
||||
function foo() {
|
||||
function foo2() {
|
||||
await
|
||||
(foo);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
runFormatTest(import.meta, ["babel", "flow", "typescript"], {
|
||||
errors: {
|
||||
hermes: ["await-with-parens.js"],
|
||||
meriyah: ["await-with-parens.js"],
|
||||
espree: ["await-with-parens.js"],
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
await (1)
|
||||
@@ -1,5 +1,135 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`decorator-auto-accessors-abstract-class.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
abstract class Foo {
|
||||
declare accessor prop7: number;
|
||||
private accessor #p: any;
|
||||
|
||||
abstract accessor #s;
|
||||
accessor #d?;
|
||||
abstract accessor f;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
abstract class Foo {
|
||||
declare accessor prop7: number;
|
||||
private accessor #p: any;
|
||||
|
||||
abstract accessor #s;
|
||||
accessor #d?;
|
||||
abstract accessor f;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-abstract-class.ts format[babel-ts] 1`] = `
|
||||
"An 'accessor' property cannot be declared optional. (6:3)
|
||||
4 |
|
||||
5 | abstract accessor #s;
|
||||
> 6 | accessor #d?;
|
||||
| ^
|
||||
7 | abstract accessor f;
|
||||
8 | readonly accessor g;
|
||||
9 | }
|
||||
Cause: An 'accessor' property cannot be declared optional. (6:2)"
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-abstract-class.ts format[oxc-ts] 1`] = `
|
||||
"'accessor' modifier cannot be used with 'declare' modifier. (2:3)
|
||||
1 | abstract class Foo {
|
||||
> 2 | declare accessor prop7: number;
|
||||
| ^^^^^^^
|
||||
3 | private accessor #p: any;
|
||||
4 |
|
||||
5 | abstract accessor #s;"
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-declare-class.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
declare class C {
|
||||
accessor x = 1;
|
||||
#y = 1;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
declare class C {
|
||||
accessor x = 1;
|
||||
#y = 1;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-declare-class.ts format[oxc-ts] 1`] = `
|
||||
"Initializers are not allowed in ambient contexts. (3:8)
|
||||
1 | declare class C {
|
||||
2 | accessor x = 1;
|
||||
> 3 | #y = 1;
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-mixed-modifiers.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
abstract class Foo {
|
||||
accessor prop: number = 1;
|
||||
static accessor prop2: number = 1;
|
||||
accessor #prop3: number = 1;
|
||||
accessor [prop4]: number = 1;
|
||||
private accessor prop5: number = 1;
|
||||
abstract accessor prop6: number;
|
||||
private accessor #p: any;
|
||||
|
||||
accessor a!: any;
|
||||
accessor aa!: any;
|
||||
abstract accessor #s;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
abstract class Foo {
|
||||
accessor prop: number = 1;
|
||||
static accessor prop2: number = 1;
|
||||
accessor #prop3: number = 1;
|
||||
accessor [prop4]: number = 1;
|
||||
private accessor prop5: number = 1;
|
||||
abstract accessor prop6: number;
|
||||
private accessor #p: any;
|
||||
|
||||
accessor a!: any;
|
||||
accessor aa!: any;
|
||||
abstract accessor #s;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-mixed-modifiers.ts format[oxc-ts] 1`] = `
|
||||
"An accessibility modifier cannot be used with a private identifier. (8:3)
|
||||
6 | private accessor prop5: number = 1;
|
||||
7 | abstract accessor prop6: number;
|
||||
> 8 | private accessor #p: any;
|
||||
| ^^^^^^^
|
||||
9 |
|
||||
10 | accessor a!: any;
|
||||
11 | accessor aa!: any;"
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-new-line.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1 +1,10 @@
|
||||
runFormatTest(import.meta, ["typescript"]);
|
||||
runFormatTest(import.meta, ["typescript"], {
|
||||
errors: {
|
||||
"babel-ts": ["decorator-auto-accessors-abstract-class.ts"],
|
||||
"oxc-ts": [
|
||||
"decorator-auto-accessors-abstract-class.ts",
|
||||
"decorator-auto-accessors-declare-class.ts",
|
||||
"decorator-auto-accessors-mixed-modifiers.ts",
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`prettier-ignore-parenthesized-type.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
(
|
||||
aa
|
||||
);
|
||||
|
||||
=====================================output=====================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
aa
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`prettier-ignore-parenthesized-type.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
(
|
||||
aa
|
||||
);
|
||||
|
||||
=====================================output=====================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
aa;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,388 +0,0 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`await-with-parens.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
function foo(promise) { await (promise); }
|
||||
|
||||
function a() {
|
||||
return await (1)
|
||||
}
|
||||
|
||||
() => { await (x) };
|
||||
|
||||
function foo() {
|
||||
await
|
||||
(foo);
|
||||
}
|
||||
|
||||
export class C {
|
||||
p = await (0);
|
||||
}
|
||||
|
||||
await (0);
|
||||
|
||||
=====================================output=====================================
|
||||
function foo(promise) {
|
||||
await(promise)
|
||||
}
|
||||
|
||||
function a() {
|
||||
return await(1)
|
||||
}
|
||||
|
||||
;() => {
|
||||
await(x)
|
||||
}
|
||||
|
||||
function foo() {
|
||||
await(foo)
|
||||
}
|
||||
|
||||
export class C {
|
||||
p = await(0)
|
||||
}
|
||||
|
||||
await 0
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`await-with-parens.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
function foo(promise) { await (promise); }
|
||||
|
||||
function a() {
|
||||
return await (1)
|
||||
}
|
||||
|
||||
() => { await (x) };
|
||||
|
||||
function foo() {
|
||||
await
|
||||
(foo);
|
||||
}
|
||||
|
||||
export class C {
|
||||
p = await (0);
|
||||
}
|
||||
|
||||
await (0);
|
||||
|
||||
=====================================output=====================================
|
||||
function foo(promise) {
|
||||
await(promise);
|
||||
}
|
||||
|
||||
function a() {
|
||||
return await(1);
|
||||
}
|
||||
|
||||
() => {
|
||||
await(x);
|
||||
};
|
||||
|
||||
function foo() {
|
||||
await(foo);
|
||||
}
|
||||
|
||||
export class C {
|
||||
p = await(0);
|
||||
}
|
||||
|
||||
await 0;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-abstract-class.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
abstract class Foo {
|
||||
declare accessor prop7: number;
|
||||
private accessor #p: any;
|
||||
|
||||
abstract accessor #s;
|
||||
accessor #d?;
|
||||
abstract accessor f;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
abstract class Foo {
|
||||
declare accessor prop7: number
|
||||
private accessor #p: any
|
||||
|
||||
abstract accessor #s
|
||||
accessor #d?
|
||||
abstract accessor f
|
||||
readonly accessor g
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-abstract-class.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
abstract class Foo {
|
||||
declare accessor prop7: number;
|
||||
private accessor #p: any;
|
||||
|
||||
abstract accessor #s;
|
||||
accessor #d?;
|
||||
abstract accessor f;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
abstract class Foo {
|
||||
declare accessor prop7: number;
|
||||
private accessor #p: any;
|
||||
|
||||
abstract accessor #s;
|
||||
accessor #d?;
|
||||
abstract accessor f;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-declara-class.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
declare class C {
|
||||
accessor x = 1;
|
||||
#y = 1;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
declare class C {
|
||||
accessor x = 1
|
||||
#y = 1
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-declara-class.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
declare class C {
|
||||
accessor x = 1;
|
||||
#y = 1;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
declare class C {
|
||||
accessor x = 1;
|
||||
#y = 1;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-mixed-modifiers.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
abstract class Foo {
|
||||
accessor prop: number = 1;
|
||||
static accessor prop2: number = 1;
|
||||
accessor #prop3: number = 1;
|
||||
accessor [prop4]: number = 1;
|
||||
private accessor prop5: number = 1;
|
||||
abstract accessor prop6: number;
|
||||
private accessor #p: any;
|
||||
|
||||
accessor a!: any;
|
||||
accessor aa!: any;
|
||||
abstract accessor #s;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
abstract class Foo {
|
||||
accessor prop: number = 1
|
||||
static accessor prop2: number = 1
|
||||
accessor #prop3: number = 1
|
||||
accessor [prop4]: number = 1
|
||||
private accessor prop5: number = 1
|
||||
abstract accessor prop6: number
|
||||
private accessor #p: any
|
||||
|
||||
accessor a!: any
|
||||
accessor aa!: any
|
||||
abstract accessor #s
|
||||
readonly accessor g
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors-mixed-modifiers.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
abstract class Foo {
|
||||
accessor prop: number = 1;
|
||||
static accessor prop2: number = 1;
|
||||
accessor #prop3: number = 1;
|
||||
accessor [prop4]: number = 1;
|
||||
private accessor prop5: number = 1;
|
||||
abstract accessor prop6: number;
|
||||
private accessor #p: any;
|
||||
|
||||
accessor a!: any;
|
||||
accessor aa!: any;
|
||||
abstract accessor #s;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
abstract class Foo {
|
||||
accessor prop: number = 1;
|
||||
static accessor prop2: number = 1;
|
||||
accessor #prop3: number = 1;
|
||||
accessor [prop4]: number = 1;
|
||||
private accessor prop5: number = 1;
|
||||
abstract accessor prop6: number;
|
||||
private accessor #p: any;
|
||||
|
||||
accessor a!: any;
|
||||
accessor aa!: any;
|
||||
abstract accessor #s;
|
||||
readonly accessor g;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`parenthesized-decorators-call-expression.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
@(test().x("global").y())
|
||||
class X {}
|
||||
|
||||
=====================================output=====================================
|
||||
@(test().x("global").y())
|
||||
class X {}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`parenthesized-decorators-call-expression.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
@(test().x("global").y())
|
||||
class X {}
|
||||
|
||||
=====================================output=====================================
|
||||
@(test().x("global").y())
|
||||
class X {}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`parenthesized-decorators-tagged-template.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
class Test {
|
||||
@foo\`bar\`
|
||||
text: string = "text"
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Test {
|
||||
@(foo\`bar\`)
|
||||
text: string = "text"
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`parenthesized-decorators-tagged-template.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
class Test {
|
||||
@foo\`bar\`
|
||||
text: string = "text"
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Test {
|
||||
@(foo\`bar\`)
|
||||
text: string = "text";
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`prettier-ignore-parenthesized-type.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
(
|
||||
aa
|
||||
);
|
||||
|
||||
=====================================output=====================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
aa
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`prettier-ignore-parenthesized-type.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
(
|
||||
aa
|
||||
);
|
||||
|
||||
=====================================output=====================================
|
||||
type Foo =
|
||||
// prettier-ignore
|
||||
aa;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -1,2 +0,0 @@
|
||||
@(test().x("global").y())
|
||||
class X {}
|
||||
@@ -1,4 +0,0 @@
|
||||
class Test {
|
||||
@foo`bar`
|
||||
text: string = "text"
|
||||
}
|
||||
Reference in new issue
Block a user