Switch to oxidized flow parser (#19398)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Sam Zhouandfisker authored and GitHub committed 2026-06-23 08:44:23 +08:00
1 parent 3b5e6d059c
commit 9c0e48cd25
53 files changed
+575 -345

No files matched your search

@@ -16,7 +16,9 @@ const unstableTests = new Map(
(options) => options.proseWrap === "always",
],
"flow/hook/declare-hook.js",
"flow/hook/comments-before-arrow.js",
"flow/hook/hook-type-annotation.js",
"flow/comments/type_annotations.js",
"typescript/prettier-ignore/mapped-types.ts",
"typescript/prettier-ignore/issue-14238.ts",
"js/for-of/comments.js",
@@ -5,36 +5,41 @@ exports[`async-arrow-invalid.js format 1`] = `
2 |
3 | <T> async () => {}
> 4 |
| ^"
| ^
Cause: Unexpected token ILLEGAL (4:0)"
`;
exports[`function-async.js format 1`] = `
"Unexpected token \`;\`, expected the token \`=>\` (2:11)
1 | // Flow can't parse this since \`v0.128.0\`, #8661
> 2 | async<T>();
| ^"
| ^
Cause: Unexpected token \`;\`, expected the token \`=>\` (2:10)"
`;
exports[`invalid_keyword_symbol.js format 1`] = `
"Unexpected reserved type (1:6)
> 1 | type symbol = number;
| ^^^^^^
2 |"
| ^
2 |
Cause: Unexpected reserved type (1:5)"
`;
exports[`module-attributes-static.js format 1`] = `
"Unexpected token \`type\`, expected the token \`{\` (1:33)
> 1 | import foo from "foo.json" with type: "json";
| ^^^^
2 |"
| ^
2 |
Cause: Unexpected token \`type\`, expected the token \`{\` (1:32)"
`;
exports[`newline-before-arrow.js format 1`] = `
"Illegal newline before arrow (2:1)
1 | async x
> 2 | => x
| ^^
3 |"
| ^
3 |
Cause: Illegal newline before arrow (2:0)"
`;
exports[`number.js format 1`] = `
@@ -42,13 +47,15 @@ exports[`number.js format 1`] = `
1 | // https://github.com/babel/babel/pull/11854
2 |
> 3 | a = 09e1_1;
| ^^^^
4 |"
| ^
4 |
Cause: Unexpected token ILLEGAL (3:4)"
`;
exports[`spread-with-optional.js format 1`] = `
"Tuple spread elements cannot be optional. (1:17)
> 1 | type T = [...foo?: S]; // ERROR
| ^
2 |"
2 |
Cause: Tuple spread elements cannot be optional. (1:16)"
`;
@@ -3,13 +3,15 @@
exports[`ambient.js format 1`] = `
"Const must be initialized (1:7)
> 1 | const foo: string;
| ^^^^^^^^^^^
2 |"
| ^
2 |
Cause: Const must be initialized (1:6)"
`;
exports[`ambient.unknown format 1`] = `
"Const must be initialized (1:7)
> 1 | const foo: string;
| ^^^^^^^^^^^
2 |"
| ^
2 |
Cause: Const must be initialized (1:6)"
`;
@@ -3,15 +3,17 @@
exports[`valid-flow-default-import.js format 1`] = `
"Unexpected identifier, expected the keyword \`from\` (1:15)
> 1 | import module foo from "./module.wasm";
| ^^^
| ^
2 | import bar from "./module.wasm";
3 |"
3 |
Cause: Unexpected identifier, expected the keyword \`from\` (1:14)"
`;
exports[`valid-ts-default-import.js format 1`] = `
"Unexpected identifier, expected the keyword \`from\` (1:15)
> 1 | import module foo from "./module.wasm";
| ^^^
| ^
2 | import bar from "./module.wasm";
3 |"
3 |
Cause: Unexpected identifier, expected the keyword \`from\` (1:14)"
`;
@@ -10,7 +10,8 @@ Cause: Unexpected token, expected "{" (1:12)"
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected identifier, expected the token \`{\` (1:13)
> 1 | interface A mixins B {}
| ^^^^^^"
| ^
Cause: Unexpected identifier, expected the token \`{\` (1:12)"
`;
exports[`snippet: #1 format[babel-flow] 1`] = `
@@ -23,7 +24,8 @@ Cause: Unexpected token, expected "{" (1:12)"
exports[`snippet: #1 format[flow] 1`] = `
"Unexpected identifier, expected the token \`{\` (1:13)
> 1 | interface A implements B {}
| ^^^^^^^^^^"
| ^
Cause: Unexpected identifier, expected the token \`{\` (1:12)"
`;
exports[`snippet: #2 format[babel-flow] 1`] = `
@@ -36,7 +38,8 @@ Cause: Unexpected token, expected "{" (1:20)"
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected identifier, expected the token \`{\` (1:21)
> 1 | declare interface A mixins B {}
| ^^^^^^"
| ^
Cause: Unexpected identifier, expected the token \`{\` (1:20)"
`;
exports[`snippet: #3 format[babel-flow] 1`] = `
@@ -49,5 +52,6 @@ Cause: Unexpected token, expected "{" (1:20)"
exports[`snippet: #3 format[flow] 1`] = `
"Unexpected identifier, expected the token \`{\` (1:21)
> 1 | declare interface A implements B {}
| ^^^^^^^^^^"
| ^
Cause: Unexpected identifier, expected the token \`{\` (1:20)"
`;
@@ -3,7 +3,8 @@
exports[`snippet: #0 format[flow] 1`] = `
"\`match\` argument must not be empty (1:7)
> 1 | match () {}
| ^^"
| ^
Cause: \`match\` argument must not be empty (1:6)"
`;
exports[`snippet: #0 format[hermes] 1`] = `
@@ -18,7 +19,8 @@ match () {}
exports[`snippet: #1 format[flow] 1`] = `
"\`match\` argument cannot contain spread elements (1:8)
> 1 | match (...b) {}
| ^^^^"
| ^
Cause: \`match\` argument cannot contain spread elements (1:7)"
`;
exports[`snippet: #1 format[hermes] 1`] = `
@@ -3,7 +3,8 @@
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected token \`{\`, expected the token \`;\` (1:24)
> 1 | const a = not_a_record {}
| ^"
| ^
Cause: Unexpected token \`{\`, expected the token \`;\` (1:23)"
`;
exports[`snippet: #0 format[hermes] 1`] = `
@@ -17,14 +17,14 @@ const run = (cmd /*: string */) /*: Promise<void> */ => {}
=====================================output=====================================
// Error
const a = (data: Object) => {};
const a = (data /*: Object */) => {};
// OK
const b = (data: Object, secondData: Object) => {};
const b = (data /*: Object */, secondData /*: Object */) => {};
const c = (data: /* this is an object */ Object) => {};
const c = (data /*: /* this is an object *-/ Object */) => {};
const run = (cmd: string): Promise<void> => {};
const run = (cmd /*: string */) /*: Promise<void> */ => {};
================================================================================
`;
@@ -44,11 +44,11 @@ parsers: ["flow"]
(a : c /* b */ );
=====================================output=====================================
a; /* b */ /*: c */
(a /* b */ : c);
(a /* b */ : c);
(a /* b */ : c);
(a /* b */ : c);
(a /* b */ : c);
a; /* b */ /* : c */
a; /* b */ /*:: : c */
a; /* b */ /* :: : c */
(a: /* b */ c);
(a: c /* b */);
@@ -69,9 +69,9 @@ class A {
=====================================output=====================================
class A {
x: string;
x; /*: string */
method(a: T, b: T): T {}
method(a /*: T */, b /*: T */) /*: T */ {}
}
================================================================================
@@ -85,7 +85,7 @@ parsers: ["flow"]
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
=====================================output=====================================
function foo<T>(bar: T[], baz: T): S {}
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
================================================================================
`;
@@ -104,10 +104,10 @@ function f2(a : /* b */ c ){}
function f2(a : c /* b */ ){}
=====================================output=====================================
function f1(a /* b */ : c) {}
function f1(a /* b */ /*: c */) {}
function f2(a /* b */ : c) {}
function f3(a /* b */ : c) {}
function f4(a /* b */ : c) {}
function f3(a /* b */ /* : c */) {}
function f4(a /* b */ /*:: : c */) {}
function f2(a: /* b */ c) {}
function f2(a: c /* b */) {}
@@ -133,17 +133,17 @@ foo/*::<bar>*/(baz);
foo/*::<bar>*/();
=====================================output=====================================
const Component = branch<Props, ExternalProps>(
({ src }) => !src,
const Component = branch(
/*:: <Props, ExternalProps> */ ({ src }) => !src,
// $FlowFixMe
renderNothing,
)(BaseComponent);
const C = b<A>(foo) + c<B>(bar);
const C = b(/*:: <A> */ foo) + c(/*:: <B> */ bar);
foo<bar>(baz);
foo(/*::<bar>*/ baz);
foo<bar>();
foo /*::<bar>*/();
================================================================================
`;
@@ -257,8 +257,8 @@ let foo /*: Groups<T> */;
let bar /*: string */ = 'a';
=====================================output=====================================
let foo: Groups<T>;
let bar: string = "a";
let foo; /*: Groups<T> */
let bar /*: string */ = "a";
================================================================================
`;
@@ -321,18 +321,18 @@ new (window.Request/*: Class<Request> */)("");
const x = (input /*: string */) /*: string */ => {};
=====================================output=====================================
new (window.Request: Class<Request>)("");
new window.Request /*: Class<Request> */("");
(this: any).foo = 5;
this /*: any */.foo = 5;
(this: any).foo = 5;
this /* : any */.foo = 5;
// This next example illustrates that Prettier will not remove a line break
// and unintentionally create a type annotation that was not there before.
this /*
: any */.foo = 5;
const x = (input: string): string => {};
const x = (input /*: string */) /*: string */ => {};
================================================================================
`;
@@ -347,7 +347,7 @@ class Foo {
bar( data: Array<string>) {}
}
=====================================output=====================================
foo<bar>(baz);
foo(/*::<bar>*/ baz);
class Foo {
bar(data: Array<string>) {}
}
@@ -371,7 +371,10 @@ type PropTypes = {|
|};
=====================================output=====================================
import type { OneType } from "./oneFile.js";
import type { HelloType } from "./otherFile.js";
/*::
import type { HelloType } from './otherFile.js'
*/
type PropTypes = {|
TestComponent: React.AbstractComponent<any>,
hello: HelloType,
@@ -43,7 +43,7 @@ type Children = Array<Child>;
class Thunk {}
class VirtualNode {
children: Child | Children;
constructor(type, children: Children) {
constructor(type, children /*:Children*/) {
this.children = children.length === 1 ? children[0] : children;
}
}
@@ -50,7 +50,7 @@ a = () /*
1 *\\/ => void
\`\`\`
*/
type A1 = hook () => /* 11 */ void;
type A1 = /* 11 */ hook () => void;
type A2 = hook () => /* 12 */ void;
type A3 = hook () => /* 13 */ void;
@@ -55,5 +55,6 @@ exports[`arrows.js format[flow] 1`] = `
| ^
7 | (a ? (b += c) : d => e); // a ? (b += c) : (d => e)
8 |
9 | (a ? (b = c) : d => e : f); // a ? ((b = c): d => e) : f"
9 | (a ? (b = c) : d => e : f); // a ? ((b = c): d => e) : f
Cause: Unexpected token \`)\`, expected the token \`:\` (6:21)"
`;
@@ -51,8 +51,8 @@ type A</* comment */T :string> = B;
type A<T: string /* comment */> = B;
type A<T: /* comment */ string> = B;
type A<T: /* comment */ string> = B;
type A<T: /* comment */ string> = B;
type A<T: /* comment */ string> = B;
type A<T /* comment */ : string> = B;
type A<T /* comment */ : string> = B;
type A</* comment */ T: string> = B;
================================================================================
@@ -53,13 +53,15 @@ exports[`snippet: #0 format[flow] 1`] = `
1 | async function foo() {
> 2 | function bar(x = await 2) {}
| ^
3 | }"
3 | }
Cause: Unexpected number, expected the token \`,\` (2:25)"
`;
exports[`snippet: #0 format[flow] 2`] = `
"\`await\` is not allowed in async function parameters. (1:12)
> 1 | async (x = await (2)) => {};
| ^^^^^"
| ^
Cause: \`await\` is not allowed in async function parameters. (1:11)"
`;
exports[`snippet: #0 format[meriyah] 1`] = `
@@ -95,7 +97,8 @@ Cause: Await expression cannot be a default value"
exports[`snippet: #1 format[flow] 1`] = `
"\`await\` is not allowed in async function parameters. (1:12)
> 1 | async (x = await 2) => {};
| ^^^^^"
| ^
Cause: \`await\` is not allowed in async function parameters. (1:11)"
`;
exports[`snippet: #1 format[meriyah] 1`] = `
@@ -129,7 +132,8 @@ Cause: Unexpected token !"
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected token \`!\`, expected the end of an expression statement (\`;\`) (1:25)
> 1 | f = async (a) => await a! ** 6;
| ^"
| ^
Cause: Unexpected token \`!\`, expected the end of an expression statement (\`;\`) (1:24)"
`;
exports[`snippet: #2 format[meriyah] 1`] = `
@@ -163,7 +167,8 @@ Cause: Unexpected token !"
exports[`snippet: #3 format[flow] 1`] = `
"Unexpected token \`!\`, expected the end of an expression statement (\`;\`) (1:14)
> 1 | f = (a) => +a! ** 6;
| ^"
| ^
Cause: Unexpected token \`!\`, expected the end of an expression statement (\`;\`) (1:13)"
`;
exports[`snippet: #3 format[meriyah] 1`] = `
@@ -197,7 +202,8 @@ Cause: Unexpected token !"
exports[`snippet: #4 format[flow] 1`] = `
"Unexpected token \`!\`, expected the token \`)\` (1:22)
> 1 | async (a) => (await a!) ** 6;
| ^"
| ^
Cause: Unexpected token \`!\`, expected the token \`)\` (1:21)"
`;
exports[`snippet: #4 format[meriyah] 1`] = `
@@ -231,7 +237,8 @@ Cause: Unexpected token **"
exports[`snippet: #5 format[flow] 1`] = `
"Invalid left-hand side in exponentiation expression (1:2)
> 1 | (-+5 ** 6);
| ^^^"
| ^
Cause: Invalid left-hand side in exponentiation expression (1:1)"
`;
exports[`snippet: #5 format[meriyah] 1`] = `
@@ -265,7 +272,8 @@ Cause: Unexpected token **"
exports[`snippet: #6 format[flow] 1`] = `
"Invalid left-hand side in exponentiation expression (1:17)
> 1 | f = async () => await 5 ** 6;
| ^^^^^^^"
| ^
Cause: Invalid left-hand side in exponentiation expression (1:16)"
`;
exports[`snippet: #6 format[meriyah] 1`] = `
@@ -299,7 +307,8 @@ Cause: Unexpected token **"
exports[`snippet: #7 format[flow] 1`] = `
"Invalid left-hand side in exponentiation expression (1:17)
> 1 | f = async () => await -5 ** 6;
| ^^^^^^^^"
| ^
Cause: Invalid left-hand side in exponentiation expression (1:16)"
`;
exports[`snippet: #7 format[meriyah] 1`] = `
@@ -333,7 +342,8 @@ Cause: Shorthand property assignments are valid only in destructuring patterns"
exports[`snippet: #8 format[flow] 1`] = `
"Unexpected token \`=\` (1:15)
> 1 | async({ foo33 = 1 });
| ^"
| ^
Cause: Unexpected token \`=\` (1:14)"
`;
exports[`snippet: #8 format[meriyah] 1`] = `
@@ -40,8 +40,9 @@ exports[`snippet: #0 format[flow] 1`] = `
"Classes may not have fields named \`constructor\`. (2:3)
1 | class Foo {
> 2 | constructor
| ^^^^^^^^^^^
3 | }"
| ^
3 | }
Cause: Classes may not have fields named \`constructor\`. (2:2)"
`;
exports[`snippet: #0 format[hermes] 1`] = `
@@ -129,8 +130,9 @@ exports[`snippet: #1 format[flow] 1`] = `
"Classes may not have fields named \`constructor\`. (2:3)
1 | class Foo {
> 2 | 'constructor'
| ^^^^^^^^^^^^^
3 | }"
| ^
3 | }
Cause: Classes may not have fields named \`constructor\`. (2:2)"
`;
exports[`snippet: #1 format[hermes] 1`] = `
@@ -218,8 +220,9 @@ exports[`snippet: #2 format[flow] 1`] = `
"Classes may not have fields named \`constructor\`. (2:3)
1 | class Foo {
> 2 | 'constructor'
| ^^^^^^^^^^^^^
3 | }"
| ^
3 | }
Cause: Classes may not have fields named \`constructor\`. (2:2)"
`;
exports[`snippet: #2 format[hermes] 1`] = `
@@ -307,8 +310,9 @@ exports[`snippet: #3 format[flow] 1`] = `
"Unexpected string, expected the token \`(\` (2:12)
1 | class Foo {
> 2 | accessor 'constructor'
| ^^^^^^^^^^^^^
3 | }"
| ^
3 | }
Cause: Unexpected string, expected the token \`(\` (2:11)"
`;
exports[`snippet: #3 format[hermes] 1`] = `
@@ -396,8 +400,9 @@ exports[`snippet: #4 format[flow] 1`] = `
"Unexpected string, expected the token \`(\` (2:12)
1 | class Foo {
> 2 | accessor 'constructor'
| ^^^^^^^^^^^^^
3 | }"
| ^
3 | }
Cause: Unexpected string, expected the token \`(\` (2:11)"
`;
exports[`snippet: #4 format[hermes] 1`] = `
@@ -485,8 +490,9 @@ exports[`snippet: #5 format[flow] 1`] = `
"Unexpected identifier, expected the token \`(\` (2:12)
1 | class Foo {
> 2 | accessor constructor
| ^^^^^^^^^^^
3 | }"
| ^
3 | }
Cause: Unexpected identifier, expected the token \`(\` (2:11)"
`;
exports[`snippet: #5 format[hermes] 1`] = `
@@ -11,8 +11,9 @@ Cause: Unexpected token, expected ")" (1:23)"
exports[`invalid-for-await-using-binding-of-of.js format[flow] 1`] = `
"Unexpected token \`await\`, expected the token \`(\` (1:5)
> 1 | for await (using of of of);
| ^^^^^
2 |"
| ^
2 |
Cause: Unexpected token \`await\`, expected the token \`(\` (1:4)"
`;
exports[`invalid-for-using-binding-in.js format[babel] 1`] = `
@@ -26,8 +27,9 @@ Cause: For-in loop may not start with 'using' declaration. (1:5)"
exports[`invalid-for-using-binding-in.js format[flow] 1`] = `
"Unexpected identifier, expected the token \`;\` (1:12)
> 1 | for (using foo in {});
| ^^^
2 |"
| ^
2 |
Cause: Unexpected identifier, expected the token \`;\` (1:11)"
`;
exports[`invalid-for-using-binding-of-in.js format[babel] 1`] = `
@@ -41,8 +43,9 @@ Cause: Unexpected token (1:14)"
exports[`invalid-for-using-binding-of-in.js format[flow] 1`] = `
"Unexpected token \`in\` (1:15)
> 1 | for (using of in []);
| ^^
2 |"
| ^
2 |
Cause: Unexpected token \`in\` (1:14)"
`;
exports[`invalid-for-using-binding-of-of.js format[babel] 1`] = `
@@ -56,8 +59,9 @@ Cause: Unexpected token, expected ")" (1:17)"
exports[`invalid-for-using-binding-of-of.js format[flow] 1`] = `
"Unexpected token \`of\`, expected the token \`)\` (1:18)
> 1 | for (using of of of);
| ^^
2 |"
| ^
2 |
Cause: Unexpected token \`of\`, expected the token \`)\` (1:17)"
`;
exports[`invalid-using-binding-let.js format[babel] 1`] = `
@@ -74,9 +78,10 @@ exports[`invalid-using-binding-let.js format[flow] 1`] = `
"Unexpected token \`let\`, expected the end of an expression statement (\`;\`) (2:9)
1 | {
> 2 | using let = h();
| ^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected token \`let\`, expected the end of an expression statement (\`;\`) (2:8)"
`;
exports[`invalid-using-binding-pattern.js format[babel] 1`] = `
@@ -98,5 +103,6 @@ exports[`invalid-using-binding-pattern.js format[flow] 1`] = `
| ^
3 | using [ bar ] = g();
4 | for (using { qux } of h());
5 | for (using [ quux ] of i());"
5 | for (using [ quux ] of i());
Cause: Unexpected token \`{\`, expected the end of an expression statement (\`;\`) (2:8)"
`;
@@ -52,7 +52,8 @@ Cause: An export name cannot include a lone surrogate."
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected string, expected an identifier (1:10)
> 1 | import { "\\uD83C" as b } from "./foo";
| ^^^^^^^^"
| ^
Cause: Unexpected string, expected an identifier (1:9)"
`;
exports[`snippet: #0 format[hermes] 1`] = `
@@ -135,7 +136,8 @@ Cause: An export name cannot include a lone surrogate."
exports[`snippet: #1 format[flow] 1`] = `
"Unexpected string, expected an identifier (1:10)
> 1 | export { "\\uD83C" } from "./foo";
| ^^^^^^^^"
| ^
Cause: Unexpected string, expected an identifier (1:9)"
`;
exports[`snippet: #1 format[hermes] 1`] = `
@@ -218,7 +220,8 @@ Cause: An export name cannot include a lone surrogate."
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected string, expected an identifier (1:10)
> 1 | export { "\\uD83C" as b } from "./foo";
| ^^^^^^^^"
| ^
Cause: Unexpected string, expected an identifier (1:9)"
`;
exports[`snippet: #2 format[hermes] 1`] = `
@@ -301,7 +304,8 @@ Cause: An export name cannot include a lone surrogate."
exports[`snippet: #3 format[flow] 1`] = `
"Unexpected string, expected an identifier (1:15)
> 1 | export { b as "\\uD83C" } from "./foo";
| ^^^^^^^^"
| ^
Cause: Unexpected string, expected an identifier (1:14)"
`;
exports[`snippet: #3 format[hermes] 1`] = `
@@ -66,13 +66,15 @@ Cause: Unexpected token ["
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected token \`.\`, expected an identifier (1:9)
> 1 | for (let.foo of []);
| ^"
| ^
Cause: Unexpected token \`.\`, expected an identifier (1:8)"
`;
exports[`snippet: #0 format[flow] 2`] = `
"Invalid left-hand side in for-of (1:6)
> 1 | for (async of []);
| ^^^^^"
| ^
Cause: Invalid left-hand side in for-of (1:5)"
`;
exports[`snippet: #0 format[meriyah] 1`] = `
@@ -120,7 +122,8 @@ Cause: The keyword 'let' is reserved"
exports[`snippet: #1 format[flow] 1`] = `
"Unexpected token \`(\`, expected an identifier (1:9)
> 1 | for (let().bar of []);
| ^"
| ^
Cause: Unexpected token \`(\`, expected an identifier (1:8)"
`;
exports[`snippet: #1 format[meriyah] 1`] = `
@@ -168,7 +171,8 @@ Cause: The keyword 'let' is reserved"
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected template literal part, expected an identifier (1:9)
> 1 | for (let\`\`.bar of []);
| ^^"
| ^
Cause: Unexpected template literal part, expected an identifier (1:8)"
`;
exports[`snippet: #2 format[meriyah] 1`] = `
@@ -24,7 +24,8 @@ Cause: \`import()\` requires exactly one or two arguments. (1:0)"
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected token \`)\` (1:8)
> 1 | import();
| ^"
| ^
Cause: Unexpected token \`)\` (1:7)"
`;
exports[`snippet: #0 format[meriyah] 1`] = `
@@ -65,7 +66,8 @@ Cause: \`import()\` requires exactly one or two arguments. (1:0)"
exports[`snippet: #1 format[flow] 1`] = `
"Unexpected token \`)\` (1:21)
> 1 | import(/* comment */);
| ^"
| ^
Cause: Unexpected token \`)\` (1:20)"
`;
exports[`snippet: #1 format[meriyah] 1`] = `
@@ -106,7 +108,8 @@ Cause: Cannot use new with import(). (1:4)"
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected token \`import\` (1:5)
> 1 | new import('./a.mjs');
| ^^^^^^"
| ^
Cause: Unexpected token \`import\` (1:4)"
`;
exports[`snippet: #2 format[meriyah] 1`] = `
@@ -147,7 +150,8 @@ Cause: \`import()\` requires exactly one or two arguments. (1:4)"
exports[`snippet: #3 format[flow] 1`] = `
"Unexpected token \`import\` (1:5)
> 1 | new import();
| ^^^^^^"
| ^
Cause: Unexpected token \`import\` (1:4)"
`;
exports[`snippet: #3 format[meriyah] 1`] = `
@@ -59,13 +59,15 @@ Cause: Unexpected token each"
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected identifier, expected the token \`(\` (1:5)
> 1 | for each (a in b) {}
| ^^^^"
| ^
Cause: Unexpected identifier, expected the token \`(\` (1:4)"
`;
exports[`snippet: #0 format[flow] 2`] = `
"Invalid left-hand side in assignment (1:2)
> 1 | (a = b) = 1
| ^^^^^"
| ^
Cause: Invalid left-hand side in assignment (1:1)"
`;
exports[`snippet: #0 format[meriyah] 1`] = `
@@ -148,13 +150,15 @@ Cause: Unexpected token switch"
exports[`snippet: #1 format[flow] 1`] = `
"Unexpected token \`switch\`, expected an identifier (1:7)
> 1 | class switch() {}
| ^^^^^^"
| ^
Cause: Unexpected token \`switch\`, expected an identifier (1:6)"
`;
exports[`snippet: #1 format[flow] 2`] = `
"Invalid left-hand side in assignment (1:5)
> 1 | a = 1 = 2
| ^"
| ^
Cause: Invalid left-hand side in assignment (1:4)"
`;
exports[`snippet: #1 format[meriyah] 1`] = `
@@ -237,13 +241,15 @@ Cause: Unexpected token }"
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected token \`}\`, expected the token \`{\` (1:13)
> 1 | ({ method() })
| ^"
| ^
Cause: Unexpected token \`}\`, expected the token \`{\` (1:12)"
`;
exports[`snippet: #2 format[flow] 2`] = `
"Invalid left-hand side in assignment (1:2)
> 1 | (a = 1) = 2
| ^^^^^"
| ^
Cause: Invalid left-hand side in assignment (1:1)"
`;
exports[`snippet: #2 format[meriyah] 1`] = `
@@ -326,13 +332,15 @@ Cause: Unexpected token }"
exports[`snippet: #3 format[flow] 1`] = `
"Unexpected token \`}\`, expected the token \`{\` (1:15)
> 1 | ({ method({}) })
| ^"
| ^
Cause: Unexpected token \`}\`, expected the token \`{\` (1:14)"
`;
exports[`snippet: #3 format[flow] 2`] = `
"Invalid left-hand side in assignment (1:2)
> 1 | (a += b) = 1
| ^^^^^^"
| ^
Cause: Invalid left-hand side in assignment (1:1)"
`;
exports[`snippet: #3 format[meriyah] 1`] = `
@@ -415,13 +423,15 @@ Cause: Unexpected token }"
exports[`snippet: #4 format[flow] 1`] = `
"Unexpected token \`}\`, expected the token \`{\` (1:23)
> 1 | ({ method(parameter,) })
| ^"
| ^
Cause: Unexpected token \`}\`, expected the token \`{\` (1:22)"
`;
exports[`snippet: #4 format[flow] 2`] = `
"Invalid left-hand side in assignment (1:2)
> 1 | (a = b) += 1
| ^^^^^"
| ^
Cause: Invalid left-hand side in assignment (1:1)"
`;
exports[`snippet: #4 format[meriyah] 1`] = `
@@ -49,8 +49,9 @@ exports[`newline-before-arrow.js format[flow] 1`] = `
"Illegal newline before arrow (2:1)
1 | async x
> 2 | => x
| ^^
3 |"
| ^
3 |
Cause: Illegal newline before arrow (2:0)"
`;
exports[`newline-before-arrow.js format[meriyah] 1`] = `
@@ -31,13 +31,15 @@ Cause: Unexpected token asyn\\u{63}"
exports[`snippet: #0 format[flow] 1`] = `
"Use of reserved word in strict mode (1:7)
> 1 | class interface {}
| ^^^^^^^^^"
| ^
Cause: Use of reserved word in strict mode (1:6)"
`;
exports[`snippet: #0 format[flow] 2`] = `
"Unexpected identifier, expected a declaration, statement or export specifiers (1:8)
> 1 | export asyn\\u{63} from "async";
| ^^^^^^^^^^"
| ^
Cause: Unexpected identifier, expected a declaration, statement or export specifiers (1:7)"
`;
exports[`snippet: #0 format[hermes] 1`] = `
@@ -99,7 +101,8 @@ Cause: The keyword 'interface' is reserved"
exports[`snippet: #1 format[flow] 1`] = `
"Use of reserved word in strict mode (1:8)
> 1 | import interface from "foo";
| ^^^^^^^^^"
| ^
Cause: Use of reserved word in strict mode (1:7)"
`;
exports[`snippet: #1 format[meriyah] 1`] = `
@@ -48,7 +48,8 @@ exports[`comment.js format[flow] 1`] = `
> 1 | <!--
| ^
2 | alert(1)
3 | -->"
3 | -->
Cause: Unexpected token \`!\`, expected the token \`>\` (1:1)"
`;
exports[`comment.js format[hermes] 1`] = `
@@ -74,7 +74,8 @@ exports[`classes.js format[flow] 1`] = `
| ^
8 | //
9 | };
10 |"
10 |
Cause: Unexpected token \`@\` (7:12)"
`;
exports[`classes.js format[hermes] 1`] = `
@@ -45,7 +45,8 @@ exports[`arguments.js - {"semi":false} format[flow] 1`] = `
> 1 | console.log(@deco class Foo {})
| ^
2 | console.log(@deco class {})
3 |"
3 |
Cause: Unexpected token \`@\` (1:12)"
`;
exports[`arguments.js format 1`] = `
@@ -92,7 +93,8 @@ exports[`arguments.js format[flow] 1`] = `
> 1 | console.log(@deco class Foo {})
| ^
2 | console.log(@deco class {})
3 |"
3 |
Cause: Unexpected token \`@\` (1:12)"
`;
exports[`class-expression.js - {"semi":false} format 1`] = `
@@ -178,7 +180,8 @@ exports[`class-expression.js - {"semi":false} format[flow] 1`] = `
| ^
2 | const a2 = (@deco class {});
3 |
4 | (@deco class Foo {});"
4 | (@deco class Foo {});
Cause: Unexpected token \`@\` (1:12)"
`;
exports[`class-expression.js format 1`] = `
@@ -263,7 +266,8 @@ exports[`class-expression.js format[flow] 1`] = `
| ^
2 | const a2 = (@deco class {});
3 |
4 | (@deco class Foo {});"
4 | (@deco class Foo {});
Cause: Unexpected token \`@\` (1:12)"
`;
exports[`member-expression.js - {"semi":false} format 1`] = `
@@ -311,7 +315,8 @@ exports[`member-expression.js - {"semi":false} format[flow] 1`] = `
> 1 | (@deco class Foo {}).name;
| ^
2 | (@deco class {}).name;
3 |"
3 |
Cause: Unexpected token \`@\` (1:1)"
`;
exports[`member-expression.js format 1`] = `
@@ -358,7 +363,8 @@ exports[`member-expression.js format[flow] 1`] = `
> 1 | (@deco class Foo {}).name;
| ^
2 | (@deco class {}).name;
3 |"
3 |
Cause: Unexpected token \`@\` (1:1)"
`;
exports[`super-class.js - {"semi":false} format 1`] = `
@@ -411,7 +417,8 @@ exports[`super-class.js - {"semi":false} format[flow] 1`] = `
| ^
2 |
3 | class Fo2 extends (@deco class {}){}
4 |"
4 |
Cause: Unexpected token \`@\` (1:19)"
`;
exports[`super-class.js format 1`] = `
@@ -463,5 +470,6 @@ exports[`super-class.js format[flow] 1`] = `
| ^
2 |
3 | class Fo2 extends (@deco class {}){}
4 |"
4 |
Cause: Unexpected token \`@\` (1:19)"
`;
@@ -113,10 +113,11 @@ exports[`array-pattern.js format[flow] 1`] = `
1 | {
2 | // destructuring binding
> 3 | const [, void, ] = value;
| ^^^^
| ^
4 | }
5 | {
6 | // for-of destructuring binding"
6 | // for-of destructuring binding
Cause: Unexpected reserved word (3:11)"
`;
exports[`array-pattern.js format[hermes] 1`] = `
@@ -227,10 +228,11 @@ Cause: Unexpected keyword 'void'"
exports[`basic.js format[flow] 1`] = `
"Unexpected reserved word (1:8)
> 1 | const [void] = [,void] = [void,] = [];
| ^^^^
| ^
2 |
3 | function f(void, { p: void }, [ void ]) {}
4 |"
4 |
Cause: Unexpected reserved word (1:7)"
`;
exports[`basic.js format[hermes] 1`] = `
@@ -316,7 +318,8 @@ exports[`discard-binding-arrow-params.js format[flow] 1`] = `
"Unexpected token \`)\` (1:6)
> 1 | (void) => {}
| ^
2 |"
2 |
Cause: Unexpected token \`)\` (1:5)"
`;
exports[`discard-binding-arrow-params.js format[hermes] 1`] = `
@@ -392,7 +395,8 @@ exports[`discard-binding-assignment.js format[flow] 1`] = `
"Unexpected token \`]\` (1:7)
> 1 | ([void] = []);
| ^
2 |"
2 |
Cause: Unexpected token \`]\` (1:6)"
`;
exports[`discard-binding-assignment.js format[hermes] 1`] = `
@@ -468,7 +472,8 @@ exports[`discard-binding-async-arrow-params.js format[flow] 1`] = `
"Unexpected token \`)\` (1:12)
> 1 | async (void) => {}
| ^
2 |"
2 |
Cause: Unexpected token \`)\` (1:11)"
`;
exports[`discard-binding-async-arrow-params.js format[hermes] 1`] = `
@@ -543,8 +548,9 @@ Cause: Unexpected keyword 'void'"
exports[`discard-binding-bindings.js format[flow] 1`] = `
"Unexpected reserved word (1:12)
> 1 | const { p: void } = {};
| ^^^^
2 |"
| ^
2 |
Cause: Unexpected reserved word (1:11)"
`;
exports[`discard-binding-bindings.js format[hermes] 1`] = `
@@ -628,9 +634,10 @@ exports[`discard-binding-for-await-using-binding.js format[flow] 1`] = `
"Unexpected token \`void\`, expected the token \`;\` (2:19)
1 | async () => {
> 2 | for(await using void of []);
| ^^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected token \`void\`, expected the token \`;\` (2:18)"
`;
exports[`discard-binding-for-await-using-binding.js format[hermes] 1`] = `
@@ -715,8 +722,9 @@ Cause: Unexpected keyword 'void'"
exports[`discard-binding-for-bindings.js format[flow] 1`] = `
"Unexpected reserved word (1:16)
> 1 | for(const { p: void } of []);
| ^^^^
2 |"
| ^
2 |
Cause: Unexpected reserved word (1:15)"
`;
exports[`discard-binding-for-bindings.js format[hermes] 1`] = `
@@ -792,7 +800,8 @@ exports[`discard-binding-for-lhs.js format[flow] 1`] = `
"Unexpected token \`}\` (1:15)
> 1 | for({ p: void } of []);
| ^
2 |"
2 |
Cause: Unexpected token \`}\` (1:14)"
`;
exports[`discard-binding-for-lhs.js format[hermes] 1`] = `
@@ -876,9 +885,10 @@ exports[`discard-binding-for-using-binding.js format[flow] 1`] = `
"Unexpected token \`void\`, expected the token \`;\` (2:13)
1 | {
> 2 | for(using void of []);
| ^^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected token \`void\`, expected the token \`;\` (2:12)"
`;
exports[`discard-binding-for-using-binding.js format[hermes] 1`] = `
@@ -1009,10 +1019,11 @@ exports[`function-parameter.js format[flow] 1`] = `
1 | {
2 | // function parameter
> 3 | function f(void) {}
| ^^^^
| ^
4 | }
5 | {
6 | // arrow function parameter"
6 | // arrow function parameter
Cause: Unexpected reserved word (3:13)"
`;
exports[`function-parameter.js format[hermes] 1`] = `
@@ -1206,10 +1217,11 @@ exports[`object-pattern.js format[flow] 1`] = `
1 | {
2 | // destructuring binding
> 3 | const { void: void } = value;
| ^^^^
| ^
4 | }
5 | {
6 | // for-of destructuring binding"
6 | // for-of destructuring binding
Cause: Unexpected reserved word (3:16)"
`;
exports[`object-pattern.js format[hermes] 1`] = `
@@ -1349,7 +1361,8 @@ exports[`unary-expression-void.js format[flow] 1`] = `
| ^
5 | // expr
6 | [ void [] ]:
7 | // pattern"
7 | // pattern
Cause: Unexpected token \`]\` (4:9)"
`;
exports[`unary-expression-void.js format[hermes] 1`] = `
@@ -1461,10 +1474,11 @@ exports[`using.js format[flow] 1`] = `
"Unexpected token \`void\`, expected the end of an expression statement (\`;\`) (2:9)
1 | {
> 2 | using void = f();
| ^^^^
| ^
3 | }
4 | async (void) => {
5 | await using void = f();"
5 | await using void = f();
Cause: Unexpected token \`void\`, expected the end of an expression statement (\`;\`) (2:8)"
`;
exports[`using.js format[hermes] 1`] = `
@@ -1634,10 +1648,11 @@ exports[`using-variable-declarator.js format[flow] 1`] = `
1 | {
2 | // using 1 declarator
> 3 | using void = f();
| ^^^^
| ^
4 | }
5 | {
6 | // using 2 declarators"
6 | // using 2 declarators
Cause: Unexpected token \`void\`, expected the end of an expression statement (\`;\`) (3:8)"
`;
exports[`using-variable-declarator.js format[hermes] 1`] = `
@@ -61,10 +61,11 @@ Cause: The only valid meta property for import is 'import.meta'"
exports[`import-phase.js format[flow] 1`] = `
"Unexpected identifier, expected the identifier \`meta\` (1:8)
> 1 | import.source(\`data:text/javascript,
| ^^^^^^
| ^
2 | console.log("RUN");
3 | \`)
4 |"
4 |
Cause: Unexpected identifier, expected the identifier \`meta\` (1:7)"
`;
exports[`import-phase.js format[hermes] 1`] = `
@@ -120,10 +121,11 @@ module = await import(String.raw\`data:text/javascript,
exports[`template-literal.js format[flow] 1`] = `
"Unexpected token \`import\`, expected the end of an expression statement (\`;\`) (1:20)
> 1 | module = await import(\`data:text/javascript,
| ^^^^^^
| ^
2 | console.log("RUN");
3 | \`);
4 |"
4 |
Cause: Unexpected token \`import\`, expected the end of an expression statement (\`;\`) (1:19)"
`;
exports[`template-literal.js format[hermes] 1`] = `
@@ -16,8 +16,9 @@ parsers: ["babel", "flow", "typescript"]
exports[`for-await-using-of-comments.js format[flow] 1`] = `
"Unexpected token \`await\`, expected the token \`(\` (1:19)
> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
| ^^^^^
2 |"
| ^
2 |
Cause: Unexpected token \`await\`, expected the token \`(\` (1:18)"
`;
exports[`for-await-using-of-comments.js format[hermes] 1`] = `
@@ -93,7 +94,8 @@ exports[`invalid-duplicate-using-bindings.js format[flow] 1`] = `
| ^
3 | }
4 | {
5 | using g = foo();"
5 | using g = foo();
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:8)"
`;
exports[`invalid-duplicate-using-bindings.js format[hermes] 1`] = `
@@ -140,7 +142,8 @@ exports[`invalid-script-top-level-using-binding.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (1:7)
> 1 | using x = bar();
| ^
2 |"
2 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (1:6)"
`;
exports[`invalid-script-top-level-using-binding.js format[meriyah] 1`] = `
@@ -184,7 +187,8 @@ exports[`using-declarations.js format[flow] 1`] = `
| ^
3 | }
4 |
5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);"
5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:16)"
`;
exports[`using-declarations.js format[hermes] 1`] = `
@@ -329,9 +333,10 @@ exports[`valid-await-using-binding-basic.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (2:15)
1 | async function f() {
> 2 | await using basic = getReader();
| ^^^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)"
`;
exports[`valid-await-using-binding-basic.js format[meriyah] 1`] = `
@@ -365,9 +370,10 @@ exports[`valid-await-using-binding-escaped.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (2:15)
1 | async function f() {
> 2 | await using \\u0061b = c;
| ^^^^^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)"
`;
exports[`valid-await-using-binding-escaped.js format[meriyah] 1`] = `
@@ -403,7 +409,8 @@ exports[`valid-await-using-binding-non-bmp.js format[flow] 1`] = `
> 2 | await using 𠮷 = foo();
| ^
3 | }
4 |"
4 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)"
`;
exports[`valid-await-using-binding-non-bmp.js format[meriyah] 1`] = `
@@ -439,10 +446,11 @@ exports[`valid-await-using-binding-using.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (2:15)
1 | async function f() {
> 2 | await using using = of;
| ^^^^^
| ^
3 | for (await using using of of);
4 | }
5 |"
5 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)"
`;
exports[`valid-await-using-binding-using.js format[meriyah] 1`] = `
@@ -506,7 +514,8 @@ exports[`valid-await-using-comments.js format[flow] 1`] = `
| ^
4 | }
5 | {
6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/;"
6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/;
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (3:27)"
`;
exports[`valid-await-using-comments.js format[hermes] 1`] = `
@@ -588,10 +597,11 @@ exports[`valid-for-using-binding-of-of.js format[flow] 1`] = `
"Invalid left-hand side in for-of (2:8)
1 | async function f() {
> 2 | for (await using of of of);
| ^^^^^^^^^^^
| ^
3 | for await (await using of of of);
4 | }
5 |"
5 |
Cause: Invalid left-hand side in for-of (2:7)"
`;
exports[`valid-for-using-binding-of-of.js format[meriyah] 1`] = `
@@ -626,9 +636,10 @@ exports[`valid-for-using-declaration.js format[flow] 1`] = `
"Unexpected identifier, expected the token \`;\` (2:20)
1 | async function f() {
> 2 | for (await using basic = reader();;);
| ^^^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected identifier, expected the token \`;\` (2:19)"
`;
exports[`valid-for-using-declaration.js format[hermes] 1`] = `
@@ -696,7 +707,8 @@ exports[`valid-module-block-top-level-await-using-binding.js format[flow] 1`] =
| ^
2 | await using foo = bar();
3 | }
4 |"
4 |
Cause: Unexpected token \`{\`, expected the token \`;\` (1:17)"
`;
exports[`valid-module-block-top-level-await-using-binding.js format[hermes] 1`] = `
@@ -792,7 +804,8 @@ exports[`valid-module-block-top-level-using-binding.js format[flow] 1`] = `
| ^
2 | using foo = bar();
3 | }
4 |"
4 |
Cause: Unexpected token \`{\`, expected the end of an expression statement (\`;\`) (1:7)"
`;
exports[`valid-module-block-top-level-using-binding.js format[hermes] 1`] = `
@@ -891,8 +904,9 @@ for await (using of of);
exports[`valid-using-as-identifier-for-await-of.js format[flow] 1`] = `
"Unexpected token \`await\`, expected the token \`(\` (1:5)
> 1 | for await (using of of);
| ^^^^^
2 |"
| ^
2 |
Cause: Unexpected token \`await\`, expected the token \`(\` (1:4)"
`;
exports[`valid-using-as-identifier-for-await-of.js format[hermes] 1`] = `
@@ -1010,9 +1024,10 @@ exports[`valid-using-binding-basic.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (2:9)
1 | {
> 2 | using basic = getReader();
| ^^^^^
| ^
3 | }
4 |"
4 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:8)"
`;
exports[`valid-using-binding-basic.js format[meriyah] 1`] = `
@@ -1043,8 +1058,9 @@ parsers: ["babel", "flow", "typescript"]
exports[`valid-using-binding-escaped.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (1:9)
> 1 | { using \\u0061b = c; }
| ^^^^^^^
2 |"
| ^
2 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (1:8)"
`;
exports[`valid-using-binding-escaped.js format[meriyah] 1`] = `
@@ -1074,7 +1090,8 @@ exports[`valid-using-binding-non-bmp.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (1:9)
> 1 | { using 𠮷 = foo(); }
| ^
2 |"
2 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (1:8)"
`;
exports[`valid-using-binding-non-bmp.js format[meriyah] 1`] = `
@@ -1108,10 +1125,11 @@ exports[`valid-using-binding-using.js format[flow] 1`] = `
"Unexpected identifier, expected the end of an expression statement (\`;\`) (2:9)
1 | {
> 2 | using using = of;
| ^^^^^
| ^
3 | for (using using of of);
4 | }
5 |"
5 |
Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:8)"
`;
exports[`valid-using-binding-using.js format[meriyah] 1`] = `
@@ -34,7 +34,8 @@ exports[`default-escaped.js format[flow] 1`] = `
"Unexpected identifier, expected a declaration, statement or export specifiers (2:8)
1 | // export asyn\\u{63} from "async";
> 2 | export n\\u{63} from "async";
| ^^^^^^^"
| ^
Cause: Unexpected identifier, expected a declaration, statement or export specifiers (2:7)"
`;
exports[`default-escaped.js format[hermes] 1`] = `
@@ -76,8 +76,9 @@ export * as "foo" from "foo";
exports[`export-star-as-string.js format[flow] 1`] = `
"Unexpected string, expected an identifier (1:13)
> 1 | export * as 'foo' from 'foo'
| ^^^^^
2 |"
| ^
2 |
Cause: Unexpected string, expected an identifier (1:12)"
`;
exports[`export-star-as-string.js format[hermes] 1`] = `
@@ -106,8 +107,9 @@ export * as "foo" from "foo";
exports[`export-star-as-string2.js format[flow] 1`] = `
"Unexpected string, expected an identifier (1:13)
> 1 | export * as "foo" from 'foo'
| ^^^^^
2 |"
| ^
2 |
Cause: Unexpected string, expected an identifier (1:12)"
`;
exports[`export-star-as-string2.js format[hermes] 1`] = `
@@ -898,10 +898,11 @@ exports[`for-in-with-initializer.js format[flow] 1`] = `
1 | // https://github.com/babel/babel/blob/HEAD/packages/babel-generator/test/fixtures/parentheses/in-inside-for/input.js
2 |
> 3 | for (var a = (b in c) in {});
| ^^^^^^^^^^^^^^^^
| ^
4 | for (var a = 1 || (b in c) in {});
5 | for (var a = 1 + (2 || (b in c)) in {});
6 | for (var a = (() => b in c) in {});"
6 | for (var a = (() => b in c) in {});
Cause: Invalid left-hand side in for-in (3:5)"
`;
exports[`for-in-with-initializer.js format[typescript] 1`] = `
@@ -1069,10 +1070,11 @@ exports[`parentheses.js format[flow] 1`] = `
9 | for (var a = [b in c];;);
10 | for (var a = {b: b in c};;);
> 11 | for (var a = (x = b in c) => {};;);
| ^^
| ^
12 | for (var a = class extends (b in c) {};;);
13 | for (var a = function (x = b in c) {};;);
14 |"
14 |
Cause: Unexpected token \`=>\`, expected the token \`;\` (11:26)"
`;
exports[`parentheses.js format[typescript] 1`] = `
@@ -89,7 +89,8 @@ exports[`class-expression-decorator.js - {"semi":false} format[flow] 1`] = `
| ^
4 | class {}
5 | );
6 |"
6 |
Cause: Unexpected token \`@\` (3:2)"
`;
exports[`class-expression-decorator.js format 1`] = `
@@ -145,7 +146,8 @@ exports[`class-expression-decorator.js format[flow] 1`] = `
| ^
4 | class {}
5 | );
6 |"
6 |
Cause: Unexpected token \`@\` (3:2)"
`;
exports[`directive.js - {"semi":false} format 1`] = `
@@ -44,10 +44,11 @@ Cause: The only valid meta property for import is 'import.meta'"
exports[`import-defer.js format[flow] 1`] = `
"Unexpected identifier, expected the identifier \`meta\` (1:8)
> 1 | import.defer("./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module");
| ^^^^^
| ^
2 | import.defer(
3 | // Comment
4 | "./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module""
4 | "./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module"
Cause: Unexpected identifier, expected the identifier \`meta\` (1:7)"
`;
exports[`import-defer.js format[hermes] 1`] = `
@@ -143,10 +144,11 @@ Cause: The only valid meta property for import is 'import.meta'"
exports[`import-source.js format[flow] 1`] = `
"Unexpected identifier, expected the identifier \`meta\` (1:8)
> 1 | import.source("./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module");
| ^^^^^^
| ^
2 | import.source(
3 | // Comment
4 | "./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module""
4 | "./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module"
Cause: Unexpected identifier, expected the identifier \`meta\` (1:7)"
`;
exports[`import-source.js format[hermes] 1`] = `
@@ -103,7 +103,8 @@ exports[`text.js format[flow] 1`] = `
| ^
2 | foo = html\`\\u{prettier}\\u{0065}\`;
3 | foo = graphql\`\\u{prettier}\\u{0065}\`;
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;"
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;
Cause: Unexpected token ILLEGAL (1:11)"
`;
exports[`text.js format[hermes] 1`] = `
@@ -17,7 +17,8 @@ exports[`outside-functions.js format[flow] 1`] = `
"Unexpected token \`.\` (1:14)
> 1 | const x = new.target;
| ^
2 |"
2 |
Cause: Unexpected token \`.\` (1:13)"
`;
exports[`outside-functions.js format[hermes] 1`] = `
@@ -60,7 +61,8 @@ exports[`range.js format[flow] 1`] = `
"Unexpected token \`.\` (2:4)
1 | const x =
> 2 | new.target;
| ^"
| ^
Cause: Unexpected token \`.\` (2:3)"
`;
exports[`range.js format[hermes] 1`] = `
@@ -159,7 +159,8 @@ exports[`expression.js format[flow] 1`] = `
| ^
6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0);
7 | ({}(), 0);
8 | ({} = 0);"
8 | ({} = 0);
Cause: Unexpected token \`:\`, expected a type (5:4)"
`;
exports[`expression.js format[hermes] 1`] = `
@@ -114,8 +114,9 @@ Cause: Unexpected token function"
exports[`function-declaration-in-while.js format[flow] 1`] = `
"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement. (1:15)
> 1 | while (false) function foo(){}
| ^^^^^^^^^^^^^^^^
2 |"
| ^
2 |
Cause: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement. (1:14)"
`;
exports[`function-declaration-in-while.js format[hermes] 1`] = `
@@ -31,7 +31,8 @@ Cause: Unexpected token \`}\`. Did you mean \`&rbrace;\` or \`{"}"}\`?"
exports[`snippet: #0 format[flow] 1`] = `
"Unexpected token \`}\`. Did you mean \`{'}'}\`? (1:15)
> 1 | let x1 = <div>}</div>;
| ^"
| ^
Cause: Unexpected token \`}\`. Did you mean \`{'}'}\`? (1:14)"
`;
exports[`snippet: #0 format[oxc] 1`] = `
@@ -84,7 +85,8 @@ Cause: Unexpected token \`>\`. Did you mean \`&gt;\` or \`{">"}\`?"
exports[`snippet: #1 format[flow] 1`] = `
"Unexpected token \`>\`. Did you mean \`{'>'}\`? (1:15)
> 1 | let x2 = <div>></div>;
| ^"
| ^
Cause: Unexpected token \`>\`. Did you mean \`{'>'}\`? (1:14)"
`;
exports[`snippet: #1 format[oxc] 1`] = `
@@ -137,7 +139,8 @@ Cause: Unexpected token <"
exports[`snippet: #2 format[flow] 1`] = `
"Unexpected token \`<\`, expected the token \`>\` (1:16)
> 1 | let x2 = <div><</div>;
| ^"
| ^
Cause: Unexpected token \`<\`, expected the token \`>\` (1:15)"
`;
exports[`snippet: #2 format[oxc] 1`] = `
@@ -190,7 +193,8 @@ Cause: Unexpected token \`}\`. Did you mean \`&rbrace;\` or \`{"}"}\`?"
exports[`snippet: #3 format[flow] 1`] = `
"Unexpected token \`}\`. Did you mean \`{'}'}\`? (1:22)
> 1 | let x3 = <div>{"foo"}}</div>;
| ^"
| ^
Cause: Unexpected token \`}\`. Did you mean \`{'}'}\`? (1:21)"
`;
exports[`snippet: #3 format[oxc] 1`] = `
@@ -243,7 +247,8 @@ Cause: Unexpected token \`>\`. Did you mean \`&gt;\` or \`{">"}\`?"
exports[`snippet: #4 format[flow] 1`] = `
"Unexpected token \`>\`. Did you mean \`{'>'}\`? (1:22)
> 1 | let x4 = <div>{"foo"}></div>;
| ^"
| ^
Cause: Unexpected token \`>\`. Did you mean \`{'>'}\`? (1:21)"
`;
exports[`snippet: #4 format[oxc] 1`] = `
@@ -296,7 +301,8 @@ Cause: Unexpected token <"
exports[`snippet: #5 format[flow] 1`] = `
"Unexpected token \`<\`, expected the token \`>\` (1:23)
> 1 | let x4 = <div>{"foo"}<</div>;
| ^"
| ^
Cause: Unexpected token \`<\`, expected the token \`>\` (1:22)"
`;
exports[`snippet: #5 format[oxc] 1`] = `
@@ -349,7 +355,8 @@ Cause: Unexpected token \`}\`. Did you mean \`&rbrace;\` or \`{"}"}\`?"
exports[`snippet: #6 format[flow] 1`] = `
"Unexpected token \`}\`. Did you mean \`{'}'}\`? (1:15)
> 1 | let x5 = <div>}{"foo"}</div>;
| ^"
| ^
Cause: Unexpected token \`}\`. Did you mean \`{'}'}\`? (1:14)"
`;
exports[`snippet: #6 format[oxc] 1`] = `
@@ -402,7 +409,8 @@ Cause: Unexpected token \`>\`. Did you mean \`&gt;\` or \`{">"}\`?"
exports[`snippet: #7 format[flow] 1`] = `
"Unexpected token \`>\`. Did you mean \`{'>'}\`? (1:15)
> 1 | let x6 = <div>>{"foo"}</div>;
| ^"
| ^
Cause: Unexpected token \`>\`. Did you mean \`{'>'}\`? (1:14)"
`;
exports[`snippet: #7 format[oxc] 1`] = `
@@ -455,7 +463,8 @@ Cause: Unexpected token {"
exports[`snippet: #8 format[flow] 1`] = `
"Unexpected token \`{\`, expected the token \`>\` (1:16)
> 1 | let x6 = <div><{"foo"}</div>;
| ^"
| ^
Cause: Unexpected token \`{\`, expected the token \`>\` (1:15)"
`;
exports[`snippet: #8 format[oxc] 1`] = `
@@ -170,9 +170,9 @@ exports[`snippet: Should not support front matter format[flow] 1`] = `
"Invalid left-hand side in assignment (1:3)
> 1 | ---
| ^
> 2 | Front Matter content
| ^^^^^
3 | ---"
2 | Front Matter content
3 | ---
Cause: Invalid left-hand side in assignment (1:2)"
`;
exports[`snippet: Should not support front matter format[graphql] 1`] = `