Skip to content

Commit 3bbb815

Browse files
committed
Remove typescript-only directory (#19636)
1 parent 8f8fa1b commit 3bbb815

16 files changed

Lines changed: 294 additions & 402 deletions

tests/config/format-test/failed-format-tests.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ const disabledTests = new Map(
8585
"typescript/module/module_nested.ts",
8686
"typescript/custom/stability/moduleBlock.ts",
8787
"typescript/interface2/module.ts",
88-
"typescript/typescript-only/",
8988
],
9089
oxc: [],
91-
"oxc-ts": ["typescript/typescript-only/"],
92-
yuku: [],
93-
"yuku-ts": ["typescript/typescript-only/"],
90+
"oxc-ts": [],
91+
yuku: ["js/await/await-with-parens.js"],
92+
"yuku-ts": ["js/await/await-with-parens.js"],
9493
hermes: [
9594
...commentClosureTypecaseTests,
9695

@@ -100,10 +99,12 @@ const disabledTests = new Map(
10099

101100
// Different result
102101
"flow/hook/comments-before-arrow.js",
102+
"js/await/like-call.js",
103103
],
104104
flow: [
105-
// Parsing to different ASTs
106-
"js/decorators/member-expression.js",
105+
"js/decorators/member-expression.js", // Parsing to different ASTs
106+
"js/await/await-with-parens.js",
107+
"js/await/like-call.js",
107108
],
108109
typescript: [
109110
// https://github.com/typescript-eslint/typescript-eslint/issues/11389
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2+
3+
exports[`await-with-parens.js format 1`] = `
4+
====================================options=====================================
5+
parsers: ["babel", "flow", "typescript"]
6+
printWidth: 80 (default) |
7+
=====================================input======================================
8+
function foo(promise) { await (promise); }
9+
10+
function a() {
11+
return await (1)
12+
}
13+
14+
() => { await (x) };
15+
16+
function foo2() {
17+
await
18+
(foo);
19+
}
20+
21+
export class C {
22+
p = await (0);
23+
}
24+
25+
await (0);
26+
27+
=====================================output=====================================
28+
function foo(promise) {
29+
await(promise);
30+
}
31+
32+
function a() {
33+
return await(1);
34+
}
35+
36+
() => {
37+
await(x);
38+
};
39+
40+
function foo2() {
41+
await(foo);
42+
}
43+
44+
export class C {
45+
p = await(0);
46+
}
47+
48+
await 0;
49+
50+
================================================================================
51+
`;
52+
53+
exports[`await-with-parens.js format[espree] 1`] = `
54+
"Cannot use keyword 'await' outside an async function (1:25)
55+
> 1 | function foo(promise) { await (promise); }
56+
| ^
57+
2 |
58+
3 | function a() {
59+
4 | return await (1)
60+
Cause: Cannot use keyword 'await' outside an async function"
61+
`;
62+
63+
exports[`await-with-parens.js format[hermes] 1`] = `
64+
"'await' not in an async function (15:7)
65+
13 |
66+
14 | export class C {
67+
> 15 | p = await (0);
68+
| ^
69+
16 | }
70+
17 |
71+
18 | await (0);
72+
Cause: 'await' not in an async function (15:6)
73+
p = await (0);
74+
^~~~~~~~~"
75+
`;
76+
77+
exports[`await-with-parens.js format[meriyah] 1`] = `
78+
"Await is only valid in async functions (1:25)
79+
> 1 | function foo(promise) { await (promise); }
80+
| ^^^^^
81+
2 |
82+
3 | function a() {
83+
4 | return await (1)
84+
Cause: [1:24-1:29]: Await is only valid in async functions"
85+
`;
86+
87+
exports[`like-call.js format 1`] = `
88+
====================================options=====================================
89+
parsers: ["babel", "flow", "typescript"]
90+
printWidth: 80 (default) |
91+
=====================================input======================================
92+
await (1)
93+
94+
=====================================output=====================================
95+
await 1;
96+
97+
================================================================================
98+
`;

tests/format/typescript/typescript-only/await-with-parens.ts renamed to tests/format/js/await/await-with-parens.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function a() {
66

77
() => { await (x) };
88

9-
function foo() {
9+
function foo2() {
1010
await
1111
(foo);
1212
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
runFormatTest(import.meta, ["babel", "flow", "typescript"], {
2+
errors: {
3+
hermes: ["await-with-parens.js"],
4+
meriyah: ["await-with-parens.js"],
5+
espree: ["await-with-parens.js"],
6+
},
7+
});

tests/format/js/await/like-call.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
await (1)

tests/format/typescript/decorator-auto-accessors/__snapshots__/format.test.js.snap

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,135 @@
11
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

3+
exports[`decorator-auto-accessors-abstract-class.ts format 1`] = `
4+
====================================options=====================================
5+
parsers: ["typescript"]
6+
printWidth: 80 (default) |
7+
=====================================input======================================
8+
abstract class Foo {
9+
declare accessor prop7: number;
10+
private accessor #p: any;
11+
12+
abstract accessor #s;
13+
accessor #d?;
14+
abstract accessor f;
15+
readonly accessor g;
16+
}
17+
18+
=====================================output=====================================
19+
abstract class Foo {
20+
declare accessor prop7: number;
21+
private accessor #p: any;
22+
23+
abstract accessor #s;
24+
accessor #d?;
25+
abstract accessor f;
26+
readonly accessor g;
27+
}
28+
29+
================================================================================
30+
`;
31+
32+
exports[`decorator-auto-accessors-abstract-class.ts format[babel-ts] 1`] = `
33+
"An 'accessor' property cannot be declared optional. (6:3)
34+
4 |
35+
5 | abstract accessor #s;
36+
> 6 | accessor #d?;
37+
| ^
38+
7 | abstract accessor f;
39+
8 | readonly accessor g;
40+
9 | }
41+
Cause: An 'accessor' property cannot be declared optional. (6:2)"
42+
`;
43+
44+
exports[`decorator-auto-accessors-abstract-class.ts format[oxc-ts] 1`] = `
45+
"'accessor' modifier cannot be used with 'declare' modifier. (2:3)
46+
1 | abstract class Foo {
47+
> 2 | declare accessor prop7: number;
48+
| ^^^^^^^
49+
3 | private accessor #p: any;
50+
4 |
51+
5 | abstract accessor #s;"
52+
`;
53+
54+
exports[`decorator-auto-accessors-declare-class.ts format 1`] = `
55+
====================================options=====================================
56+
parsers: ["typescript"]
57+
printWidth: 80 (default) |
58+
=====================================input======================================
59+
declare class C {
60+
accessor x = 1;
61+
#y = 1;
62+
}
63+
64+
=====================================output=====================================
65+
declare class C {
66+
accessor x = 1;
67+
#y = 1;
68+
}
69+
70+
================================================================================
71+
`;
72+
73+
exports[`decorator-auto-accessors-declare-class.ts format[oxc-ts] 1`] = `
74+
"Initializers are not allowed in ambient contexts. (3:8)
75+
1 | declare class C {
76+
2 | accessor x = 1;
77+
> 3 | #y = 1;
78+
| ^
79+
4 | }
80+
5 |"
81+
`;
82+
83+
exports[`decorator-auto-accessors-mixed-modifiers.ts format 1`] = `
84+
====================================options=====================================
85+
parsers: ["typescript"]
86+
printWidth: 80 (default) |
87+
=====================================input======================================
88+
abstract class Foo {
89+
accessor prop: number = 1;
90+
static accessor prop2: number = 1;
91+
accessor #prop3: number = 1;
92+
accessor [prop4]: number = 1;
93+
private accessor prop5: number = 1;
94+
abstract accessor prop6: number;
95+
private accessor #p: any;
96+
97+
accessor a!: any;
98+
accessor aa!: any;
99+
abstract accessor #s;
100+
readonly accessor g;
101+
}
102+
103+
=====================================output=====================================
104+
abstract class Foo {
105+
accessor prop: number = 1;
106+
static accessor prop2: number = 1;
107+
accessor #prop3: number = 1;
108+
accessor [prop4]: number = 1;
109+
private accessor prop5: number = 1;
110+
abstract accessor prop6: number;
111+
private accessor #p: any;
112+
113+
accessor a!: any;
114+
accessor aa!: any;
115+
abstract accessor #s;
116+
readonly accessor g;
117+
}
118+
119+
================================================================================
120+
`;
121+
122+
exports[`decorator-auto-accessors-mixed-modifiers.ts format[oxc-ts] 1`] = `
123+
"An accessibility modifier cannot be used with a private identifier. (8:3)
124+
6 | private accessor prop5: number = 1;
125+
7 | abstract accessor prop6: number;
126+
> 8 | private accessor #p: any;
127+
| ^^^^^^^
128+
9 |
129+
10 | accessor a!: any;
130+
11 | accessor aa!: any;"
131+
`;
132+
3133
exports[`decorator-auto-accessors-new-line.ts format 1`] = `
4134
====================================options=====================================
5135
parsers: ["typescript"]

tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts renamed to tests/format/typescript/decorator-auto-accessors/decorator-auto-accessors-abstract-class.ts

File renamed without changes.

tests/format/typescript/typescript-only/decorator-auto-accessors-declara-class.ts renamed to tests/format/typescript/decorator-auto-accessors/decorator-auto-accessors-declare-class.ts

File renamed without changes.

tests/format/typescript/typescript-only/decorator-auto-accessors-mixed-modifiers.ts renamed to tests/format/typescript/decorator-auto-accessors/decorator-auto-accessors-mixed-modifiers.ts

File renamed without changes.
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
runFormatTest(import.meta, ["typescript"]);
1+
runFormatTest(import.meta, ["typescript"], {
2+
errors: {
3+
"babel-ts": ["decorator-auto-accessors-abstract-class.ts"],
4+
"oxc-ts": [
5+
"decorator-auto-accessors-abstract-class.ts",
6+
"decorator-auto-accessors-declare-class.ts",
7+
"decorator-auto-accessors-mixed-modifiers.ts",
8+
],
9+
},
10+
});

0 commit comments

Comments
 (0)