Add yuku-ts to error tests (#19852)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-08-18 17:36:22 +08:00
1 parent ef8321e8c5
commit 4c5e7b9d63
59 files changed
+2517 -92

No files matched your search

@@ -26,6 +26,14 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: An abstract accessor cannot have an implementation." Cause: An abstract accessor cannot have an implementation."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"An abstract accessor cannot have an implementation (2:25)
1 | abstract class Foo {
> 2 | abstract get getter() { }
| ^^^
3 | }"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Method 'setter' cannot have an implementation because it is marked abstract. (2:3) "Method 'setter' cannot have an implementation because it is marked abstract. (2:3)
1 | abstract class Foo { 1 | abstract class Foo {
@@ -51,3 +59,11 @@ exports[`snippet: #1 format[typescript] 1`] = `
3 | } 3 | }
Cause: An abstract accessor cannot have an implementation." Cause: An abstract accessor cannot have an implementation."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"An abstract accessor cannot have an implementation (2:26)
1 | abstract class Foo {
> 2 | abstract set setter(v) { }
| ^^^
3 | }"
`;
@@ -16,5 +16,5 @@ runFormatTest(
`, `,
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -25,3 +25,11 @@ exports[`snippet: #0 format[typescript] 1`] = `
3 | } 3 | }
Cause: Method 'method' cannot have an implementation because it is marked abstract." Cause: Method 'method' cannot have an implementation because it is marked abstract."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"An abstract method cannot have an implementation (2:21)
1 | abstract class Foo {
> 2 | abstract method() { }
| ^^^
3 | }"
`;
@@ -11,5 +11,5 @@ runFormatTest(
`, `,
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -25,3 +25,11 @@ exports[`newline-before-arrow.ts format[typescript] 1`] = `
3 | 3 |
Cause: Unexpected keyword or identifier." Cause: Unexpected keyword or identifier."
`; `;
exports[`newline-before-arrow.ts format[yuku-ts] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found 'x' (1:7)
> 1 | async x
| ^
2 | => x
3 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -31,3 +31,13 @@ exports[`catch-clause-with-initializer.ts format[typescript] 1`] = `
5 | 5 |
Cause: Catch clause variable cannot have an initializer." Cause: Catch clause variable cannot have an initializer."
`; `;
exports[`catch-clause-with-initializer.ts format[yuku-ts] 1`] = `
"Expected ')' after catch parameter, but found '=' (3:10)
1 | try {
2 | }
> 3 | catch (e = 1) {
| ^
4 | }
5 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -26,6 +26,14 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: '(' expected." Cause: '(' expected."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected '(' for getter/setter definition, but found '}' (3:1)
1 | abstract class Foo {
2 | constructor
> 3 | }
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Classes may not have a field named 'constructor'. (2:3) "Classes may not have a field named 'constructor'. (2:3)
1 | abstract class Foo { 1 | abstract class Foo {
@@ -52,6 +60,14 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Classes may not have a field named 'constructor'." Cause: Classes may not have a field named 'constructor'."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected '(' for getter/setter definition, but found '}' (3:1)
1 | abstract class Foo {
2 | 'constructor'
> 3 | }
| ^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Classes may not have a field named 'constructor'. (2:3) "Classes may not have a field named 'constructor'. (2:3)
1 | abstract class Foo { 1 | abstract class Foo {
@@ -78,6 +94,14 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Classes may not have a field named 'constructor'." Cause: Classes may not have a field named 'constructor'."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Expected '(' for getter/setter definition, but found '}' (3:1)
1 | abstract class Foo {
2 | 'constructor'
> 3 | }
| ^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Classes may not have a field named 'constructor'. (2:12) "Classes may not have a field named 'constructor'. (2:12)
1 | abstract class Foo { 1 | abstract class Foo {
@@ -104,6 +128,14 @@ exports[`snippet: #3 format[typescript] 1`] = `
Cause: Classes may not have a field named 'constructor'." Cause: Classes may not have a field named 'constructor'."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"Expected '(' for getter/setter definition, but found '}' (3:1)
1 | abstract class Foo {
2 | accessor 'constructor'
> 3 | }
| ^"
`;
exports[`snippet: #4 format[babel-ts] 1`] = ` exports[`snippet: #4 format[babel-ts] 1`] = `
"Classes may not have a field named 'constructor'. (2:12) "Classes may not have a field named 'constructor'. (2:12)
1 | abstract class Foo { 1 | abstract class Foo {
@@ -130,6 +162,14 @@ exports[`snippet: #4 format[typescript] 1`] = `
Cause: Classes may not have a field named 'constructor'." Cause: Classes may not have a field named 'constructor'."
`; `;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"Expected '(' for getter/setter definition, but found '}' (3:1)
1 | abstract class Foo {
2 | accessor 'constructor'
> 3 | }
| ^"
`;
exports[`snippet: #5 format[babel-ts] 1`] = ` exports[`snippet: #5 format[babel-ts] 1`] = `
"Classes may not have a field named 'constructor'. (2:12) "Classes may not have a field named 'constructor'. (2:12)
1 | abstract class Foo { 1 | abstract class Foo {
@@ -155,3 +195,11 @@ exports[`snippet: #5 format[typescript] 1`] = `
| ^ | ^
Cause: '(' expected." Cause: '(' expected."
`; `;
exports[`snippet: #5 format[yuku-ts] 1`] = `
"Expected '(' for getter/setter definition, but found '}' (3:1)
1 | abstract class Foo {
2 | accessor constructor
> 3 | }
| ^"
`;
@@ -5,5 +5,5 @@ runFormatTest(
importMeta: import.meta, importMeta: import.meta,
snippets: testCases.map((code) => `abstract ${code}`), snippets: testCases.map((code) => `abstract ${code}`),
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -29,6 +29,15 @@ exports[`declare-getter.ts format[typescript] 1`] = `
Cause: 'declare' modifier cannot appear on class elements of this kind." Cause: 'declare' modifier cannot appear on class elements of this kind."
`; `;
exports[`declare-getter.ts format[yuku-ts] 1`] = `
"A 'declare' modifier cannot appear on a class element of this kind (2:15)
1 | class Foo {
> 2 | declare get foo()
| ^^^
3 | }
4 |"
`;
exports[`declare-setter.ts format[babel-ts] 1`] = ` exports[`declare-setter.ts format[babel-ts] 1`] = `
"'declare' is not allowed in setters. (2:3) "'declare' is not allowed in setters. (2:3)
1 | class Foo { 1 | class Foo {
@@ -57,3 +66,12 @@ exports[`declare-setter.ts format[typescript] 1`] = `
4 | 4 |
Cause: 'declare' modifier cannot appear on class elements of this kind." Cause: 'declare' modifier cannot appear on class elements of this kind."
`; `;
exports[`declare-setter.ts format[yuku-ts] 1`] = `
"A 'declare' modifier cannot appear on a class element of this kind (2:15)
1 | class Foo {
> 2 | declare set foo(v)
| ^^^
3 | }
4 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -19,3 +19,9 @@ exports[`snippet: #0 format[typescript] 1`] = `
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
Cause: An implementation cannot be declared in ambient contexts." Cause: An implementation cannot be declared in ambient contexts."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"An implementation cannot be declared in ambient contexts (1:24)
> 1 | declare function foo() {}
| ^"
`;
@@ -3,5 +3,5 @@ runFormatTest(
importMeta: import.meta, importMeta: import.meta,
snippets: ["declare function foo() {}"], snippets: ["declare function foo() {}"],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | 1 ++
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (1)++ > 1 | (1)++
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (1)++
| ^^^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (1)-- > 1 | (1)--
@@ -60,6 +72,12 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (1)--
| ^^^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Invalid left-hand side in prefix operation. (1:4) "Invalid left-hand side in prefix operation. (1:4)
> 1 | ++(1) > 1 | ++(1)
@@ -80,6 +98,12 @@ exports[`snippet: #3 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:3)
> 1 | ++(1)
| ^^^"
`;
exports[`snippet: #4 format[babel-ts] 1`] = ` exports[`snippet: #4 format[babel-ts] 1`] = `
"Invalid left-hand side in prefix operation. (1:4) "Invalid left-hand side in prefix operation. (1:4)
> 1 | --(1) > 1 | --(1)
@@ -100,6 +124,12 @@ exports[`snippet: #4 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:3)
> 1 | --(1)
| ^^^"
`;
exports[`snippet: #5 format[babel-ts] 1`] = ` exports[`snippet: #5 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (1 + 2)++ > 1 | (1 + 2)++
@@ -120,6 +150,12 @@ exports[`snippet: #5 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #5 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (1 + 2)++
| ^^^^^^^"
`;
exports[`snippet: #6 format[babel-ts] 1`] = ` exports[`snippet: #6 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (1 + 2)-- > 1 | (1 + 2)--
@@ -140,6 +176,12 @@ exports[`snippet: #6 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #6 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (1 + 2)--
| ^^^^^^^"
`;
exports[`snippet: #7 format[babel-ts] 1`] = ` exports[`snippet: #7 format[babel-ts] 1`] = `
"Invalid left-hand side in prefix operation. (1:4) "Invalid left-hand side in prefix operation. (1:4)
> 1 | ++(1 + 2) > 1 | ++(1 + 2)
@@ -160,6 +202,12 @@ exports[`snippet: #7 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #7 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:3)
> 1 | ++(1 + 2)
| ^^^^^^^"
`;
exports[`snippet: #8 format[babel-ts] 1`] = ` exports[`snippet: #8 format[babel-ts] 1`] = `
"Invalid left-hand side in prefix operation. (1:4) "Invalid left-hand side in prefix operation. (1:4)
> 1 | --(1 + 2) > 1 | --(1 + 2)
@@ -180,6 +228,12 @@ exports[`snippet: #8 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #8 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:3)
> 1 | --(1 + 2)
| ^^^^^^^"
`;
exports[`snippet: #9 format[babel-ts] 1`] = ` exports[`snippet: #9 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (x + x)++ > 1 | (x + x)++
@@ -200,6 +254,12 @@ exports[`snippet: #9 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #9 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (x + x)++
| ^^^^^^^"
`;
exports[`snippet: #10 format[babel-ts] 1`] = ` exports[`snippet: #10 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (x + x)-- > 1 | (x + x)--
@@ -220,6 +280,12 @@ exports[`snippet: #10 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #10 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (x + x)--
| ^^^^^^^"
`;
exports[`snippet: #11 format[babel-ts] 1`] = ` exports[`snippet: #11 format[babel-ts] 1`] = `
"Invalid left-hand side in prefix operation. (1:4) "Invalid left-hand side in prefix operation. (1:4)
> 1 | ++(x + x) > 1 | ++(x + x)
@@ -240,6 +306,12 @@ exports[`snippet: #11 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #11 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:3)
> 1 | ++(x + x)
| ^^^^^^^"
`;
exports[`snippet: #12 format[babel-ts] 1`] = ` exports[`snippet: #12 format[babel-ts] 1`] = `
"Invalid left-hand side in prefix operation. (1:4) "Invalid left-hand side in prefix operation. (1:4)
> 1 | --(x + x) > 1 | --(x + x)
@@ -260,6 +332,12 @@ exports[`snippet: #12 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #12 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:3)
> 1 | --(x + x)
| ^^^^^^^"
`;
exports[`snippet: #13 format[babel-ts] 1`] = ` exports[`snippet: #13 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:1) "Invalid left-hand side in postfix operation. (1:1)
> 1 | a()++ > 1 | a()++
@@ -280,6 +358,12 @@ exports[`snippet: #13 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #13 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | a()++
| ^^^"
`;
exports[`snippet: #14 format[babel-ts] 1`] = ` exports[`snippet: #14 format[babel-ts] 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1) "Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | x?.y++ > 1 | x?.y++
@@ -300,6 +384,12 @@ exports[`snippet: #14 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #14 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | x?.y++
| ^^^^"
`;
exports[`snippet: #15 format[babel-ts] 1`] = ` exports[`snippet: #15 format[babel-ts] 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1) "Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | x?.y.z++ > 1 | x?.y.z++
@@ -320,6 +410,12 @@ exports[`snippet: #15 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #15 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | x?.y.z++
| ^^^^^^"
`;
exports[`snippet: #16 format[babel-ts] 1`] = ` exports[`snippet: #16 format[babel-ts] 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1) "Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | x?.y().z++ > 1 | x?.y().z++
@@ -340,6 +436,12 @@ exports[`snippet: #16 format[typescript] 1`] = `
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #16 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | x?.y().z++
| ^^^^^^^^"
`;
exports[`snippet: #17 format[babel-ts] 1`] = ` exports[`snippet: #17 format[babel-ts] 1`] = `
"Invalid left-hand side in postfix operation. (1:2) "Invalid left-hand side in postfix operation. (1:2)
> 1 | (a())++ > 1 | (a())++
@@ -359,3 +461,9 @@ exports[`snippet: #17 format[typescript] 1`] = `
| ^^^^^ | ^^^^^
Cause: Invalid left-hand side expression in unary operation" Cause: Invalid left-hand side expression in unary operation"
`; `;
exports[`snippet: #17 format[yuku-ts] 1`] = `
"Invalid operand for increment/decrement operator (1:1)
> 1 | (a())++
| ^^^^^"
`;
@@ -29,5 +29,5 @@ runFormatTest(
"(a())++", "(a())++",
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Accessibility modifier already seen." Cause: Accessibility modifier already seen."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected ';' after class field, but found 'method' (1:28)
> 1 | class A {private protected method(){}}
| ^^^^^^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Accessibility modifier already seen: 'public'. (1:20) "Accessibility modifier already seen: 'public'. (1:20)
> 1 | class A {protected public method(){}} > 1 | class A {protected public method(){}}
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Accessibility modifier already seen." Cause: Accessibility modifier already seen."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected ';' after class field, but found 'method' (1:27)
> 1 | class A {protected public method(){}}
| ^^^^^^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Accessibility modifier already seen: 'private'. (1:18) "Accessibility modifier already seen: 'private'. (1:18)
> 1 | class A {private private method(){}} > 1 | class A {private private method(){}}
@@ -60,6 +72,12 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Accessibility modifier already seen." Cause: Accessibility modifier already seen."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Expected ';' after class field, but found 'method' (1:26)
> 1 | class A {private private method(){}}
| ^^^^^^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Accessibility modifier already seen: 'protected'. (1:18) "Accessibility modifier already seen: 'protected'. (1:18)
> 1 | class A {private protected property} > 1 | class A {private protected property}
@@ -80,6 +98,12 @@ exports[`snippet: #3 format[typescript] 1`] = `
Cause: Accessibility modifier already seen." Cause: Accessibility modifier already seen."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"Expected ';' after class field, but found 'property' (1:28)
> 1 | class A {private protected property}
| ^^^^^^^^"
`;
exports[`snippet: #4 format[babel-ts] 1`] = ` exports[`snippet: #4 format[babel-ts] 1`] = `
"Accessibility modifier already seen: 'public'. (1:20) "Accessibility modifier already seen: 'public'. (1:20)
> 1 | class A {protected public property} > 1 | class A {protected public property}
@@ -100,6 +124,12 @@ exports[`snippet: #4 format[typescript] 1`] = `
Cause: Accessibility modifier already seen." Cause: Accessibility modifier already seen."
`; `;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"Expected ';' after class field, but found 'property' (1:27)
> 1 | class A {protected public property}
| ^^^^^^^^"
`;
exports[`snippet: #5 format[babel-ts] 1`] = ` exports[`snippet: #5 format[babel-ts] 1`] = `
"Accessibility modifier already seen: 'private'. (1:18) "Accessibility modifier already seen: 'private'. (1:18)
> 1 | class A {private private property} > 1 | class A {private private property}
@@ -119,3 +149,9 @@ exports[`snippet: #5 format[typescript] 1`] = `
| ^^^^^^^ | ^^^^^^^
Cause: Accessibility modifier already seen." Cause: Accessibility modifier already seen."
`; `;
exports[`snippet: #5 format[yuku-ts] 1`] = `
"Expected ';' after class field, but found 'property' (1:26)
> 1 | class A {private private property}
| ^^^^^^^^"
`;
@@ -10,5 +10,5 @@ runFormatTest(
"class A {private private property}", "class A {private private property}",
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Type argument list cannot be empty." Cause: Type argument list cannot be empty."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"A type argument list cannot be empty (1:5)
> 1 | foo<>()
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Type argument list cannot be empty. (1:5) "Type argument list cannot be empty. (1:5)
> 1 | (foo<>()) > 1 | (foo<>())
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Type argument list cannot be empty." Cause: Type argument list cannot be empty."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"A type argument list cannot be empty (1:6)
> 1 | (foo<>())
| ^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Type argument list cannot be empty. (1:8) "Type argument list cannot be empty. (1:8)
> 1 | new Foo<>() > 1 | new Foo<>()
@@ -60,6 +72,12 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Type argument list cannot be empty." Cause: Type argument list cannot be empty."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"A type argument list cannot be empty (1:9)
> 1 | new Foo<>()
| ^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:13) "Type parameter list cannot be empty. (1:13)
> 1 | function foo<>(){} > 1 | function foo<>(){}
@@ -80,6 +98,12 @@ exports[`snippet: #3 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:14)
> 1 | function foo<>(){}
| ^"
`;
exports[`snippet: #4 format[babel-ts] 1`] = ` exports[`snippet: #4 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:14) "Type parameter list cannot be empty. (1:14)
> 1 | (function foo<>(){}) > 1 | (function foo<>(){})
@@ -100,6 +124,12 @@ exports[`snippet: #4 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:15)
> 1 | (function foo<>(){})
| ^"
`;
exports[`snippet: #5 format[babel-ts] 1`] = ` exports[`snippet: #5 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:10) "Type parameter list cannot be empty. (1:10)
> 1 | class Foo<> {} > 1 | class Foo<> {}
@@ -120,6 +150,12 @@ exports[`snippet: #5 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #5 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:11)
> 1 | class Foo<> {}
| ^"
`;
exports[`snippet: #6 format[babel-ts] 1`] = ` exports[`snippet: #6 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:11) "Type parameter list cannot be empty. (1:11)
> 1 | (class Foo<> {}) > 1 | (class Foo<> {})
@@ -140,6 +176,12 @@ exports[`snippet: #6 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #6 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:12)
> 1 | (class Foo<> {})
| ^"
`;
exports[`snippet: #7 format[babel-ts] 1`] = ` exports[`snippet: #7 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:23) "Type parameter list cannot be empty. (1:23)
> 1 | class Foo {constructor<>()} > 1 | class Foo {constructor<>()}
@@ -160,6 +202,12 @@ exports[`snippet: #7 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #7 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:24)
> 1 | class Foo {constructor<>()}
| ^"
`;
exports[`snippet: #8 format[babel-ts] 1`] = ` exports[`snippet: #8 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:24) "Type parameter list cannot be empty. (1:24)
> 1 | (class Foo {constructor<>()}) > 1 | (class Foo {constructor<>()})
@@ -180,6 +228,12 @@ exports[`snippet: #8 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #8 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:25)
> 1 | (class Foo {constructor<>()})
| ^"
`;
exports[`snippet: #9 format[babel-ts] 1`] = ` exports[`snippet: #9 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:18) "Type parameter list cannot be empty. (1:18)
> 1 | class Foo {method<>()} > 1 | class Foo {method<>()}
@@ -200,6 +254,12 @@ exports[`snippet: #9 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #9 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:19)
> 1 | class Foo {method<>()}
| ^"
`;
exports[`snippet: #10 format[babel-ts] 1`] = ` exports[`snippet: #10 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:19) "Type parameter list cannot be empty. (1:19)
> 1 | (class Foo {method<>()}) > 1 | (class Foo {method<>()})
@@ -220,6 +280,12 @@ exports[`snippet: #10 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #10 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:20)
> 1 | (class Foo {method<>()})
| ^"
`;
exports[`snippet: #11 format[babel-ts] 1`] = ` exports[`snippet: #11 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:22) "Type parameter list cannot be empty. (1:22)
> 1 | class Foo {get getter<>()} > 1 | class Foo {get getter<>()}
@@ -240,6 +306,12 @@ exports[`snippet: #11 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #11 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:23)
> 1 | class Foo {get getter<>()}
| ^"
`;
exports[`snippet: #12 format[babel-ts] 1`] = ` exports[`snippet: #12 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:23) "Type parameter list cannot be empty. (1:23)
> 1 | (class Foo {get getter<>()}) > 1 | (class Foo {get getter<>()})
@@ -260,6 +332,12 @@ exports[`snippet: #12 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #12 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:24)
> 1 | (class Foo {get getter<>()})
| ^"
`;
exports[`snippet: #13 format[babel-ts] 1`] = ` exports[`snippet: #13 format[babel-ts] 1`] = `
"Type argument list cannot be empty. (1:25) "Type argument list cannot be empty. (1:25)
> 1 | class Foo {property: Bar<> = 1} > 1 | class Foo {property: Bar<> = 1}
@@ -280,6 +358,12 @@ exports[`snippet: #13 format[typescript] 1`] = `
Cause: Type argument list cannot be empty." Cause: Type argument list cannot be empty."
`; `;
exports[`snippet: #13 format[yuku-ts] 1`] = `
"A type argument list cannot be empty (1:26)
> 1 | class Foo {property: Bar<> = 1}
| ^"
`;
exports[`snippet: #14 format[babel-ts] 1`] = ` exports[`snippet: #14 format[babel-ts] 1`] = `
"Type argument list cannot be empty. (1:26) "Type argument list cannot be empty. (1:26)
> 1 | (class Foo {property: Bar<> = 1}) > 1 | (class Foo {property: Bar<> = 1})
@@ -300,6 +384,12 @@ exports[`snippet: #14 format[typescript] 1`] = `
Cause: Type argument list cannot be empty." Cause: Type argument list cannot be empty."
`; `;
exports[`snippet: #14 format[yuku-ts] 1`] = `
"A type argument list cannot be empty (1:27)
> 1 | (class Foo {property: Bar<> = 1})
| ^"
`;
exports[`snippet: #15 format[babel-ts] 1`] = ` exports[`snippet: #15 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:14) "Type parameter list cannot be empty. (1:14)
> 1 | interface Foo<> {} > 1 | interface Foo<> {}
@@ -320,6 +410,12 @@ exports[`snippet: #15 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #15 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:15)
> 1 | interface Foo<> {}
| ^"
`;
exports[`snippet: #16 format[babel-ts] 1`] = ` exports[`snippet: #16 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:19) "Type parameter list cannot be empty. (1:19)
> 1 | interface Foo {bar<>()} > 1 | interface Foo {bar<>()}
@@ -340,6 +436,12 @@ exports[`snippet: #16 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #16 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:20)
> 1 | interface Foo {bar<>()}
| ^"
`;
exports[`snippet: #17 format[babel-ts] 1`] = ` exports[`snippet: #17 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:16) "Type parameter list cannot be empty. (1:16)
> 1 | interface Foo {<>(): boolean} > 1 | interface Foo {<>(): boolean}
@@ -360,6 +462,12 @@ exports[`snippet: #17 format[typescript] 1`] = `
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #17 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:17)
> 1 | interface Foo {<>(): boolean}
| ^"
`;
exports[`snippet: #18 format[babel-ts] 1`] = ` exports[`snippet: #18 format[babel-ts] 1`] = `
"Type argument list cannot be empty. (1:15) "Type argument list cannot be empty. (1:15)
> 1 | const foo: Foo<> = 1 > 1 | const foo: Foo<> = 1
@@ -380,6 +488,12 @@ exports[`snippet: #18 format[typescript] 1`] = `
Cause: Type argument list cannot be empty." Cause: Type argument list cannot be empty."
`; `;
exports[`snippet: #18 format[yuku-ts] 1`] = `
"A type argument list cannot be empty (1:16)
> 1 | const foo: Foo<> = 1
| ^"
`;
exports[`snippet: #19 format[babel-ts] 1`] = ` exports[`snippet: #19 format[babel-ts] 1`] = `
"Type parameter list cannot be empty. (1:12) "Type parameter list cannot be empty. (1:12)
> 1 | type Foo = <>() => {} > 1 | type Foo = <>() => {}
@@ -399,3 +513,9 @@ exports[`snippet: #19 format[typescript] 1`] = `
| ^^ | ^^
Cause: Type parameter list cannot be empty." Cause: Type parameter list cannot be empty."
`; `;
exports[`snippet: #19 format[yuku-ts] 1`] = `
"A type parameter list cannot be empty (1:13)
> 1 | type Foo = <>() => {}
| ^"
`;
@@ -24,5 +24,5 @@ runFormatTest(
"type Foo = <>() => {}", "type Foo = <>() => {}",
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -44,6 +44,22 @@ exports[`snippet: #0 format[typescript] 2`] = `
Cause: Computed property names are not allowed in enums." Cause: Computed property names are not allowed in enums."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Unexpected token '1' as enum member name (2:3)
1 | enum Foo {
> 2 | 1 = 1
| ^
3 | }"
`;
exports[`snippet: #0 format[yuku-ts] 2`] = `
"Computed property names are not allowed in enums (2:3)
1 | enum Foo {
> 2 | ['foo'] = 1
| ^^^^^^^
3 | }"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Unexpected token (2:3) "Unexpected token (2:3)
1 | enum Foo { 1 | enum Foo {
@@ -70,6 +86,14 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: An enum member cannot have a numeric name." Cause: An enum member cannot have a numeric name."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Unexpected token '1n' as enum member name (2:3)
1 | enum Foo {
> 2 | 1n = 1
| ^^
3 | }"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Unexpected token (2:3) "Unexpected token (2:3)
1 | enum Foo { 1 | enum Foo {
@@ -96,6 +120,14 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Computed property names are not allowed in enums." Cause: Computed property names are not allowed in enums."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Computed property names are not allowed in enums (2:3)
1 | enum Foo {
> 2 | [1] = 1
| ^^^
3 | }"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Unexpected token (2:3) "Unexpected token (2:3)
1 | enum Foo { 1 | enum Foo {
@@ -122,6 +154,14 @@ exports[`snippet: #3 format[typescript] 1`] = `
Cause: Computed property names are not allowed in enums." Cause: Computed property names are not allowed in enums."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"Computed property names are not allowed in enums (2:3)
1 | enum Foo {
> 2 | [1n] = 1
| ^^^^
3 | }"
`;
exports[`snippet: #4 format[babel-ts] 1`] = ` exports[`snippet: #4 format[babel-ts] 1`] = `
"Unexpected token (2:3) "Unexpected token (2:3)
1 | enum Foo { 1 | enum Foo {
@@ -147,3 +187,11 @@ exports[`snippet: #4 format[typescript] 1`] = `
3 | } 3 | }
Cause: Computed property names are not allowed in enums." Cause: Computed property names are not allowed in enums."
`; `;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"Computed property names are not allowed in enums (2:3)
1 | enum Foo {
> 2 | [foo] = 1
| ^^^^^
3 | }"
`;
@@ -11,7 +11,7 @@ runFormatTest(
`, `,
), ),
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
runFormatTest( runFormatTest(
@@ -32,5 +32,6 @@ runFormatTest(
// https://github.com/microsoft/TypeScript/issues/61834 // https://github.com/microsoft/TypeScript/issues/61834
// https://github.com/microsoft/TypeScript/issues/42468 // https://github.com/microsoft/TypeScript/issues/42468
// "oxc-ts", // "oxc-ts",
"yuku-ts",
], ],
); );
@@ -22,3 +22,10 @@ exports[`export-declare.ts format[typescript] 1`] = `
2 | 2 |
Cause: Declaration or statement expected." Cause: Declaration or statement expected."
`; `;
exports[`export-declare.ts format[yuku-ts] 1`] = `
"Expected declaration after 'export', but found 'declare' (1:8)
> 1 | export declare foo;
| ^^^^^^^
2 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -22,3 +22,10 @@ exports[`module-attributes-static.ts format[typescript] 1`] = `
2 | 2 |
Cause: '{' expected." Cause: '{' expected."
`; `;
exports[`module-attributes-static.ts format[yuku-ts] 1`] = `
"Expected '{' after 'with' in import attributes, but found 'type' (1:33)
> 1 | import foo from "foo.json" with type: "json";
| ^^^^
2 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -26,6 +26,14 @@ exports[`valid-flow-default-import.mts format[typescript] 1`] = `
Cause: '=' expected." Cause: '=' expected."
`; `;
exports[`valid-flow-default-import.mts format[yuku-ts] 1`] = `
"Expected 'from' after import clause, but found 'foo' (1:15)
> 1 | import module foo from "./module.wasm";
| ^^^
2 | import bar from "./module.wasm";
3 |"
`;
exports[`valid-ts-default-import.mts format[babel-ts] 1`] = ` exports[`valid-ts-default-import.mts format[babel-ts] 1`] = `
"Unexpected token, expected "from" (1:15) "Unexpected token, expected "from" (1:15)
> 1 | import module foo from "./module.wasm"; > 1 | import module foo from "./module.wasm";
@@ -51,3 +59,11 @@ exports[`valid-ts-default-import.mts format[typescript] 1`] = `
3 | 3 |
Cause: '=' expected." Cause: '=' expected."
`; `;
exports[`valid-ts-default-import.mts format[yuku-ts] 1`] = `
"Expected 'from' after import clause, but found 'foo' (1:15)
> 1 | import module foo from "./module.wasm";
| ^^^
2 | import bar from "./module.wasm";
3 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: A property signature cannot have an initializer." Cause: A property signature cannot have an initializer."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected ';', ',', or newline between type members, but found '=' (1:25)
> 1 | interface I { x: number = 1;}
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Unexpected token, expected "{" (1:13) "Unexpected token, expected "{" (1:13)
> 1 | interface A mixins B {} > 1 | interface A mixins B {}
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: '{' expected." Cause: '{' expected."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found 'mixins' (1:13)
> 1 | interface A mixins B {}
| ^^^^^^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Unexpected token, expected "{" (1:13) "Unexpected token, expected "{" (1:13)
> 1 | interface A implements B {} > 1 | interface A implements B {}
@@ -59,3 +71,9 @@ exports[`snippet: #2 format[typescript] 1`] = `
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
Cause: Interface declaration cannot have 'implements' clause." Cause: Interface declaration cannot have 'implements' clause."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found 'implements' (1:13)
> 1 | interface A implements B {}
| ^^^^^^^^^^"
`;
@@ -9,5 +9,5 @@ runFormatTest(
"interface A implements B {}", "interface A implements B {}",
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: A class can only implement an identifier/qualified-name with optional type arguments." Cause: A class can only implement an identifier/qualified-name with optional type arguments."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected '{' to start class body, but found '?.' (1:23)
> 1 | class Foo implements A?.B {}
| ^^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"'implements' list can only include identifiers or qualified-names with optional type arguments. (1:23) "'implements' list can only include identifiers or qualified-names with optional type arguments. (1:23)
> 1 | (class Foo implements A?.B {}) > 1 | (class Foo implements A?.B {})
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: A class can only implement an identifier/qualified-name with optional type arguments." Cause: A class can only implement an identifier/qualified-name with optional type arguments."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected '{' to start class body, but found '?.' (1:24)
> 1 | (class Foo implements A?.B {})
| ^^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"'implements' list can only include identifiers or qualified-names with optional type arguments. (1:22) "'implements' list can only include identifiers or qualified-names with optional type arguments. (1:22)
> 1 | class Foo implements "thing" {} > 1 | class Foo implements "thing" {}
@@ -60,6 +72,12 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: A class can only implement an identifier/qualified-name with optional type arguments." Cause: A class can only implement an identifier/qualified-name with optional type arguments."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Expected an identifier, but found '"thing"' (1:22)
> 1 | class Foo implements "thing" {}
| ^^^^^^^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"'implements' list can only include identifiers or qualified-names with optional type arguments. (1:23) "'implements' list can only include identifiers or qualified-names with optional type arguments. (1:23)
> 1 | (class Foo implements "thing" {}) > 1 | (class Foo implements "thing" {})
@@ -79,3 +97,9 @@ exports[`snippet: #3 format[typescript] 1`] = `
| ^^^^^^^ | ^^^^^^^
Cause: A class can only implement an identifier/qualified-name with optional type arguments." Cause: A class can only implement an identifier/qualified-name with optional type arguments."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"Expected an identifier, but found '"thing"' (1:23)
> 1 | (class Foo implements "thing" {})
| ^^^^^^^"
`;
@@ -6,5 +6,5 @@ runFormatTest(
'class Foo implements "thing" {}', 'class Foo implements "thing" {}',
].flatMap((code) => [code, `(${code})`]), ].flatMap((code) => [code, `(${code})`]),
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -1,27 +0,0 @@
runFormatTest(
{
importMeta: import.meta,
snippets: [
"let x!",
"let x! = 1",
"class C {x!}",
"class C {x! = 1}",
// "class C {accessor x!}",
// "class C {accessor x! = 1}",
],
},
["typescript", "babel-ts", "oxc-ts"],
);
runFormatTest(
{
importMeta: import.meta,
snippets: ["class C {accessor x!}", "class C {accessor x! = 1}"],
},
[
"typescript",
"babel-ts",
// https://github.com/oxc-project/oxc/issues/24503
// "oxc-ts",
],
);
@@ -7,13 +7,6 @@ exports[`snippet: #0 format[babel-ts] 1`] = `
Cause: Declarations with definite assignment assertions must also have type annotations. (1:4)" Cause: Declarations with definite assignment assertions must also have type annotations. (1:4)"
`; `;
exports[`snippet: #0 format[babel-ts] 2`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:10)
> 1 | class C {accessor x!}
| ^
Cause: Declarations with definite assignment assertions must also have type annotations. (1:9)"
`;
exports[`snippet: #0 format[oxc-ts] 1`] = ` exports[`snippet: #0 format[oxc-ts] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:6) "Declarations with definite assignment assertions must also have type annotations. (1:6)
> 1 | let x! > 1 | let x!
@@ -27,11 +20,10 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Declarations with definite assignment assertions must also have type annotations." Cause: Declarations with definite assignment assertions must also have type annotations."
`; `;
exports[`snippet: #0 format[typescript] 2`] = ` exports[`snippet: #0 format[yuku-ts] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:10) "A declaration with a definite assignment assertion must also have a type annotation (1:5)
> 1 | class C {accessor x!} > 1 | let x!
| ^^^^^^^^^^^ | ^"
Cause: Declarations with definite assignment assertions must also have type annotations."
`; `;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
@@ -41,13 +33,6 @@ exports[`snippet: #1 format[babel-ts] 1`] = `
Cause: Declarations with initializers cannot also have definite assignment assertions. (1:4)" Cause: Declarations with initializers cannot also have definite assignment assertions. (1:4)"
`; `;
exports[`snippet: #1 format[babel-ts] 2`] = `
"Declarations with initializers cannot also have definite assignment assertions. (1:10)
> 1 | class C {accessor x! = 1}
| ^
Cause: Declarations with initializers cannot also have definite assignment assertions. (1:9)"
`;
exports[`snippet: #1 format[oxc-ts] 1`] = ` exports[`snippet: #1 format[oxc-ts] 1`] = `
"Declarations with initializers cannot also have definite assignment assertions. (1:6) "Declarations with initializers cannot also have definite assignment assertions. (1:6)
> 1 | let x! = 1 > 1 | let x! = 1
@@ -61,11 +46,10 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Declarations with initializers cannot also have definite assignment assertions." Cause: Declarations with initializers cannot also have definite assignment assertions."
`; `;
exports[`snippet: #1 format[typescript] 2`] = ` exports[`snippet: #1 format[yuku-ts] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:10) "A declaration with an initializer cannot also have a definite assignment assertion (1:5)
> 1 | class C {accessor x! = 1} > 1 | let x! = 1
| ^^^^^^^^^^^^^^^ | ^"
Cause: Declarations with definite assignment assertions must also have type annotations."
`; `;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
@@ -88,6 +72,12 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Declarations with definite assignment assertions must also have type annotations." Cause: Declarations with definite assignment assertions must also have type annotations."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"A declaration with a definite assignment assertion must also have a type annotation (1:10)
> 1 | class C {x!}
| ^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Declarations with initializers cannot also have definite assignment assertions. (1:10) "Declarations with initializers cannot also have definite assignment assertions. (1:10)
> 1 | class C {x! = 1} > 1 | class C {x! = 1}
@@ -107,3 +97,61 @@ exports[`snippet: #3 format[typescript] 1`] = `
| ^^^^^^ | ^^^^^^
Cause: Declarations with definite assignment assertions must also have type annotations." Cause: Declarations with definite assignment assertions must also have type annotations."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"A declaration with an initializer cannot also have a definite assignment assertion (1:10)
> 1 | class C {x! = 1}
| ^"
`;
exports[`snippet: #4 format[babel-ts] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:10)
> 1 | class C {accessor x!}
| ^
Cause: Declarations with definite assignment assertions must also have type annotations. (1:9)"
`;
exports[`snippet: #4 format[oxc-ts] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:20)
> 1 | class C {accessor x!}
| ^"
`;
exports[`snippet: #4 format[typescript] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:10)
> 1 | class C {accessor x!}
| ^^^^^^^^^^^
Cause: Declarations with definite assignment assertions must also have type annotations."
`;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"A declaration with a definite assignment assertion must also have a type annotation (1:19)
> 1 | class C {accessor x!}
| ^"
`;
exports[`snippet: #5 format[babel-ts] 1`] = `
"Declarations with initializers cannot also have definite assignment assertions. (1:10)
> 1 | class C {accessor x! = 1}
| ^
Cause: Declarations with initializers cannot also have definite assignment assertions. (1:9)"
`;
exports[`snippet: #5 format[oxc-ts] 1`] = `
"Declarations with initializers cannot also have definite assignment assertions. (1:20)
> 1 | class C {accessor x! = 1}
| ^"
`;
exports[`snippet: #5 format[typescript] 1`] = `
"Declarations with definite assignment assertions must also have type annotations. (1:10)
> 1 | class C {accessor x! = 1}
| ^^^^^^^^^^^^^^^
Cause: Declarations with definite assignment assertions must also have type annotations."
`;
exports[`snippet: #5 format[yuku-ts] 1`] = `
"A declaration with an initializer cannot also have a definite assignment assertion (1:19)
> 1 | class C {accessor x! = 1}
| ^"
`;
@@ -0,0 +1,14 @@
runFormatTest(
{
importMeta: import.meta,
snippets: [
"let x!",
"let x! = 1",
"class C {x!}",
"class C {x! = 1}",
"class C {accessor x!}",
"class C {accessor x! = 1}",
],
},
["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
);
@@ -7,9 +7,21 @@ exports[`snippet: #0 format[babel-ts] 1`] = `
Cause: An import alias can not use 'import type'. (1:16)" Cause: An import alias can not use 'import type'. (1:16)"
`; `;
exports[`snippet: #0 format[oxc-ts] 1`] = `
"An import alias cannot use 'import type' (1:1)
> 1 | import type F = T;
| ^^^^^^^^^^^^^^^^^^"
`;
exports[`snippet: #0 format[typescript] 1`] = ` exports[`snippet: #0 format[typescript] 1`] = `
"An import alias cannot use 'import type' (1:1) "An import alias cannot use 'import type' (1:1)
> 1 | import type F = T; > 1 | import type F = T;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
Cause: An import alias cannot use 'import type'" Cause: An import alias cannot use 'import type'"
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"An import alias cannot use 'import type' (1:1)
> 1 | import type F = T;
| ^^^^^^^^^^^^^^^^^"
`;
@@ -3,10 +3,5 @@ runFormatTest(
importMeta: import.meta, importMeta: import.meta,
snippets: ["import type F = T;"], snippets: ["import type F = T;"],
}, },
[ ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
"typescript",
"babel-ts",
// Didn't reject
// "oxc-ts"
],
); );
@@ -7,6 +7,12 @@ exports[`snippet: #0 format[babel-ts] 1`] = `
Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)" Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)"
`; `;
exports[`snippet: #0 format[oxc-ts] 1`] = `
"An interface can only extend an identifier/qualified-name with optional type arguments. (1:21)
> 1 | interface A extends (typeof fs) { }
| ^^^^^^^^^^^"
`;
exports[`snippet: #0 format[typescript] 1`] = ` exports[`snippet: #0 format[typescript] 1`] = `
"Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21) "Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21)
> 1 | interface A extends (typeof fs) { } > 1 | interface A extends (typeof fs) { }
@@ -14,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments." Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected an identifier, but found '(' (1:21)
> 1 | interface A extends (typeof fs) { }
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21) "'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21)
> 1 | interface B extends C['D'] { } > 1 | interface B extends C['D'] { }
@@ -21,6 +33,12 @@ exports[`snippet: #1 format[babel-ts] 1`] = `
Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)" Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)"
`; `;
exports[`snippet: #1 format[oxc-ts] 1`] = `
"An interface can only extend an identifier/qualified-name with optional type arguments. (1:21)
> 1 | interface B extends C['D'] { }
| ^^^^^^"
`;
exports[`snippet: #1 format[typescript] 1`] = ` exports[`snippet: #1 format[typescript] 1`] = `
"Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21) "Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21)
> 1 | interface B extends C['D'] { } > 1 | interface B extends C['D'] { }
@@ -28,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments." Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found '[' (1:22)
> 1 | interface B extends C['D'] { }
| ^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21) "'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21)
> 1 | interface E extends F?.G { } > 1 | interface E extends F?.G { }
@@ -35,6 +59,12 @@ exports[`snippet: #2 format[babel-ts] 1`] = `
Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)" Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)"
`; `;
exports[`snippet: #2 format[oxc-ts] 1`] = `
"An interface can only extend an identifier/qualified-name with optional type arguments. (1:21)
> 1 | interface E extends F?.G { }
| ^^^^"
`;
exports[`snippet: #2 format[typescript] 1`] = ` exports[`snippet: #2 format[typescript] 1`] = `
"Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21) "Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21)
> 1 | interface E extends F?.G { } > 1 | interface E extends F?.G { }
@@ -42,6 +72,12 @@ exports[`snippet: #2 format[typescript] 1`] = `
Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments." Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found '?.' (1:22)
> 1 | interface E extends F?.G { }
| ^^"
`;
exports[`snippet: #3 format[babel-ts] 1`] = ` exports[`snippet: #3 format[babel-ts] 1`] = `
"Unexpected token, expected "," (1:23) "Unexpected token, expected "," (1:23)
> 1 | interface H extends I extends J { } > 1 | interface H extends I extends J { }
@@ -49,6 +85,12 @@ exports[`snippet: #3 format[babel-ts] 1`] = `
Cause: Unexpected token, expected "," (1:22)" Cause: Unexpected token, expected "," (1:22)"
`; `;
exports[`snippet: #3 format[oxc-ts] 1`] = `
"'extends' clause already seen (1:23)
> 1 | interface H extends I extends J { }
| ^^^^^^^"
`;
exports[`snippet: #3 format[typescript] 1`] = ` exports[`snippet: #3 format[typescript] 1`] = `
"'extends' clause already seen. (1:23) "'extends' clause already seen. (1:23)
> 1 | interface H extends I extends J { } > 1 | interface H extends I extends J { }
@@ -56,6 +98,12 @@ exports[`snippet: #3 format[typescript] 1`] = `
Cause: 'extends' clause already seen." Cause: 'extends' clause already seen."
`; `;
exports[`snippet: #3 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found 'extends' (1:23)
> 1 | interface H extends I extends J { }
| ^^^^^^^"
`;
exports[`snippet: #4 format[babel-ts] 1`] = ` exports[`snippet: #4 format[babel-ts] 1`] = `
"'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21) "'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21)
> 1 | interface K extends 2 { } > 1 | interface K extends 2 { }
@@ -63,6 +111,12 @@ exports[`snippet: #4 format[babel-ts] 1`] = `
Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)" Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)"
`; `;
exports[`snippet: #4 format[oxc-ts] 1`] = `
"An interface can only extend an identifier/qualified-name with optional type arguments. (1:21)
> 1 | interface K extends 2 { }
| ^"
`;
exports[`snippet: #4 format[typescript] 1`] = ` exports[`snippet: #4 format[typescript] 1`] = `
"Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21) "Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21)
> 1 | interface K extends 2 { } > 1 | interface K extends 2 { }
@@ -70,6 +124,12 @@ exports[`snippet: #4 format[typescript] 1`] = `
Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments." Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments."
`; `;
exports[`snippet: #4 format[yuku-ts] 1`] = `
"Expected an identifier, but found '2' (1:21)
> 1 | interface K extends 2 { }
| ^"
`;
exports[`snippet: #5 format[babel-ts] 1`] = ` exports[`snippet: #5 format[babel-ts] 1`] = `
"'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21) "'extends' list can only include identifiers or qualified-names with optional type arguments. (1:21)
> 1 | interface L extends M().N { } > 1 | interface L extends M().N { }
@@ -77,9 +137,21 @@ exports[`snippet: #5 format[babel-ts] 1`] = `
Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)" Cause: 'extends' list can only include identifiers or qualified-names with optional type arguments. (1:20)"
`; `;
exports[`snippet: #5 format[oxc-ts] 1`] = `
"An interface can only extend an identifier/qualified-name with optional type arguments. (1:21)
> 1 | interface L extends M().N { }
| ^^^^^"
`;
exports[`snippet: #5 format[typescript] 1`] = ` exports[`snippet: #5 format[typescript] 1`] = `
"Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21) "Interface declaration can only extend an identifier/qualified name with optional type arguments. (1:21)
> 1 | interface L extends M().N { } > 1 | interface L extends M().N { }
| ^^^^^ | ^^^^^
Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments." Cause: Interface declaration can only extend an identifier/qualified name with optional type arguments."
`; `;
exports[`snippet: #5 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found '(' (1:22)
> 1 | interface L extends M().N { }
| ^"
`;
@@ -18,5 +18,5 @@ runFormatTest(
"interface L extends M().N { }", "interface L extends M().N { }",
], ],
}, },
["typescript", "babel-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -27,6 +27,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: 'extends' list cannot be empty." Cause: 'extends' list cannot be empty."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected an identifier, but found '{' (1:23)
> 1 | interface Foo extends {}
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Unexpected token, expected "{" (1:13) "Unexpected token, expected "{" (1:13)
> 1 | interface F implements {} > 1 | interface F implements {}
@@ -47,6 +53,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Interface declaration cannot have 'implements' clause." Cause: Interface declaration cannot have 'implements' clause."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found 'implements' (1:13)
> 1 | interface F implements {}
| ^^^^^^^^^^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Unexpected token, expected "{" (1:13) "Unexpected token, expected "{" (1:13)
> 1 | interface F implements A {} > 1 | interface F implements A {}
@@ -66,3 +78,9 @@ exports[`snippet: #2 format[typescript] 1`] = `
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
Cause: Interface declaration cannot have 'implements' clause." Cause: Interface declaration cannot have 'implements' clause."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"Expected '{' to start an interface body, but found 'implements' (1:13)
> 1 | interface F implements A {}
| ^^^^^^^^^^"
`;
@@ -5,14 +5,21 @@ runFormatTest(
"interface Foo extends {}", "interface Foo extends {}",
"interface F implements {}", "interface F implements {}",
"interface F implements A {}", "interface F implements A {}",
// "interface F extends implements {}",
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
runFormatTest( runFormatTest(
{ {
importMeta: import.meta, importMeta: import.meta,
snippets: ["interface F extends implements {}"], snippets: ["interface F extends implements {}"],
}, },
["typescript"], [
"typescript",
// "babel-ts",
// "oxc-ts",
// "yuku-ts",
],
); );
@@ -10,6 +10,15 @@ exports[`decorator.ts format[babel-ts] 1`] = `
Cause: Leading decorators must be attached to a class declaration. (4:0)" Cause: Leading decorators must be attached to a class declaration. (4:0)"
`; `;
exports[`decorator.ts format[oxc-ts] 1`] = `
"Unexpected token (4:1)
2 |
3 | @dec
> 4 | enum E {}
| ^^^^
5 |"
`;
exports[`decorator.ts format[typescript] 1`] = ` exports[`decorator.ts format[typescript] 1`] = `
"Decorators are not valid here. (3:1) "Decorators are not valid here. (3:1)
1 | declare function dec<T>(target: T): T; 1 | declare function dec<T>(target: T): T;
@@ -21,6 +30,15 @@ exports[`decorator.ts format[typescript] 1`] = `
Cause: Decorators are not valid here." Cause: Decorators are not valid here."
`; `;
exports[`decorator.ts format[yuku-ts] 1`] = `
"Expected 'class' keyword, but found 'enum' (4:1)
2 |
3 | @dec
> 4 | enum E {}
| ^^^^
5 |"
`;
exports[`enums.ts format[babel-ts] 1`] = ` exports[`enums.ts format[babel-ts] 1`] = `
"Leading decorators must be attached to a class declaration. (4:1) "Leading decorators must be attached to a class declaration. (4:1)
2 | 2 |
@@ -33,6 +51,17 @@ exports[`enums.ts format[babel-ts] 1`] = `
Cause: Leading decorators must be attached to a class declaration. (4:0)" Cause: Leading decorators must be attached to a class declaration. (4:0)"
`; `;
exports[`enums.ts format[oxc-ts] 1`] = `
"Unexpected token (4:1)
2 |
3 | @decorator()
> 4 | enum Direction {
| ^^^^
5 | Up = 1,
6 | Down,
7 | Left,"
`;
exports[`enums.ts format[typescript] 1`] = ` exports[`enums.ts format[typescript] 1`] = `
"Decorators are not valid here. (3:1) "Decorators are not valid here. (3:1)
1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375
@@ -45,6 +74,17 @@ exports[`enums.ts format[typescript] 1`] = `
Cause: Decorators are not valid here." Cause: Decorators are not valid here."
`; `;
exports[`enums.ts format[yuku-ts] 1`] = `
"Expected 'class' keyword, but found 'enum' (4:1)
2 |
3 | @decorator()
> 4 | enum Direction {
| ^^^^
5 | Up = 1,
6 | Down,
7 | Left,"
`;
exports[`function.ts format[babel-ts] 1`] = ` exports[`function.ts format[babel-ts] 1`] = `
"Leading decorators must be attached to a class declaration. (4:1) "Leading decorators must be attached to a class declaration. (4:1)
2 | 2 |
@@ -55,6 +95,15 @@ exports[`function.ts format[babel-ts] 1`] = `
Cause: Leading decorators must be attached to a class declaration. (4:0)" Cause: Leading decorators must be attached to a class declaration. (4:0)"
`; `;
exports[`function.ts format[oxc-ts] 1`] = `
"Unexpected token (4:1)
2 |
3 | @decorator()
> 4 | function foo( ){}
| ^^^^^^^^
5 |"
`;
exports[`function.ts format[typescript] 1`] = ` exports[`function.ts format[typescript] 1`] = `
"Decorators are not valid here. (3:1) "Decorators are not valid here. (3:1)
1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375
@@ -66,6 +115,15 @@ exports[`function.ts format[typescript] 1`] = `
Cause: Decorators are not valid here." Cause: Decorators are not valid here."
`; `;
exports[`function.ts format[yuku-ts] 1`] = `
"Expected 'class' keyword, but found 'function' (4:1)
2 |
3 | @decorator()
> 4 | function foo( ){}
| ^^^^^^^^
5 |"
`;
exports[`interface.ts format[babel-ts] 1`] = ` exports[`interface.ts format[babel-ts] 1`] = `
"Leading decorators must be attached to a class declaration. (5:1) "Leading decorators must be attached to a class declaration. (5:1)
3 | 3 |
@@ -77,6 +135,16 @@ exports[`interface.ts format[babel-ts] 1`] = `
Cause: Leading decorators must be attached to a class declaration. (5:0)" Cause: Leading decorators must be attached to a class declaration. (5:0)"
`; `;
exports[`interface.ts format[oxc-ts] 1`] = `
"Unexpected token (5:1)
3 |
4 | @hello()
> 5 | interface MyInterface {id: string;
| ^^^^^^^^^
6 | }
7 |"
`;
exports[`interface.ts format[typescript] 1`] = ` exports[`interface.ts format[typescript] 1`] = `
"Decorators are not valid here. (4:1) "Decorators are not valid here. (4:1)
2 | // #4632 2 | // #4632
@@ -89,6 +157,16 @@ exports[`interface.ts format[typescript] 1`] = `
Cause: Decorators are not valid here." Cause: Decorators are not valid here."
`; `;
exports[`interface.ts format[yuku-ts] 1`] = `
"Expected 'class' keyword, but found 'interface' (5:1)
3 |
4 | @hello()
> 5 | interface MyInterface {id: string;
| ^^^^^^^^^
6 | }
7 |"
`;
exports[`issue-9102.ts format[babel-ts] 1`] = ` exports[`issue-9102.ts format[babel-ts] 1`] = `
"Leading decorators must be attached to a class declaration. (2:1) "Leading decorators must be attached to a class declaration. (2:1)
1 | @Decorator() 1 | @Decorator()
@@ -99,6 +177,15 @@ exports[`issue-9102.ts format[babel-ts] 1`] = `
Cause: Leading decorators must be attached to a class declaration. (2:0)" Cause: Leading decorators must be attached to a class declaration. (2:0)"
`; `;
exports[`issue-9102.ts format[oxc-ts] 1`] = `
"Unexpected token (2:1)
1 | @Decorator()
> 2 | type T = 1;
| ^^^^
3 | class C {}
4 |"
`;
exports[`issue-9102.ts format[typescript] 1`] = ` exports[`issue-9102.ts format[typescript] 1`] = `
"Decorators are not valid here. (1:1) "Decorators are not valid here. (1:1)
> 1 | @Decorator() > 1 | @Decorator()
@@ -108,3 +195,12 @@ exports[`issue-9102.ts format[typescript] 1`] = `
4 | 4 |
Cause: Decorators are not valid here." Cause: Decorators are not valid here."
`; `;
exports[`issue-9102.ts format[yuku-ts] 1`] = `
"Expected 'class' keyword, but found 'type' (2:1)
1 | @Decorator()
> 2 | type T = 1;
| ^^^^
3 | class C {}
4 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -28,3 +28,12 @@ exports[`invalid-jsx-1.tsx format[typescript] 1`] = `
4 | 4 |
Cause: Unexpected token. Did you mean \`{'>'}\` or \`&gt;\`?" Cause: Unexpected token. Did you mean \`{'>'}\` or \`&gt;\`?"
`; `;
exports[`invalid-jsx-1.tsx format[yuku-ts] 1`] = `
"Unexpected '>' in JSX text (3:45)
1 | // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-and--are-now-invalid-jsx-text-characters
2 |
> 3 | let directions = <div>Navigate to: Menu Bar > Tools > Options</div>
| ^
4 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Only a single variable declaration is allowed in a 'for...of' statement." Cause: Only a single variable declaration is allowed in a 'for...of' statement."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected ';' after for-loop init, but found 'X' (1:13)
> 1 | for (var of X);
| ^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Unexpected token (1:15) "Unexpected token (1:15)
> 1 | for (var of of); > 1 | for (var of of);
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Only a single variable declaration is allowed in a 'for...of' statement." Cause: Only a single variable declaration is allowed in a 'for...of' statement."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Unexpected token ')' (1:15)
> 1 | for (var of of);
| ^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Unexpected keyword 'in'. (1:10) "Unexpected keyword 'in'. (1:10)
> 1 | for (var in X); > 1 | for (var in X);
@@ -59,3 +71,9 @@ exports[`snippet: #2 format[typescript] 1`] = `
| ^^^ | ^^^
Cause: Only a single variable declaration is allowed in a 'for...in' statement." Cause: Only a single variable declaration is allowed in a 'for...in' statement."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"'in' is reserved and cannot be used as a binding identifier (1:10)
> 1 | for (var in X);
| ^^"
`;
@@ -3,5 +3,5 @@ runFormatTest(
importMeta: import.meta, importMeta: import.meta,
snippets: ["for (var of X);", "for (var of of);", "for (var in X);"], snippets: ["for (var of X);", "for (var of of);", "for (var in X);"],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -31,3 +31,13 @@ exports[`mapped-type.ts format[typescript] 1`] = `
5 | 5 |
Cause: A mapped type may not declare properties or methods." Cause: A mapped type may not declare properties or methods."
`; `;
exports[`mapped-type.ts format[yuku-ts] 1`] = `
"Expected '}' to close a mapped type, but found 'extra_member' (3:3)
1 | type Mapped = {
2 | [key in keyof O]: number;
> 3 | extra_member: should_not_allowed
| ^^^^^^^^^^^^
4 | };
5 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);
File diff suppressed because it is too large. Load diff
@@ -152,5 +152,5 @@ runFormatTest(
]), ]),
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -20,6 +20,12 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: Identifier expected." Cause: Identifier expected."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found '"a"' (1:11)
> 1 | namespace "a" {}
| ^^^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Missing semicolon. (1:10) "Missing semicolon. (1:10)
> 1 | namespace "a"; > 1 | namespace "a";
@@ -40,6 +46,12 @@ exports[`snippet: #1 format[typescript] 1`] = `
Cause: Identifier expected." Cause: Identifier expected."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found '"a"' (1:11)
> 1 | namespace "a";
| ^^^"
`;
exports[`snippet: #2 format[babel-ts] 1`] = ` exports[`snippet: #2 format[babel-ts] 1`] = `
"Unexpected token, expected "{" (1:12) "Unexpected token, expected "{" (1:12)
> 1 | namespace a; > 1 | namespace a;
@@ -59,3 +71,9 @@ exports[`snippet: #2 format[typescript] 1`] = `
| ^ | ^
Cause: '{' expected." Cause: '{' expected."
`; `;
exports[`snippet: #2 format[yuku-ts] 1`] = `
"A namespace declaration requires a body (1:1)
> 1 | namespace a;
| ^^^^^^^^^^^"
`;
@@ -3,5 +3,5 @@ runFormatTest(
importMeta: import.meta, importMeta: import.meta,
snippets: ['namespace "a" {}', 'namespace "a";', "namespace a;"], snippets: ['namespace "a" {}', 'namespace "a";', "namespace a;"],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -1,12 +1,5 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`snippet: #0 format 1`] = `
"Type parameters cannot appear on a constructor declaration. (1:24)
> 1 | class A { 'constructor'<a>() {} }
| ^
Cause: Type parameters cannot appear on a constructor declaration. (1:23)"
`;
exports[`snippet: #0 format[babel-ts] 1`] = ` exports[`snippet: #0 format[babel-ts] 1`] = `
"Tuple members must be labeled with a simple identifier. (1:11) "Tuple members must be labeled with a simple identifier. (1:11)
> 1 | type T = [x.y: A]; > 1 | type T = [x.y: A];
@@ -21,6 +14,13 @@ exports[`snippet: #0 format[babel-ts] 2`] = `
Cause: A required element cannot follow an optional element. (1:17)" Cause: A required element cannot follow an optional element. (1:17)"
`; `;
exports[`snippet: #0 format[babel-ts] 3`] = `
"Type parameters cannot appear on a constructor declaration. (1:24)
> 1 | class A { 'constructor'<a>() {} }
| ^
Cause: Type parameters cannot appear on a constructor declaration. (1:23)"
`;
exports[`snippet: #0 format[oxc-ts] 1`] = ` exports[`snippet: #0 format[oxc-ts] 1`] = `
"Expected \`,\` or \`]\` but found \`:\` (1:14) "Expected \`,\` or \`]\` but found \`:\` (1:14)
> 1 | type T = [x.y: A]; > 1 | type T = [x.y: A];
@@ -40,6 +40,24 @@ exports[`snippet: #0 format[typescript] 1`] = `
Cause: ',' expected." Cause: ',' expected."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"Expected ']' to close a tuple type, but found ':' (1:14)
> 1 | type T = [x.y: A];
| ^"
`;
exports[`snippet: #0 format[yuku-ts] 2`] = `
"A required element cannot follow an optional element (1:18)
> 1 | type T = [x?: A, y: B];
| ^^^^"
`;
exports[`snippet: #0 format[yuku-ts] 3`] = `
"Type parameters cannot appear on a constructor declaration (1:24)
> 1 | class A { 'constructor'<a>() {} }
| ^^^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"Tuple members must be labeled with a simple identifier. (1:11) "Tuple members must be labeled with a simple identifier. (1:11)
> 1 | type T = [x<y>: A]; > 1 | type T = [x<y>: A];
@@ -72,3 +90,15 @@ exports[`snippet: #1 format[typescript] 1`] = `
| ^ | ^
Cause: ',' expected." Cause: ',' expected."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"Expected ']' to close a tuple type, but found ':' (1:15)
> 1 | type T = [x<y>: A];
| ^"
`;
exports[`snippet: #1 format[yuku-ts] 2`] = `
"Type parameters cannot appear on a constructor declaration (1:22)
> 1 | class A { constructor<a>() {} }
| ^^^"
`;
@@ -8,7 +8,7 @@ runFormatTest(
"type T = [x<y>: A];", "type T = [x<y>: A];",
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
runFormatTest( runFormatTest(
@@ -25,6 +25,7 @@ runFormatTest(
// "typescript", // "typescript",
"babel-ts", "babel-ts",
"oxc-ts", "oxc-ts",
"yuku-ts",
], ],
); );
@@ -40,5 +41,6 @@ runFormatTest(
// "typescript", // "typescript",
"babel-ts", "babel-ts",
// "oxc-ts", // "oxc-ts",
"yuku-ts",
], ],
); );
@@ -33,6 +33,18 @@ exports[`snippet: #0 format[typescript] 2`] = `
Cause: A type-only import can specify a default import or named bindings, but not both." Cause: A type-only import can specify a default import or named bindings, but not both."
`; `;
exports[`snippet: #0 format[yuku-ts] 1`] = `
"A type-only import can specify a default import or named bindings, but not both (1:13)
> 1 | import type foo, {} from "foo"
| ^^^^^^^"
`;
exports[`snippet: #0 format[yuku-ts] 2`] = `
"A type-only import can specify a default import or named bindings, but not both (1:13)
> 1 | import type foo, {named} from "foo"
| ^^^^^^^^^^^^"
`;
exports[`snippet: #1 format[babel-ts] 1`] = ` exports[`snippet: #1 format[babel-ts] 1`] = `
"A type-only import can specify a default import or named bindings, but not both. (1:1) "A type-only import can specify a default import or named bindings, but not both. (1:1)
> 1 | import type foo, * as namespace from "foo" > 1 | import type foo, * as namespace from "foo"
@@ -52,3 +64,9 @@ exports[`snippet: #1 format[typescript] 1`] = `
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
Cause: A type-only import can specify a default import or named bindings, but not both." Cause: A type-only import can specify a default import or named bindings, but not both."
`; `;
exports[`snippet: #1 format[yuku-ts] 1`] = `
"A type-only import can specify a default import or named bindings, but not both (1:13)
> 1 | import type foo, * as namespace from "foo"
| ^^^^^^^^^^^^^^^^^^^"
`;
@@ -8,6 +8,7 @@ runFormatTest(
// `babel-ts` didn't reject // `babel-ts` didn't reject
// "babel-ts", // "babel-ts",
"oxc-ts", "oxc-ts",
"yuku-ts",
], ],
); );
runFormatTest( runFormatTest(
@@ -18,5 +19,5 @@ runFormatTest(
'import type foo, * as namespace from "foo"', 'import type foo, * as namespace from "foo"',
], ],
}, },
["typescript", "babel-ts", "oxc-ts"], ["typescript", "babel-ts", "oxc-ts", "yuku-ts"],
); );
@@ -28,3 +28,12 @@ exports[`value-of-abstract-property.ts format[typescript] 1`] = `
4 | 4 |
Cause: Abstract property cannot have an initializer." Cause: Abstract property cannot have an initializer."
`; `;
exports[`value-of-abstract-property.ts format[yuku-ts] 1`] = `
"An abstract property cannot have an initializer (2:19)
1 | abstract class Foo {
> 2 | abstract prop = 3;
| ^
3 | }
4 |"
`;
@@ -1 +1 @@
runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts"]); runFormatTest(import.meta, ["typescript", "babel-ts", "oxc-ts", "yuku-ts"]);