+Cause: Unexpected token (3:10)"
`;
exports[`embedded.js format 1`] = `
diff --git a/tests/format/flow/as-satisfies-expression/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/as-satisfies-expression/__snapshots__/jsfmt.spec.js.snap
index f8301732e..2fec649bb 100644
--- a/tests/format/flow/as-satisfies-expression/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/as-satisfies-expression/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`as.js [babel-flow] format 1`] = `
| ^
4 | this.isTabActionBar((e.target || e.srcElement) as HTMLElement);
5 | (originalError ? wrappedError(errMsg, originalError) : Error(errMsg)) as InjectionError;
- 6 | 'current' in (props.pagination as {...});"
+ 6 | 'current' in (props.pagination as {...});
+Cause: Unexpected token, expected "," (3:26)"
`;
exports[`as.js format 1`] = `
@@ -138,7 +139,8 @@ exports[`as-const.js [babel-flow] format 1`] = `
| ^
13 |
14 | (type) as const;
- 15 |"
+ 15 |
+Cause: Unexpected token (12:10)"
`;
exports[`as-const.js format 1`] = `
@@ -189,7 +191,8 @@ exports[`assignment.js [babel-flow] format 1`] = `
| ^
18 |
19 | this.intervalID = (setInterval(() => {
- 20 | self.step();"
+ 20 | self.step();
+Cause: Unexpected token, expected "," (17:22)"
`;
exports[`assignment.js format 1`] = `
@@ -252,7 +255,8 @@ exports[`export_default_as.js [babel-flow] format 1`] = `
2 |
> 3 | export default (function log() {} as typeof console.log)
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token, expected "," (3:34)"
`;
exports[`export_default_as.js format 1`] = `
@@ -281,7 +285,8 @@ exports[`long-identifiers.js [babel-flow] format 1`] = `
| ^
12 | };
13 |
- 14 | averredBathersBoxroomBuggyNurl("
+ 14 | averredBathersBoxroomBuggyNurl(
+Cause: Unexpected token, expected "," (11:36)"
`;
exports[`long-identifiers.js format 1`] = `
@@ -337,7 +342,8 @@ exports[`nested-await-and-as.js [babel-flow] format 1`] = `
| ^
8 | ).getChildren()
9 | ).length
- 10 |"
+ 10 |
+Cause: Unexpected token, expected "," (7:32)"
`;
exports[`nested-await-and-as.js format 1`] = `
@@ -378,7 +384,8 @@ exports[`return.js [babel-flow] format 1`] = `
> 7 | } as Foo;
| ^
8 | }
- 9 |"
+ 9 |
+Cause: Missing semicolon. (7:3)"
`;
exports[`return.js format 1`] = `
@@ -417,7 +424,8 @@ exports[`satisfies.js [babel-flow] format 1`] = `
| ^
33 |
34 | abc satisfies mixed; // not a keyword
- 35 | }"
+ 35 | }
+Cause: Unexpected token, expected "type" (32:7)"
`;
exports[`satisfies.js format 1`] = `
@@ -520,7 +528,8 @@ exports[`ternary.js [babel-flow] format 1`] = `
| ^
29 | }
30 |
- 31 | bifornCringerMoshedPerplexSawder ="
+ 31 | bifornCringerMoshedPerplexSawder =
+Cause: Unexpected token, expected "," (28:31)"
`;
exports[`ternary.js format 1`] = `
diff --git a/tests/format/flow/await/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/await/__snapshots__/jsfmt.spec.js.snap
index 7ebbdbd89..78a1b8c12 100644
--- a/tests/format/flow/await/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/await/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`await-keywords.js [babel-flow] format 1`] = `
| ^
13 | }
14 |
- 15 | function foo(promise) { await (promise); }"
+ 15 | function foo(promise) { await (promise); }
+Cause: 'await' is only allowed within async functions and at the top levels of modules. (12:6)"
`;
exports[`await-keywords.js format 1`] = `
diff --git a/tests/format/flow/conditional-types-comments/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/conditional-types-comments/__snapshots__/jsfmt.spec.js.snap
index 758dac9bd..1b4b0a863 100644
--- a/tests/format/flow/conditional-types-comments/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/conditional-types-comments/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`comments.js [babel-flow] format 1`] = `
| ^
4 | ? // comment
5 | foo
- 6 | : bar;"
+ 6 | : bar;
+Cause: Unexpected token (3:11)"
`;
exports[`comments.js format 1`] = `
diff --git a/tests/format/flow/conditional-types/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/conditional-types/__snapshots__/jsfmt.spec.js.snap
index d526f2d96..bd8afd97a 100644
--- a/tests/format/flow/conditional-types/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/conditional-types/__snapshots__/jsfmt.spec.js.snap
@@ -4,7 +4,8 @@ exports[`comments-in-type-annotation.js [babel-flow] format 1`] = `
"Unexpected token (1:24)
> 1 | type A = () => infer R extends/* comment */ string
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:23)"
`;
exports[`comments-in-type-annotation.js format 1`] = `
@@ -29,7 +30,8 @@ exports[`conditional-types.js [babel-flow] format 1`] = `
| ^
4 |
5 | interface DeepReadonlyArray
extends ReadonlyArray> {}
- 6 |"
+ 6 |
+Cause: Unexpected token (3:32)"
`;
exports[`conditional-types.js format 1`] = `
@@ -110,7 +112,8 @@ exports[`cursor.js [babel-flow] format 1`] = `
"Unexpected token (1:24)
> 1 | type A = () => infer R extends string
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:23)"
`;
exports[`cursor.js format 1`] = `
@@ -136,7 +139,8 @@ exports[`infer-type.js [babel-flow] format 1`] = `
| ^
4 |
5 | type Unpacked =
- 6 | T extends (infer U)[] ? U :"
+ 6 | T extends (infer U)[] ? U :
+Cause: Unexpected token, expected "," (3:22)"
`;
exports[`infer-type.js format 1`] = `
@@ -183,7 +187,8 @@ exports[`nested-in-condition.js [babel-flow] format 1`] = `
| ^
5 | DoubleGobbledygookProvider
6 | ? UniqueDalgametreService
- 7 | : CompositeZamazingoResolver;"
+ 7 | : CompositeZamazingoResolver;
+Cause: Unexpected token, expected ")" (4:25)"
`;
exports[`nested-in-condition.js format 1`] = `
@@ -254,7 +259,8 @@ exports[`new-ternary-spec.js [babel-flow] format 1`] = `
| ^
6 | : T extends number ? "number"
7 | : T extends boolean ? "boolean"
- 8 | : T extends undefined ? "undefined""
+ 8 | : T extends undefined ? "undefined"
+Cause: Unexpected token (5:4)"
`;
exports[`new-ternary-spec.js format 1`] = `
@@ -314,7 +320,8 @@ exports[`parentheses.js [babel-flow] format 1`] = `
3 | // #13275
> 4 | type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never;
| ^
- 5 |"
+ 5 |
+Cause: Unexpected token (4:16)"
`;
exports[`parentheses.js format 1`] = `
diff --git a/tests/format/flow/declare-variable/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/declare-variable/__snapshots__/jsfmt.spec.js.snap
index c6e2ebad2..732d8d816 100644
--- a/tests/format/flow/declare-variable/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/declare-variable/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`decare.js [babel-flow] format 1`] = `
| ^
3 | declare const c: string;
4 | declare export var a: string;
- 5 | declare export let b: string;"
+ 5 | declare export let b: string;
+Cause: Unexpected token (2:8)"
`;
exports[`decare.js format 1`] = `
diff --git a/tests/format/flow/function-type-param/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/function-type-param/__snapshots__/jsfmt.spec.js.snap
index d6d305000..b45a03d60 100644
--- a/tests/format/flow/function-type-param/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/function-type-param/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`extends-bound.js [babel-flow] format 1`] = `
2 |
> 3 | type F = (t: T) => T;
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token, expected "," (3:12)"
`;
exports[`extends-bound.js format 1`] = `
diff --git a/tests/format/flow/jsx/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/jsx/__snapshots__/jsfmt.spec.js.snap
index cc5a54f16..9c7d58450 100644
--- a/tests/format/flow/jsx/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/jsx/__snapshots__/jsfmt.spec.js.snap
@@ -20,7 +20,8 @@ exports[`generic-component.js [babel-flow] format 1`] = `
| ^
2 |
3 | const c2 = />
- 4 |"
+ 4 |
+Cause: Unexpected token (1:23)"
`;
exports[`generic-component.js format 1`] = `
diff --git a/tests/format/flow/mapped-types/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/mapped-types/__snapshots__/jsfmt.spec.js.snap
index aedba5a0d..24238bd30 100644
--- a/tests/format/flow/mapped-types/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/mapped-types/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`comments.js [babel-flow] format 1`] = `
| ^
4 | };
5 |
- 6 | type Type = {"
+ 6 | type Type = {
+Cause: Unexpected token, expected "]" (3:6)"
`;
exports[`comments.js [babel-ts] format 1`] = `
@@ -19,7 +20,8 @@ exports[`comments.js [babel-ts] format 1`] = `
| ^
4 | };
5 |
- 6 | type Type = {"
+ 6 | type Type = {
+Cause: Unexpected token (3:2)"
`;
exports[`comments.js [typescript] format 1`] = `
@@ -30,7 +32,8 @@ exports[`comments.js [typescript] format 1`] = `
| ^
4 | };
5 |
- 6 | type Type = {"
+ 6 | type Type = {
+Cause: Property or signature expected."
`;
exports[`comments.js format 1`] = `
@@ -132,7 +135,8 @@ exports[`mapped-types.js [babel-flow] format 1`] = `
| ^
4 | type MappedLong = {[key in keyof AReallyLongNameThatShouldReallyMostDefinitelyCauseALineWrap]: number};
5 | type MappedWithVariance = {+[key in keyof O]: number};
- 6 | type MappedWithVarianceLong = {-[key in keyof AReallyLongNameThatShouldReallyMostDefinitelyCauseALineWrap]: number};"
+ 6 | type MappedWithVarianceLong = {-[key in keyof AReallyLongNameThatShouldReallyMostDefinitelyCauseALineWrap]: number};
+Cause: Unexpected token, expected "]" (3:20)"
`;
exports[`mapped-types.js [babel-ts] format 1`] = `
@@ -143,7 +147,8 @@ exports[`mapped-types.js [babel-ts] format 1`] = `
| ^
6 | type MappedWithVarianceLong = {-[key in keyof AReallyLongNameThatShouldReallyMostDefinitelyCauseALineWrap]: number};
7 | type MappedWithPlusOptional = {[key in keyof O]+?: number};
- 8 | type MappedWithMinusOptional = {[key in keyof O]-?: number};"
+ 8 | type MappedWithMinusOptional = {[key in keyof O]-?: number};
+Cause: Unexpected token (5:27)"
`;
exports[`mapped-types.js [typescript] format 1`] = `
@@ -154,7 +159,8 @@ exports[`mapped-types.js [typescript] format 1`] = `
| ^
6 | type MappedWithVarianceLong = {-[key in keyof AReallyLongNameThatShouldReallyMostDefinitelyCauseALineWrap]: number};
7 | type MappedWithPlusOptional = {[key in keyof O]+?: number};
- 8 | type MappedWithMinusOptional = {[key in keyof O]-?: number};"
+ 8 | type MappedWithMinusOptional = {[key in keyof O]-?: number};
+Cause: Property or signature expected."
`;
exports[`mapped-types.js format 1`] = `
@@ -221,7 +227,8 @@ exports[`ts-compatibility.js [babel-flow] format 1`] = `
| ^
4 | type Test = {[key in keyof T]: number};
5 | type Test = {[otherKeyName in keyof T]: number};
- 6 | type Test = {[key in T]:number};"
+ 6 | type Test = {[key in T]:number};
+Cause: Unexpected token, expected "]" (3:18)"
`;
exports[`ts-compatibility.js format 1`] = `
diff --git a/tests/format/flow/tuples/__snapshots__/jsfmt.spec.js.snap b/tests/format/flow/tuples/__snapshots__/jsfmt.spec.js.snap
index fdd4a6b6f..62044fded 100644
--- a/tests/format/flow/tuples/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/flow/tuples/__snapshots__/jsfmt.spec.js.snap
@@ -4,7 +4,8 @@ exports[`labeled.js [babel-flow] format 1`] = `
"Unexpected token, expected "," (1:12)
> 1 | type T = [a: string, b: number];
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token, expected "," (1:11)"
`;
exports[`labeled.js format 1`] = `
@@ -27,7 +28,8 @@ exports[`optional.js [babel-flow] format 1`] = `
| ^
2 |
3 | // Unaffected
- 4 | type B = [?string, [?string], (?string) => boolean];"
+ 4 | type B = [?string, [?string], (?string) => boolean];
+Cause: Unexpected token, expected "," (1:11)"
`;
exports[`optional.js format 1`] = `
@@ -54,7 +56,8 @@ exports[`variance.js [babel-flow] format 1`] = `
"Unexpected token, expected "," (1:12)
> 1 | type T = [a: string, +b: number, -c: boolean];
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token, expected "," (1:11)"
`;
exports[`variance.js format 1`] = `
diff --git a/tests/format/js/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/arrays/__snapshots__/jsfmt.spec.js.snap
index 105bc69dd..8e45ff4bd 100644
--- a/tests/format/js/arrays/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/arrays/__snapshots__/jsfmt.spec.js.snap
@@ -1012,7 +1012,8 @@ exports[`tuple-and-record.js [acorn] format 1`] = `
| ^
8 | #[1,2],
9 | ]
- 10 |"
+ 10 |
+Cause: Unexpected character '[' (7:3)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
@@ -1023,7 +1024,8 @@ exports[`tuple-and-record.js [espree] format 1`] = `
| ^
8 | #[1,2],
9 | ]
- 10 |"
+ 10 |
+Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
@@ -1045,7 +1047,8 @@ exports[`tuple-and-record.js [meriyah] format 1`] = `
| ^
8 | #[1,2],
9 | ]
- 10 |"
+ 10 |
+Cause: [7:3]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
@@ -1056,7 +1059,8 @@ exports[`tuple-and-record.js [typescript] format 1`] = `
| ^
8 | #[1,2],
9 | ]
- 10 |"
+ 10 |
+Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
diff --git a/tests/format/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap
index 417e406e8..cc9b2c69d 100644
--- a/tests/format/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`arrows-bind.js [acorn] format 1`] = `
| ^
2 | (a => b)::c;
3 | a::(b => c);
- 4 |"
+ 4 |
+Cause: Unexpected token (1:8)"
`;
exports[`arrows-bind.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`arrows-bind.js [espree] format 1`] = `
| ^
2 | (a => b)::c;
3 | a::(b => c);
- 4 |"
+ 4 |
+Cause: Unexpected token :"
`;
exports[`arrows-bind.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`arrows-bind.js [meriyah] format 1`] = `
| ^
2 | (a => b)::c;
3 | a::(b => c);
- 4 |"
+ 4 |
+Cause: [1:9]: Expected ')'"
`;
exports[`arrows-bind.js format 1`] = `
diff --git a/tests/format/js/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/arrows/__snapshots__/jsfmt.spec.js.snap
index 929639741..b86819a05 100644
--- a/tests/format/js/arrows/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/arrows/__snapshots__/jsfmt.spec.js.snap
@@ -4548,7 +4548,8 @@ exports[`tuple-and-record.js - {"arrowParens":"always"} [acorn] format 1`] = `
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
- 7 | map(() => (["
+ 7 | map(() => ([
+Cause: Identifier 'fn12' has already been declared (4:6)"
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} [espree] format 1`] = `
@@ -4559,7 +4560,8 @@ exports[`tuple-and-record.js - {"arrowParens":"always"} [espree] format 1`] = `
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
- 7 | map(() => (["
+ 7 | map(() => ([
+Cause: Identifier 'fn12' has already been declared"
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} [meriyah] format 1`] = `
@@ -4570,7 +4572,8 @@ exports[`tuple-and-record.js - {"arrowParens":"always"} [meriyah] format 1`] = `
| ^
6 |
7 | map(() => ([
- 8 | // comment"
+ 8 | // comment
+Cause: [5:4]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} [typescript] format 1`] = `
@@ -4581,7 +4584,8 @@ exports[`tuple-and-record.js - {"arrowParens":"always"} [typescript] format 1`]
| ^
6 |
7 | map(() => ([
- 8 | // comment"
+ 8 | // comment
+Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"arrowParens":"always"} format 1`] = `
@@ -4661,7 +4665,8 @@ exports[`tuple-and-record.js - {"arrowParens":"avoid"} [acorn] format 1`] = `
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
- 7 | map(() => (["
+ 7 | map(() => ([
+Cause: Identifier 'fn12' has already been declared (4:6)"
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [espree] format 1`] = `
@@ -4672,7 +4677,8 @@ exports[`tuple-and-record.js - {"arrowParens":"avoid"} [espree] format 1`] = `
| ^
5 | (#{ foo: bar, bar: baz, baz: foo });
6 |
- 7 | map(() => (["
+ 7 | map(() => ([
+Cause: Identifier 'fn12' has already been declared"
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [meriyah] format 1`] = `
@@ -4683,7 +4689,8 @@ exports[`tuple-and-record.js - {"arrowParens":"avoid"} [meriyah] format 1`] = `
| ^
6 |
7 | map(() => ([
- 8 | // comment"
+ 8 | // comment
+Cause: [5:4]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} [typescript] format 1`] = `
@@ -4694,7 +4701,8 @@ exports[`tuple-and-record.js - {"arrowParens":"avoid"} [typescript] format 1`] =
| ^
6 |
7 | map(() => ([
- 8 | // comment"
+ 8 | // comment
+Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"arrowParens":"avoid"} format 1`] = `
diff --git a/tests/format/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap
index 8a8713a20..66010df20 100644
--- a/tests/format/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,8 @@ exports[`newline-before-arrow.js [acorn] format 1`] = `
1 | async x
> 2 | => x
| ^
- 3 |"
+ 3 |
+Cause: Unexpected token (2:0)"
`;
exports[`newline-before-arrow.js [espree] format 1`] = `
@@ -13,7 +14,8 @@ exports[`newline-before-arrow.js [espree] format 1`] = `
1 | async x
> 2 | => x
| ^
- 3 |"
+ 3 |
+Cause: Unexpected token =>"
`;
exports[`newline-before-arrow.js [meriyah] format 1`] = `
@@ -21,7 +23,8 @@ exports[`newline-before-arrow.js [meriyah] format 1`] = `
1 | async x
> 2 | => x
| ^
- 3 |"
+ 3 |
+Cause: [2:2]: No line break is allowed after '=>'"
`;
exports[`newline-before-arrow.js format 1`] = `
diff --git a/tests/format/js/async-do-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/async-do-expressions/__snapshots__/jsfmt.spec.js.snap
index 9930e719b..ed2082d0e 100644
--- a/tests/format/js/async-do-expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/async-do-expressions/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`async-do-expressions.js [acorn] format 1`] = `
| ^
2 | 1;
3 | };
- 4 |"
+ 4 |
+Cause: Unexpected token (1:6)"
`;
exports[`async-do-expressions.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`async-do-expressions.js [espree] format 1`] = `
| ^
2 | 1;
3 | };
- 4 |"
+ 4 |
+Cause: Unexpected token do"
`;
exports[`async-do-expressions.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`async-do-expressions.js [meriyah] format 1`] = `
| ^
2 | 1;
3 | };
- 4 |"
+ 4 |
+Cause: [1:8]: Unexpected token: 'do'"
`;
exports[`async-do-expressions.js format 1`] = `
diff --git a/tests/format/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
index 2170d484e..cb1691d50 100644
--- a/tests/format/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`async-do-expressions.js [acorn] format 1`] = `
"Unexpected token (1:7)
> 1 | async do { await requestAPI().json() };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:6)"
`;
exports[`async-do-expressions.js [espree] format 1`] = `
"Unexpected token do (1:7)
> 1 | async do { await requestAPI().json() };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token do"
`;
exports[`async-do-expressions.js [meriyah] format 1`] = `
"Unexpected token: 'do' (1:8)
> 1 | async do { await requestAPI().json() };
| ^
- 2 |"
+ 2 |
+Cause: [1:8]: Unexpected token: 'do'"
`;
exports[`async-do-expressions.js format 1`] = `
@@ -435,7 +438,8 @@ exports[`decimal.js [acorn] format 1`] = `
| ^
4 | 9223372036854775807m;
5 | 0.m;
- 6 | 3.1415926535897932m;"
+ 6 | 3.1415926535897932m;
+Cause: Identifier directly after number (3:3)"
`;
exports[`decimal.js [espree] format 1`] = `
@@ -446,7 +450,8 @@ exports[`decimal.js [espree] format 1`] = `
| ^
4 | 9223372036854775807m;
5 | 0.m;
- 6 | 3.1415926535897932m;"
+ 6 | 3.1415926535897932m;
+Cause: Identifier directly after number"
`;
exports[`decimal.js [meriyah] format 1`] = `
@@ -457,7 +462,8 @@ exports[`decimal.js [meriyah] format 1`] = `
| ^
4 | 9223372036854775807m;
5 | 0.m;
- 6 | 3.1415926535897932m;"
+ 6 | 3.1415926535897932m;
+Cause: [3:3]: No identifiers allowed directly after numeric literal"
`;
exports[`decimal.js format 1`] = `
@@ -529,7 +535,8 @@ exports[`decorator-auto-accessors.js [acorn] format 1`] = `
> 2 | accessor clicked = false;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`decorator-auto-accessors.js [espree] format 1`] = `
@@ -538,7 +545,8 @@ exports[`decorator-auto-accessors.js [espree] format 1`] = `
> 2 | accessor clicked = false;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token clicked"
`;
exports[`decorator-auto-accessors.js format 1`] = `
@@ -567,7 +575,8 @@ exports[`decorators.js [acorn] format 1`] = `
| ^
4 | class MyClass { }
5 |
- 6 | function annotation(target) {"
+ 6 | function annotation(target) {
+Cause: Unexpected character '@' (3:0)"
`;
exports[`decorators.js [espree] format 1`] = `
@@ -578,7 +587,8 @@ exports[`decorators.js [espree] format 1`] = `
| ^
4 | class MyClass { }
5 |
- 6 | function annotation(target) {"
+ 6 | function annotation(target) {
+Cause: Unexpected character '@'"
`;
exports[`decorators.js format 1`] = `
@@ -655,21 +665,24 @@ exports[`deferred-import-evaluation.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import defer * as ns from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`deferred-import-evaluation.js [espree] format 1`] = `
"Unexpected token * (1:14)
> 1 | import defer * as ns from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token *"
`;
exports[`deferred-import-evaluation.js [meriyah] format 1`] = `
"Import source must be string (1:14)
> 1 | import defer * as ns from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Import source must be string"
`;
exports[`deferred-import-evaluation.js format 1`] = `
@@ -694,7 +707,8 @@ exports[`destructuring-private.js [acorn] format 1`] = `
| ^
6 | console.log(x); // => 1
7 | }
- 8 | equals({ #x: otherX }) {"
+ 8 | equals({ #x: otherX }) {
+Cause: Unexpected token (5:12)"
`;
exports[`destructuring-private.js [espree] format 1`] = `
@@ -705,7 +719,8 @@ exports[`destructuring-private.js [espree] format 1`] = `
| ^
6 | console.log(x); // => 1
7 | }
- 8 | equals({ #x: otherX }) {"
+ 8 | equals({ #x: otherX }) {
+Cause: Unexpected token #x"
`;
exports[`destructuring-private.js [meriyah] format 1`] = `
@@ -716,7 +731,8 @@ exports[`destructuring-private.js [meriyah] format 1`] = `
| ^
6 | console.log(x); // => 1
7 | }
- 8 | equals({ #x: otherX }) {"
+ 8 | equals({ #x: otherX }) {
+Cause: [5:13]: Unexpected token: 'PrivateField'"
`;
exports[`destructuring-private.js format 1`] = `
@@ -763,7 +779,8 @@ exports[`do-expressions.js [acorn] format 1`] = `
| ^
4 | if(x > 10) {
5 | 'big';
- 6 | } else {"
+ 6 | } else {
+Cause: Unexpected token (3:8)"
`;
exports[`do-expressions.js [espree] format 1`] = `
@@ -774,7 +791,8 @@ exports[`do-expressions.js [espree] format 1`] = `
| ^
4 | if(x > 10) {
5 | 'big';
- 6 | } else {"
+ 6 | } else {
+Cause: Unexpected token do"
`;
exports[`do-expressions.js [meriyah] format 1`] = `
@@ -785,7 +803,8 @@ exports[`do-expressions.js [meriyah] format 1`] = `
| ^
4 | if(x > 10) {
5 | 'big';
- 6 | } else {"
+ 6 | } else {
+Cause: [3:10]: Unexpected token: 'do'"
`;
exports[`do-expressions.js format 1`] = `
@@ -857,7 +876,8 @@ exports[`explicit-resource-management.js [acorn] format 1`] = `
| ^
3 | } // cleanup
4 |
- 5 | {"
+ 5 | {
+Cause: Unexpected token (2:8)"
`;
exports[`explicit-resource-management.js [espree] format 1`] = `
@@ -867,7 +887,8 @@ exports[`explicit-resource-management.js [espree] format 1`] = `
| ^
3 | } // cleanup
4 |
- 5 | {"
+ 5 | {
+Cause: Unexpected token handle"
`;
exports[`explicit-resource-management.js [meriyah] format 1`] = `
@@ -877,7 +898,8 @@ exports[`explicit-resource-management.js [meriyah] format 1`] = `
| ^
3 | } // cleanup
4 |
- 5 | {"
+ 5 | {
+Cause: [2:14]: Unexpected token: 'identifier'"
`;
exports[`explicit-resource-management.js format 1`] = `
@@ -922,7 +944,8 @@ exports[`export-default-from.js [acorn] format 1`] = `
3 |
> 4 | export v from 'mod';
| ^
- 5 |"
+ 5 |
+Cause: Unexpected token (4:7)"
`;
exports[`export-default-from.js [espree] format 1`] = `
@@ -931,7 +954,8 @@ exports[`export-default-from.js [espree] format 1`] = `
3 |
> 4 | export v from 'mod';
| ^
- 5 |"
+ 5 |
+Cause: Unexpected token v"
`;
exports[`export-default-from.js [meriyah] format 1`] = `
@@ -940,7 +964,8 @@ exports[`export-default-from.js [meriyah] format 1`] = `
3 |
> 4 | export v from 'mod';
| ^
- 5 |"
+ 5 |
+Cause: [4:8]: Unexpected token: 'identifier'"
`;
exports[`export-default-from.js format 1`] = `
@@ -986,7 +1011,8 @@ exports[`flow.js [__babel_estree] format 1`] = `
2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token, expected "," (3:16)"
`;
exports[`flow.js [acorn] format 1`] = `
@@ -995,7 +1021,8 @@ exports[`flow.js [acorn] format 1`] = `
2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token (3:16)"
`;
exports[`flow.js [babel] format 1`] = `
@@ -1004,7 +1031,8 @@ exports[`flow.js [babel] format 1`] = `
2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token, expected "," (3:16)"
`;
exports[`flow.js [babel-flow] format 1`] = `
@@ -1049,7 +1077,8 @@ exports[`flow.js [espree] format 1`] = `
2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token :"
`;
exports[`flow.js [meriyah] format 1`] = `
@@ -1058,7 +1087,8 @@ exports[`flow.js [meriyah] format 1`] = `
2 |
> 3 | function foo(one: any, two: number, three?): string {}
| ^
- 4 |"
+ 4 |
+Cause: [3:17]: Expected ')'"
`;
exports[`function-bind.js [acorn] format 1`] = `
@@ -1069,7 +1099,8 @@ exports[`function-bind.js [acorn] format 1`] = `
| ^
4 | // is equivalent to:
5 | func.bind(obj)
- 6 |"
+ 6 |
+Cause: Unexpected token (3:4)"
`;
exports[`function-bind.js [espree] format 1`] = `
@@ -1080,7 +1111,8 @@ exports[`function-bind.js [espree] format 1`] = `
| ^
4 | // is equivalent to:
5 | func.bind(obj)
- 6 |"
+ 6 |
+Cause: Unexpected token :"
`;
exports[`function-bind.js [meriyah] format 1`] = `
@@ -1091,7 +1123,8 @@ exports[`function-bind.js [meriyah] format 1`] = `
| ^
4 | // is equivalent to:
5 | func.bind(obj)
- 6 |"
+ 6 |
+Cause: [3:5]: Unexpected token: ':'"
`;
exports[`function-bind.js format 1`] = `
@@ -1147,7 +1180,8 @@ exports[`function-sent.js [acorn] format 1`] = `
| ^
5 | console.log("Yield", yield);
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token (4:32)"
`;
exports[`function-sent.js [espree] format 1`] = `
@@ -1158,7 +1192,8 @@ exports[`function-sent.js [espree] format 1`] = `
| ^
5 | console.log("Yield", yield);
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token ."
`;
exports[`function-sent.js [meriyah] format 1`] = `
@@ -1169,7 +1204,8 @@ exports[`function-sent.js [meriyah] format 1`] = `
| ^
5 | console.log("Yield", yield);
6 | }
- 7 |"
+ 7 |
+Cause: [4:33]: Expected '('"
`;
exports[`function-sent.js format 1`] = `
@@ -1208,21 +1244,24 @@ exports[`import-assertions-dynamic.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`import-assertions-dynamic.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`import-assertions-dynamic.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`import-assertions-dynamic.js format 1`] = `
@@ -1243,21 +1282,24 @@ exports[`import-assertions-static.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`import-assertions-static.js [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`import-assertions-static.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:36)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:36]: Unexpected token: 'identifier'"
`;
exports[`import-assertions-static.js format 1`] = `
@@ -1278,21 +1320,24 @@ exports[`import-attributes-dynamic.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`import-attributes-dynamic.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`import-attributes-dynamic.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`import-attributes-dynamic.js format 1`] = `
@@ -1313,21 +1358,24 @@ exports[`import-attributes-static.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`import-attributes-static.js [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`import-attributes-static.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:34]: Unexpected token: 'with'"
`;
exports[`import-attributes-static.js format 1`] = `
@@ -1396,21 +1444,24 @@ exports[`import-reflection.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`import-reflection.js [espree] format 1`] = `
"Unexpected token foo (1:15)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token foo"
`;
exports[`import-reflection.js [meriyah] format 1`] = `
"Import source must be string (1:17)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: [1:17]: Import source must be string"
`;
exports[`import-reflection.js format 1`] = `
@@ -1485,7 +1536,8 @@ exports[`module-blocks.js [acorn] format 1`] = `
| ^
2 | export let m = 2;
3 | export let n = 3;
- 4 | };"
+ 4 | };
+Cause: Unexpected token (1:15)"
`;
exports[`module-blocks.js [espree] format 1`] = `
@@ -1494,7 +1546,8 @@ exports[`module-blocks.js [espree] format 1`] = `
| ^
2 | export let m = 2;
3 | export let n = 3;
- 4 | };"
+ 4 | };
+Cause: Unexpected token {"
`;
exports[`module-blocks.js [meriyah] format 1`] = `
@@ -1503,7 +1556,8 @@ exports[`module-blocks.js [meriyah] format 1`] = `
| ^
2 | export let m = 2;
3 | export let n = 3;
- 4 | };"
+ 4 | };
+Cause: [1:16]: Unexpected token: '{'"
`;
exports[`module-blocks.js format 1`] = `
@@ -1531,7 +1585,8 @@ exports[`module-string-names.js [meriyah] format 1`] = `
> 1 | import { "😄" as smile } from "./emojis.js";
| ^
2 | export { smile as "😄" } from "./emojis.js";
- 3 |"
+ 3 |
+Cause: [1:13]: Expected '}'"
`;
exports[`module-string-names.js format 1`] = `
@@ -1863,21 +1918,24 @@ exports[`optional-chaining-assignment.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | maybeAnObj?.prop = theValue;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:0)"
`;
exports[`optional-chaining-assignment.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | maybeAnObj?.prop = theValue;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`optional-chaining-assignment.js [meriyah] format 1`] = `
"Invalid left-hand side in assignment (1:18)
> 1 | maybeAnObj?.prop = theValue;
| ^
- 2 |"
+ 2 |
+Cause: [1:18]: Invalid left-hand side in assignment"
`;
exports[`optional-chaining-assignment.js format 1`] = `
@@ -1902,7 +1960,8 @@ exports[`partial-application.js [acorn] format 1`] = `
| ^
6 | addOne(2); // 3
7 |
- 8 | const addTen = add(?, 10); // apply from the right"
+ 8 | const addTen = add(?, 10); // apply from the right
+Cause: Unexpected token (5:22)"
`;
exports[`partial-application.js [espree] format 1`] = `
@@ -1913,7 +1972,8 @@ exports[`partial-application.js [espree] format 1`] = `
| ^
6 | addOne(2); // 3
7 |
- 8 | const addTen = add(?, 10); // apply from the right"
+ 8 | const addTen = add(?, 10); // apply from the right
+Cause: Unexpected token ?"
`;
exports[`partial-application.js [meriyah] format 1`] = `
@@ -1924,7 +1984,8 @@ exports[`partial-application.js [meriyah] format 1`] = `
| ^
6 | addOne(2); // 3
7 |
- 8 | const addTen = add(?, 10); // apply from the right"
+ 8 | const addTen = add(?, 10); // apply from the right
+Cause: [5:23]: Unexpected token: '?'"
`;
exports[`partial-application.js format 1`] = `
@@ -1989,7 +2050,8 @@ exports[`pipeline-operator-fsharp.js [acorn] format 1`] = `
| ^
6 | |> x => doubleSay(x, ', ')
7 | |> capitalize
- 8 | |> x => x + '!'"
+ 8 | |> x => x + '!'
+Cause: Unexpected token (5:3)"
`;
exports[`pipeline-operator-fsharp.js [espree] format 1`] = `
@@ -2000,7 +2062,8 @@ exports[`pipeline-operator-fsharp.js [espree] format 1`] = `
| ^
6 | |> x => doubleSay(x, ', ')
7 | |> capitalize
- 8 | |> x => x + '!'"
+ 8 | |> x => x + '!'
+Cause: Unexpected token >"
`;
exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = `
@@ -2011,7 +2074,8 @@ exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = `
| ^
6 | |> x => doubleSay(x, ', ')
7 | |> capitalize
- 8 | |> x => x + '!'"
+ 8 | |> x => x + '!'
+Cause: [5:4]: Unexpected token: '>'"
`;
exports[`pipeline-operator-fsharp.js format 1`] = `
@@ -2097,7 +2161,8 @@ exports[`pipeline-operator-hack.js [acorn] format 1`] = `
| ^
6 | |> equals(%, prefix);
7 |
- 8 | // (The % token isn't final; it might instead be @ or ? or #.)"
+ 8 | // (The % token isn't final; it might instead be @ or ? or #.)
+Cause: Unexpected token (5:2)"
`;
exports[`pipeline-operator-hack.js [espree] format 1`] = `
@@ -2108,7 +2173,8 @@ exports[`pipeline-operator-hack.js [espree] format 1`] = `
| ^
6 | |> equals(%, prefix);
7 |
- 8 | // (The % token isn't final; it might instead be @ or ? or #.)"
+ 8 | // (The % token isn't final; it might instead be @ or ? or #.)
+Cause: Unexpected token >"
`;
exports[`pipeline-operator-hack.js [meriyah] format 1`] = `
@@ -2119,7 +2185,8 @@ exports[`pipeline-operator-hack.js [meriyah] format 1`] = `
| ^
6 | |> equals(%, prefix);
7 |
- 8 | // (The % token isn't final; it might instead be @ or ? or #.)"
+ 8 | // (The % token isn't final; it might instead be @ or ? or #.)
+Cause: [5:3]: Unexpected token: '>'"
`;
exports[`pipeline-operator-hack.js format 1`] = `
@@ -2156,7 +2223,8 @@ exports[`pipeline-operator-minimal.js [acorn] format 1`] = `
| ^
8 | |> doubleSay
9 | |> capitalize
- 10 | |> exclaim;"
+ 10 | |> exclaim;
+Cause: Identifier 'result' has already been declared (7:4)"
`;
exports[`pipeline-operator-minimal.js [espree] format 1`] = `
@@ -2167,7 +2235,8 @@ exports[`pipeline-operator-minimal.js [espree] format 1`] = `
| ^
8 | |> doubleSay
9 | |> capitalize
- 10 | |> exclaim;"
+ 10 | |> exclaim;
+Cause: Identifier 'result' has already been declared"
`;
exports[`pipeline-operator-minimal.js [meriyah] format 1`] = `
@@ -2178,7 +2247,8 @@ exports[`pipeline-operator-minimal.js [meriyah] format 1`] = `
| ^
9 | |> capitalize
10 | |> exclaim;
- 11 |"
+ 11 |
+Cause: [8:4]: Unexpected token: '>'"
`;
exports[`pipeline-operator-minimal.js format 1`] = `
@@ -2393,7 +2463,8 @@ exports[`record-tuple-record.js [acorn] format 1`] = `
| ^
2 | a: 1,
3 | b: 2,
- 4 | c: 3,"
+ 4 | c: 3,
+Cause: Unexpected character '{' (1:17)"
`;
exports[`record-tuple-record.js [espree] format 1`] = `
@@ -2402,7 +2473,8 @@ exports[`record-tuple-record.js [espree] format 1`] = `
| ^
2 | a: 1,
3 | b: 2,
- 4 | c: 3,"
+ 4 | c: 3,
+Cause: Unexpected character '{'"
`;
exports[`record-tuple-record.js [meriyah] format 1`] = `
@@ -2411,7 +2483,8 @@ exports[`record-tuple-record.js [meriyah] format 1`] = `
| ^
2 | a: 1,
3 | b: 2,
- 4 | c: 3,"
+ 4 | c: 3,
+Cause: [1:17]: '#' not followed by identifier"
`;
exports[`record-tuple-record.js format 1`] = `
@@ -2444,21 +2517,24 @@ exports[`record-tuple-tuple.js [acorn] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 |"
+ 2 |
+Cause: Unexpected character '[' (1:16)"
`;
exports[`record-tuple-tuple.js [espree] format 1`] = `
"Unexpected character '[' (1:17)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 |"
+ 2 |
+Cause: Unexpected character '['"
`;
exports[`record-tuple-tuple.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:16)
> 1 | const tuple1 = #[1, 2, 3];
| ^
- 2 |"
+ 2 |
+Cause: [1:16]: '#' not followed by identifier"
`;
exports[`record-tuple-tuple.js format 1`] = `
@@ -2479,7 +2555,8 @@ exports[`regex-v-flag.js [meriyah] format 1`] = `
"Unexpected regular expression flag (1:3)
> 1 | /a/v;
| ^
- 2 |"
+ 2 |
+Cause: [1:3]: Unexpected regular expression flag"
`;
exports[`regex-v-flag.js format 1`] = `
@@ -2500,21 +2577,24 @@ exports[`regexp-modifiers.js [acorn] format 1`] = `
"Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group (1:13)
> 1 | const re = /^(?i:[a-z])[a-z]$/;
| ^
- 2 |"
+ 2 |
+Cause: Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group (1:12)"
`;
exports[`regexp-modifiers.js [espree] format 1`] = `
"Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group (1:13)
> 1 | const re = /^(?i:[a-z])[a-z]$/;
| ^
- 2 |"
+ 2 |
+Cause: Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group"
`;
exports[`regexp-modifiers.js [meriyah] format 1`] = `
"Unterminated regular expression (1:30)
> 1 | const re = /^(?i:[a-z])[a-z]$/;
| ^
- 2 |"
+ 2 |
+Cause: [1:30]: Unterminated regular expression"
`;
exports[`regexp-modifiers.js format 1`] = `
@@ -2536,7 +2616,8 @@ exports[`source-phase-imports.js [acorn] format 1`] = `
> 1 | import source fooSource from "foo";
| ^
2 | import.source("x");
- 3 |"
+ 3 |
+Cause: Unexpected token (1:14)"
`;
exports[`source-phase-imports.js [espree] format 1`] = `
@@ -2544,7 +2625,8 @@ exports[`source-phase-imports.js [espree] format 1`] = `
> 1 | import source fooSource from "foo";
| ^
2 | import.source("x");
- 3 |"
+ 3 |
+Cause: Unexpected token fooSource"
`;
exports[`source-phase-imports.js [meriyah] format 1`] = `
@@ -2552,7 +2634,8 @@ exports[`source-phase-imports.js [meriyah] format 1`] = `
> 1 | import source fooSource from "foo";
| ^
2 | import.source("x");
- 3 |"
+ 3 |
+Cause: [1:23]: Import source must be string"
`;
exports[`source-phase-imports.js format 1`] = `
@@ -2579,7 +2662,8 @@ exports[`throw-expressions.js [acorn] format 1`] = `
| ^
4 | const test = param === true || throw new Error('Falsy!');
5 | }
- 6 |"
+ 6 |
+Cause: Unexpected token (3:22)"
`;
exports[`throw-expressions.js [espree] format 1`] = `
@@ -2590,7 +2674,8 @@ exports[`throw-expressions.js [espree] format 1`] = `
| ^
4 | const test = param === true || throw new Error('Falsy!');
5 | }
- 6 |"
+ 6 |
+Cause: Unexpected token throw"
`;
exports[`throw-expressions.js [meriyah] format 1`] = `
@@ -2601,7 +2686,8 @@ exports[`throw-expressions.js [meriyah] format 1`] = `
| ^
4 | const test = param === true || throw new Error('Falsy!');
5 | }
- 6 |"
+ 6 |
+Cause: [3:27]: Unexpected token: 'throw'"
`;
exports[`throw-expressions.js format 1`] = `
@@ -2632,7 +2718,8 @@ exports[`typescript.js [__babel_estree] format 1`] = `
2 |
> 3 | const x: number = 0;
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token (3:7)"
`;
exports[`typescript.js [acorn] format 1`] = `
@@ -2641,7 +2728,8 @@ exports[`typescript.js [acorn] format 1`] = `
2 |
> 3 | const x: number = 0;
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token (3:7)"
`;
exports[`typescript.js [babel] format 1`] = `
@@ -2650,7 +2738,8 @@ exports[`typescript.js [babel] format 1`] = `
2 |
> 3 | const x: number = 0;
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token (3:7)"
`;
exports[`typescript.js [babel-flow] format 1`] = `
@@ -2695,7 +2784,8 @@ exports[`typescript.js [espree] format 1`] = `
2 |
> 3 | const x: number = 0;
| ^
- 4 |"
+ 4 |
+Cause: Unexpected token :"
`;
exports[`typescript.js [meriyah] format 1`] = `
@@ -2704,7 +2794,8 @@ exports[`typescript.js [meriyah] format 1`] = `
2 |
> 3 | const x: number = 0;
| ^
- 4 |"
+ 4 |
+Cause: [3:8]: Missing initializer in const declaration"
`;
exports[`v8intrinsic.js [acorn] format 1`] = `
@@ -2715,7 +2806,8 @@ exports[`v8intrinsic.js [acorn] format 1`] = `
| ^
4 |
5 |
- 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json"
+ 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json
+Cause: Unexpected token (3:0)"
`;
exports[`v8intrinsic.js [espree] format 1`] = `
@@ -2726,7 +2818,8 @@ exports[`v8intrinsic.js [espree] format 1`] = `
| ^
4 |
5 |
- 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json"
+ 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json
+Cause: Unexpected token %"
`;
exports[`v8intrinsic.js [meriyah] format 1`] = `
@@ -2737,7 +2830,8 @@ exports[`v8intrinsic.js [meriyah] format 1`] = `
| ^
4 |
5 |
- 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json"
+ 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json
+Cause: [3:1]: Unexpected token: '%'"
`;
exports[`v8intrinsic.js format 1`] = `
diff --git a/tests/format/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap
index 04e294c24..ca97eefda 100644
--- a/tests/format/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap
@@ -1159,7 +1159,8 @@ exports[`tuple-and-record.js [acorn] format 1`] = `
| ^
7 | // comment
8 | a,
- 9 | ]"
+ 9 | ]
+Cause: Unexpected character '[' (6:14)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
@@ -1170,7 +1171,8 @@ exports[`tuple-and-record.js [espree] format 1`] = `
| ^
7 | // comment
8 | a,
- 9 | ]"
+ 9 | ]
+Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
@@ -1192,7 +1194,8 @@ exports[`tuple-and-record.js [meriyah] format 1`] = `
| ^
7 | // comment
8 | a,
- 9 | ]"
+ 9 | ]
+Cause: [6:14]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
@@ -1203,7 +1206,8 @@ exports[`tuple-and-record.js [typescript] format 1`] = `
| ^
7 | // comment
8 | a,
- 9 | ]"
+ 9 | ]
+Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
diff --git a/tests/format/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap
index 8226a369f..95ffe0f0c 100644
--- a/tests/format/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`await.js [acorn] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 |"
+ 5 |
+Cause: Unexpected token (3:26)"
`;
exports[`await.js [espree] format 1`] = `
@@ -17,7 +18,8 @@ exports[`await.js [espree] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 |"
+ 5 |
+Cause: Unexpected token :"
`;
exports[`await.js [meriyah] format 1`] = `
@@ -27,7 +29,8 @@ exports[`await.js [meriyah] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 |"
+ 5 |
+Cause: [3:27]: Unexpected token: ':'"
`;
exports[`await.js - {"semi":false} [acorn] format 1`] = `
@@ -37,7 +40,8 @@ exports[`await.js - {"semi":false} [acorn] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 |"
+ 5 |
+Cause: Unexpected token (3:26)"
`;
exports[`await.js - {"semi":false} [espree] format 1`] = `
@@ -47,7 +51,8 @@ exports[`await.js - {"semi":false} [espree] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 |"
+ 5 |
+Cause: Unexpected token :"
`;
exports[`await.js - {"semi":false} [meriyah] format 1`] = `
@@ -57,7 +62,8 @@ exports[`await.js - {"semi":false} [meriyah] format 1`] = `
> 3 | return (await request)::doSyncThing();
| ^
4 | };
- 5 |"
+ 5 |
+Cause: [3:27]: Unexpected token: ':'"
`;
exports[`await.js - {"semi":false} format 1`] = `
@@ -107,7 +113,8 @@ exports[`bind_parens.js [acorn] format 1`] = `
| ^
2 | a || (b::c);
3 | ::obj.prop;
- 4 | (void 0)::func();"
+ 4 | (void 0)::func();
+Cause: Unexpected token (1:8)"
`;
exports[`bind_parens.js [espree] format 1`] = `
@@ -116,7 +123,8 @@ exports[`bind_parens.js [espree] format 1`] = `
| ^
2 | a || (b::c);
3 | ::obj.prop;
- 4 | (void 0)::func();"
+ 4 | (void 0)::func();
+Cause: Unexpected token :"
`;
exports[`bind_parens.js [meriyah] format 1`] = `
@@ -125,7 +133,8 @@ exports[`bind_parens.js [meriyah] format 1`] = `
| ^
2 | a || (b::c);
3 | ::obj.prop;
- 4 | (void 0)::func();"
+ 4 | (void 0)::func();
+Cause: [1:9]: Unexpected token: ':'"
`;
exports[`bind_parens.js - {"semi":false} [acorn] format 1`] = `
@@ -134,7 +143,8 @@ exports[`bind_parens.js - {"semi":false} [acorn] format 1`] = `
| ^
2 | a || (b::c);
3 | ::obj.prop;
- 4 | (void 0)::func();"
+ 4 | (void 0)::func();
+Cause: Unexpected token (1:8)"
`;
exports[`bind_parens.js - {"semi":false} [espree] format 1`] = `
@@ -143,7 +153,8 @@ exports[`bind_parens.js - {"semi":false} [espree] format 1`] = `
| ^
2 | a || (b::c);
3 | ::obj.prop;
- 4 | (void 0)::func();"
+ 4 | (void 0)::func();
+Cause: Unexpected token :"
`;
exports[`bind_parens.js - {"semi":false} [meriyah] format 1`] = `
@@ -152,7 +163,8 @@ exports[`bind_parens.js - {"semi":false} [meriyah] format 1`] = `
| ^
2 | a || (b::c);
3 | ::obj.prop;
- 4 | (void 0)::func();"
+ 4 | (void 0)::func();
+Cause: [1:9]: Unexpected token: ':'"
`;
exports[`bind_parens.js - {"semi":false} format 1`] = `
@@ -324,7 +336,8 @@ exports[`long_name_method.js [acorn] format 1`] = `
| ^
4 | }
5 |
- 6 | testLongNameMethodAndSomethingElseLallala() {"
+ 6 | testLongNameMethodAndSomethingElseLallala() {
+Cause: Unexpected token (3:53)"
`;
exports[`long_name_method.js [espree] format 1`] = `
@@ -335,7 +348,8 @@ exports[`long_name_method.js [espree] format 1`] = `
| ^
4 | }
5 |
- 6 | testLongNameMethodAndSomethingElseLallala() {"
+ 6 | testLongNameMethodAndSomethingElseLallala() {
+Cause: Unexpected token :"
`;
exports[`long_name_method.js [meriyah] format 1`] = `
@@ -346,7 +360,8 @@ exports[`long_name_method.js [meriyah] format 1`] = `
| ^
4 | }
5 |
- 6 | testLongNameMethodAndSomethingElseLallala() {"
+ 6 | testLongNameMethodAndSomethingElseLallala() {
+Cause: [3:54]: Unexpected token: ':'"
`;
exports[`long_name_method.js - {"semi":false} [acorn] format 1`] = `
@@ -357,7 +372,8 @@ exports[`long_name_method.js - {"semi":false} [acorn] format 1`] = `
| ^
4 | }
5 |
- 6 | testLongNameMethodAndSomethingElseLallala() {"
+ 6 | testLongNameMethodAndSomethingElseLallala() {
+Cause: Unexpected token (3:53)"
`;
exports[`long_name_method.js - {"semi":false} [espree] format 1`] = `
@@ -368,7 +384,8 @@ exports[`long_name_method.js - {"semi":false} [espree] format 1`] = `
| ^
4 | }
5 |
- 6 | testLongNameMethodAndSomethingElseLallala() {"
+ 6 | testLongNameMethodAndSomethingElseLallala() {
+Cause: Unexpected token :"
`;
exports[`long_name_method.js - {"semi":false} [meriyah] format 1`] = `
@@ -379,7 +396,8 @@ exports[`long_name_method.js - {"semi":false} [meriyah] format 1`] = `
| ^
4 | }
5 |
- 6 | testLongNameMethodAndSomethingElseLallala() {"
+ 6 | testLongNameMethodAndSomethingElseLallala() {
+Cause: [3:54]: Unexpected token: ':'"
`;
exports[`long_name_method.js - {"semi":false} format 1`] = `
@@ -451,7 +469,8 @@ exports[`method_chain.js [acorn] format 1`] = `
| ^
11 | ::throttle(() =>
12 | interval(10)
- 13 | ::take(1)"
+ 13 | ::take(1)
+Cause: Unexpected token (10:8)"
`;
exports[`method_chain.js [espree] format 1`] = `
@@ -462,7 +481,8 @@ exports[`method_chain.js [espree] format 1`] = `
| ^
11 | ::throttle(() =>
12 | interval(10)
- 13 | ::take(1)"
+ 13 | ::take(1)
+Cause: Unexpected token :"
`;
exports[`method_chain.js [meriyah] format 1`] = `
@@ -473,7 +493,8 @@ exports[`method_chain.js [meriyah] format 1`] = `
| ^
11 | ::throttle(() =>
12 | interval(10)
- 13 | ::take(1)"
+ 13 | ::take(1)
+Cause: [10:9]: Unexpected token: ':'"
`;
exports[`method_chain.js - {"semi":false} [acorn] format 1`] = `
@@ -484,7 +505,8 @@ exports[`method_chain.js - {"semi":false} [acorn] format 1`] = `
| ^
11 | ::throttle(() =>
12 | interval(10)
- 13 | ::take(1)"
+ 13 | ::take(1)
+Cause: Unexpected token (10:8)"
`;
exports[`method_chain.js - {"semi":false} [espree] format 1`] = `
@@ -495,7 +517,8 @@ exports[`method_chain.js - {"semi":false} [espree] format 1`] = `
| ^
11 | ::throttle(() =>
12 | interval(10)
- 13 | ::take(1)"
+ 13 | ::take(1)
+Cause: Unexpected token :"
`;
exports[`method_chain.js - {"semi":false} [meriyah] format 1`] = `
@@ -506,7 +529,8 @@ exports[`method_chain.js - {"semi":false} [meriyah] format 1`] = `
| ^
11 | ::throttle(() =>
12 | interval(10)
- 13 | ::take(1)"
+ 13 | ::take(1)
+Cause: [10:9]: Unexpected token: ':'"
`;
exports[`method_chain.js - {"semi":false} format 1`] = `
@@ -610,7 +634,8 @@ exports[`short_name_method.js [acorn] format 1`] = `
| ^
4 | }
5 |
- 6 | shortMethod() {"
+ 6 | shortMethod() {
+Cause: Unexpected token (3:23)"
`;
exports[`short_name_method.js [espree] format 1`] = `
@@ -621,7 +646,8 @@ exports[`short_name_method.js [espree] format 1`] = `
| ^
4 | }
5 |
- 6 | shortMethod() {"
+ 6 | shortMethod() {
+Cause: Unexpected token :"
`;
exports[`short_name_method.js [meriyah] format 1`] = `
@@ -632,7 +658,8 @@ exports[`short_name_method.js [meriyah] format 1`] = `
| ^
4 | }
5 |
- 6 | shortMethod() {"
+ 6 | shortMethod() {
+Cause: [3:24]: Unexpected token: ':'"
`;
exports[`short_name_method.js - {"semi":false} [acorn] format 1`] = `
@@ -643,7 +670,8 @@ exports[`short_name_method.js - {"semi":false} [acorn] format 1`] = `
| ^
4 | }
5 |
- 6 | shortMethod() {"
+ 6 | shortMethod() {
+Cause: Unexpected token (3:23)"
`;
exports[`short_name_method.js - {"semi":false} [espree] format 1`] = `
@@ -654,7 +682,8 @@ exports[`short_name_method.js - {"semi":false} [espree] format 1`] = `
| ^
4 | }
5 |
- 6 | shortMethod() {"
+ 6 | shortMethod() {
+Cause: Unexpected token :"
`;
exports[`short_name_method.js - {"semi":false} [meriyah] format 1`] = `
@@ -665,7 +694,8 @@ exports[`short_name_method.js - {"semi":false} [meriyah] format 1`] = `
| ^
4 | }
5 |
- 6 | shortMethod() {"
+ 6 | shortMethod() {
+Cause: [3:24]: Unexpected token: ':'"
`;
exports[`short_name_method.js - {"semi":false} format 1`] = `
@@ -733,7 +763,8 @@ exports[`unary.js [acorn] format 1`] = `
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
- 4 | !("
+ 4 | !(
+Cause: Unexpected token (1:2)"
`;
exports[`unary.js [espree] format 1`] = `
@@ -742,7 +773,8 @@ exports[`unary.js [espree] format 1`] = `
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
- 4 | !("
+ 4 | !(
+Cause: Unexpected token :"
`;
exports[`unary.js [meriyah] format 1`] = `
@@ -751,7 +783,8 @@ exports[`unary.js [meriyah] format 1`] = `
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
- 4 | !("
+ 4 | !(
+Cause: [1:3]: Unexpected token: ':'"
`;
exports[`unary.js - {"semi":false} [acorn] format 1`] = `
@@ -760,7 +793,8 @@ exports[`unary.js - {"semi":false} [acorn] format 1`] = `
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
- 4 | !("
+ 4 | !(
+Cause: Unexpected token (1:2)"
`;
exports[`unary.js - {"semi":false} [espree] format 1`] = `
@@ -769,7 +803,8 @@ exports[`unary.js - {"semi":false} [espree] format 1`] = `
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
- 4 | !("
+ 4 | !(
+Cause: Unexpected token :"
`;
exports[`unary.js - {"semi":false} [meriyah] format 1`] = `
@@ -778,7 +813,8 @@ exports[`unary.js - {"semi":false} [meriyah] format 1`] = `
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
- 4 | !("
+ 4 | !(
+Cause: [1:3]: Unexpected token: ':'"
`;
exports[`unary.js - {"semi":false} format 1`] = `
diff --git a/tests/format/js/call/invalid/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/call/invalid/__snapshots__/jsfmt.spec.js.snap
index 44dad6613..87b09e4a7 100644
--- a/tests/format/js/call/invalid/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/call/invalid/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`null-arguments-item.js [__babel_estree] format 1`] = `
| ^
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
3 | foo("a",
- 4 | //1"
+ 4 | //1
+Cause: Unexpected token ','. (1:11)"
`;
exports[`null-arguments-item.js [acorn] format 1`] = `
@@ -15,7 +16,8 @@ exports[`null-arguments-item.js [acorn] format 1`] = `
| ^
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
3 | foo("a",
- 4 | //1"
+ 4 | //1
+Cause: Unexpected token (1:10)"
`;
exports[`null-arguments-item.js [babel] format 1`] = `
@@ -24,7 +26,8 @@ exports[`null-arguments-item.js [babel] format 1`] = `
| ^
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
3 | foo("a",
- 4 | //1"
+ 4 | //1
+Cause: Unexpected token ','. (1:11)"
`;
exports[`null-arguments-item.js [espree] format 1`] = `
@@ -33,7 +36,8 @@ exports[`null-arguments-item.js [espree] format 1`] = `
| ^
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
3 | foo("a",
- 4 | //1"
+ 4 | //1
+Cause: Unexpected token ,"
`;
exports[`null-arguments-item.js [meriyah] format 1`] = `
@@ -42,5 +46,6 @@ exports[`null-arguments-item.js [meriyah] format 1`] = `
| ^
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
3 | foo("a",
- 4 | //1"
+ 4 | //1
+Cause: [1:11]: Unexpected token: ','"
`;
diff --git a/tests/format/js/class-extends/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/class-extends/__snapshots__/jsfmt.spec.js.snap
index afb5366db..99a11b72f 100644
--- a/tests/format/js/class-extends/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/class-extends/__snapshots__/jsfmt.spec.js.snap
@@ -181,7 +181,8 @@ exports[`tuple-and-record.js [acorn] format 1`] = `
| ^
3 |
4 | class C extends [] {}
- 5 | class D extends #[] {}"
+ 5 | class D extends #[] {}
+Cause: Unexpected character '{' (2:17)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
@@ -191,7 +192,8 @@ exports[`tuple-and-record.js [espree] format 1`] = `
| ^
3 |
4 | class C extends [] {}
- 5 | class D extends #[] {}"
+ 5 | class D extends #[] {}
+Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
@@ -211,7 +213,8 @@ exports[`tuple-and-record.js [meriyah] format 1`] = `
| ^
3 |
4 | class C extends [] {}
- 5 | class D extends #[] {}"
+ 5 | class D extends #[] {}
+Cause: [2:17]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
@@ -221,7 +224,8 @@ exports[`tuple-and-record.js [typescript] format 1`] = `
| ^
3 |
4 | class C extends [] {}
- 5 | class D extends #[] {}"
+ 5 | class D extends #[] {}
+Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
diff --git a/tests/format/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
index f6184ecb6..3203c0439 100644
--- a/tests/format/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`optional-chaining.js [acorn] format 1`] = `
2 |
> 3 | delete obj?.#x.a
| ^
- 4 |"
+ 4 |
+Cause: Private field '#x' must be declared in an enclosing class (3:12)"
`;
exports[`optional-chaining.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`optional-chaining.js [espree] format 1`] = `
2 |
> 3 | delete obj?.#x.a
| ^
- 4 |"
+ 4 |
+Cause: Private field '#x' must be declared in an enclosing class"
`;
exports[`optional-chaining.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`optional-chaining.js [meriyah] format 1`] = `
2 |
> 3 | delete obj?.#x.a
| ^
- 4 |"
+ 4 |
+Cause: [3:13]: Dot property must be an identifier"
`;
exports[`optional-chaining.js - {"semi":false} [acorn] format 1`] = `
@@ -33,7 +36,8 @@ exports[`optional-chaining.js - {"semi":false} [acorn] format 1`] = `
2 |
> 3 | delete obj?.#x.a
| ^
- 4 |"
+ 4 |
+Cause: Private field '#x' must be declared in an enclosing class (3:12)"
`;
exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = `
@@ -42,7 +46,8 @@ exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = `
2 |
> 3 | delete obj?.#x.a
| ^
- 4 |"
+ 4 |
+Cause: Private field '#x' must be declared in an enclosing class"
`;
exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = `
@@ -51,7 +56,8 @@ exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = `
2 |
> 3 | delete obj?.#x.a
| ^
- 4 |"
+ 4 |
+Cause: [3:13]: Dot property must be an identifier"
`;
exports[`optional-chaining.js - {"semi":false} format 1`] = `
diff --git a/tests/format/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap
index 37af8ce7c..727838b7a 100644
--- a/tests/format/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`example.js [acorn] format 1`] = `
"super() call outside constructor of a subclass (1:1)
> 1 | super();
| ^
- 2 |"
+ 2 |
+Cause: super() call outside constructor of a subclass (1:0)"
`;
exports[`example.js [espree] format 1`] = `
"'super' keyword outside a method (1:1)
> 1 | super();
| ^
- 2 |"
+ 2 |
+Cause: 'super' keyword outside a method"
`;
exports[`example.js [meriyah] format 1`] = `
"Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass (1:6)
> 1 | super();
| ^
- 2 |"
+ 2 |
+Cause: [1:6]: Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass"
`;
exports[`example.js format 1`] = `
diff --git a/tests/format/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap
index 822eae541..f4171f136 100644
--- a/tests/format/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`pipeline_own_line.js [acorn] format 1`] = `
| ^
5 | }
6 |
- 7 | bifornCringerMoshedPerplexSawder("
+ 7 | bifornCringerMoshedPerplexSawder(
+Cause: Unexpected token (4:2)"
`;
exports[`pipeline_own_line.js [espree] format 1`] = `
@@ -19,7 +20,8 @@ exports[`pipeline_own_line.js [espree] format 1`] = `
| ^
5 | }
6 |
- 7 | bifornCringerMoshedPerplexSawder("
+ 7 | bifornCringerMoshedPerplexSawder(
+Cause: Unexpected token >"
`;
exports[`pipeline_own_line.js [meriyah] format 1`] = `
@@ -30,7 +32,8 @@ exports[`pipeline_own_line.js [meriyah] format 1`] = `
| ^
5 | }
6 |
- 7 | bifornCringerMoshedPerplexSawder("
+ 7 | bifornCringerMoshedPerplexSawder(
+Cause: [4:3]: Unexpected token: '>'"
`;
exports[`pipeline_own_line.js format 1`] = `
diff --git a/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap
index d78900603..8b1c8a8d1 100644
--- a/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap
@@ -6106,7 +6106,8 @@ exports[`tuple-and-record.js [acorn] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: Unexpected character '{' (7:1)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
@@ -6117,7 +6118,8 @@ exports[`tuple-and-record.js [espree] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
@@ -6139,7 +6141,8 @@ exports[`tuple-and-record.js [meriyah] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: [7:1]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
@@ -6150,7 +6153,8 @@ exports[`tuple-and-record.js [typescript] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"semi":false} [acorn] format 1`] = `
@@ -6161,7 +6165,8 @@ exports[`tuple-and-record.js - {"semi":false} [acorn] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: Unexpected character '{' (7:1)"
`;
exports[`tuple-and-record.js - {"semi":false} [espree] format 1`] = `
@@ -6172,7 +6177,8 @@ exports[`tuple-and-record.js - {"semi":false} [espree] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js - {"semi":false} [flow] format 1`] = `
@@ -6194,7 +6200,8 @@ exports[`tuple-and-record.js - {"semi":false} [meriyah] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: [7:1]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js - {"semi":false} [typescript] format 1`] = `
@@ -6205,7 +6212,8 @@ exports[`tuple-and-record.js - {"semi":false} [typescript] format 1`] = `
| ^
8 | key: 'value'
9 | }
- 10 |"
+ 10 |
+Cause: Invalid character."
`;
exports[`tuple-and-record.js - {"semi":false} format 1`] = `
diff --git a/tests/format/js/decorator-auto-accessors/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/decorator-auto-accessors/__snapshots__/jsfmt.spec.js.snap
index 2263bc534..c6bcfecb4 100644
--- a/tests/format/js/decorator-auto-accessors/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/decorator-auto-accessors/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`basic.js [acorn] format 1`] = `
> 2 | accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`basic.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`basic.js [espree] format 1`] = `
> 2 | accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token bar"
`;
exports[`basic.js - {"semi":false} [acorn] format 1`] = `
@@ -24,7 +26,8 @@ exports[`basic.js - {"semi":false} [acorn] format 1`] = `
> 2 | accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`basic.js - {"semi":false} [espree] format 1`] = `
@@ -33,7 +36,8 @@ exports[`basic.js - {"semi":false} [espree] format 1`] = `
> 2 | accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token bar"
`;
exports[`basic.js - {"semi":false} format 1`] = `
@@ -80,7 +84,8 @@ exports[`comments.js [acorn] format 1`] = `
| ^
3 | // comment
4 | accessor b;
- 5 | }"
+ 5 | }
+Cause: Unexpected character '@' (2:2)"
`;
exports[`comments.js [espree] format 1`] = `
@@ -90,7 +95,8 @@ exports[`comments.js [espree] format 1`] = `
| ^
3 | // comment
4 | accessor b;
- 5 | }"
+ 5 | }
+Cause: Unexpected character '@'"
`;
exports[`comments.js - {"semi":false} [acorn] format 1`] = `
@@ -100,7 +106,8 @@ exports[`comments.js - {"semi":false} [acorn] format 1`] = `
| ^
3 | // comment
4 | accessor b;
- 5 | }"
+ 5 | }
+Cause: Unexpected character '@' (2:2)"
`;
exports[`comments.js - {"semi":false} [espree] format 1`] = `
@@ -110,7 +117,8 @@ exports[`comments.js - {"semi":false} [espree] format 1`] = `
| ^
3 | // comment
4 | accessor b;
- 5 | }"
+ 5 | }
+Cause: Unexpected character '@'"
`;
exports[`comments.js - {"semi":false} format 1`] = `
@@ -164,7 +172,8 @@ exports[`computed.js [acorn] format 1`] = `
> 2 | accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`computed.js [espree] format 1`] = `
@@ -173,7 +182,8 @@ exports[`computed.js [espree] format 1`] = `
> 2 | accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token ["
`;
exports[`computed.js - {"semi":false} [acorn] format 1`] = `
@@ -182,7 +192,8 @@ exports[`computed.js - {"semi":false} [acorn] format 1`] = `
> 2 | accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`computed.js - {"semi":false} [espree] format 1`] = `
@@ -191,7 +202,8 @@ exports[`computed.js - {"semi":false} [espree] format 1`] = `
> 2 | accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token ["
`;
exports[`computed.js - {"semi":false} format 1`] = `
@@ -311,7 +323,8 @@ exports[`private.js [acorn] format 1`] = `
> 2 | accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`private.js [espree] format 1`] = `
@@ -320,7 +333,8 @@ exports[`private.js [espree] format 1`] = `
> 2 | accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token #bar"
`;
exports[`private.js - {"semi":false} [acorn] format 1`] = `
@@ -329,7 +343,8 @@ exports[`private.js - {"semi":false} [acorn] format 1`] = `
> 2 | accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:11)"
`;
exports[`private.js - {"semi":false} [espree] format 1`] = `
@@ -338,7 +353,8 @@ exports[`private.js - {"semi":false} [espree] format 1`] = `
> 2 | accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token #bar"
`;
exports[`private.js - {"semi":false} format 1`] = `
@@ -384,7 +400,8 @@ exports[`static.js [acorn] format 1`] = `
> 2 | static accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:18)"
`;
exports[`static.js [espree] format 1`] = `
@@ -393,7 +410,8 @@ exports[`static.js [espree] format 1`] = `
> 2 | static accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token bar"
`;
exports[`static.js - {"semi":false} [acorn] format 1`] = `
@@ -402,7 +420,8 @@ exports[`static.js - {"semi":false} [acorn] format 1`] = `
> 2 | static accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:18)"
`;
exports[`static.js - {"semi":false} [espree] format 1`] = `
@@ -411,7 +430,8 @@ exports[`static.js - {"semi":false} [espree] format 1`] = `
> 2 | static accessor bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token bar"
`;
exports[`static.js - {"semi":false} format 1`] = `
@@ -457,7 +477,8 @@ exports[`static-computed.js [acorn] format 1`] = `
> 2 | static accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:18)"
`;
exports[`static-computed.js [espree] format 1`] = `
@@ -466,7 +487,8 @@ exports[`static-computed.js [espree] format 1`] = `
> 2 | static accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token ["
`;
exports[`static-computed.js - {"semi":false} [acorn] format 1`] = `
@@ -475,7 +497,8 @@ exports[`static-computed.js - {"semi":false} [acorn] format 1`] = `
> 2 | static accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:18)"
`;
exports[`static-computed.js - {"semi":false} [espree] format 1`] = `
@@ -484,7 +507,8 @@ exports[`static-computed.js - {"semi":false} [espree] format 1`] = `
> 2 | static accessor ["bar"];
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token ["
`;
exports[`static-computed.js - {"semi":false} format 1`] = `
@@ -530,7 +554,8 @@ exports[`static-private.js [acorn] format 1`] = `
> 2 | static accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:18)"
`;
exports[`static-private.js [espree] format 1`] = `
@@ -539,7 +564,8 @@ exports[`static-private.js [espree] format 1`] = `
> 2 | static accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token #bar"
`;
exports[`static-private.js - {"semi":false} [acorn] format 1`] = `
@@ -548,7 +574,8 @@ exports[`static-private.js - {"semi":false} [acorn] format 1`] = `
> 2 | static accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:18)"
`;
exports[`static-private.js - {"semi":false} [espree] format 1`] = `
@@ -557,7 +584,8 @@ exports[`static-private.js - {"semi":false} [espree] format 1`] = `
> 2 | static accessor #bar;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token #bar"
`;
exports[`static-private.js - {"semi":false} format 1`] = `
@@ -604,7 +632,8 @@ exports[`with-semicolon-1.js [acorn] format 1`] = `
| ^
3 | [foo]() {}
4 | }
- 5 | "
+ 5 |
+Cause: Unexpected token (2:11)"
`;
exports[`with-semicolon-1.js [espree] format 1`] = `
@@ -614,7 +643,8 @@ exports[`with-semicolon-1.js [espree] format 1`] = `
| ^
3 | [foo]() {}
4 | }
- 5 | "
+ 5 |
+Cause: Unexpected token clicked"
`;
exports[`with-semicolon-1.js - {"semi":false} [acorn] format 1`] = `
@@ -624,7 +654,8 @@ exports[`with-semicolon-1.js - {"semi":false} [acorn] format 1`] = `
| ^
3 | [foo]() {}
4 | }
- 5 | "
+ 5 |
+Cause: Unexpected token (2:11)"
`;
exports[`with-semicolon-1.js - {"semi":false} [espree] format 1`] = `
@@ -634,7 +665,8 @@ exports[`with-semicolon-1.js - {"semi":false} [espree] format 1`] = `
| ^
3 | [foo]() {}
4 | }
- 5 | "
+ 5 |
+Cause: Unexpected token clicked"
`;
exports[`with-semicolon-1.js - {"semi":false} format 1`] = `
@@ -685,7 +717,8 @@ exports[`with-semicolon-2.js [acorn] format 1`] = `
| ^
3 | *foo() {}
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token (2:11)"
`;
exports[`with-semicolon-2.js [espree] format 1`] = `
@@ -695,7 +728,8 @@ exports[`with-semicolon-2.js [espree] format 1`] = `
| ^
3 | *foo() {}
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token clicked"
`;
exports[`with-semicolon-2.js - {"semi":false} [acorn] format 1`] = `
@@ -705,7 +739,8 @@ exports[`with-semicolon-2.js - {"semi":false} [acorn] format 1`] = `
| ^
3 | *foo() {}
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token (2:11)"
`;
exports[`with-semicolon-2.js - {"semi":false} [espree] format 1`] = `
@@ -715,7 +750,8 @@ exports[`with-semicolon-2.js - {"semi":false} [espree] format 1`] = `
| ^
3 | *foo() {}
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token clicked"
`;
exports[`with-semicolon-2.js - {"semi":false} format 1`] = `
diff --git a/tests/format/js/decorators-export/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/decorators-export/__snapshots__/jsfmt.spec.js.snap
index 36873709b..40a75b929 100644
--- a/tests/format/js/decorators-export/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/decorators-export/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`after_export.js [acorn] format 1`] = `
| ^
2 |
3 | export default @decorator class {}
- 4 |"
+ 4 |
+Cause: Unexpected character '@' (1:7)"
`;
exports[`after_export.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`after_export.js [espree] format 1`] = `
| ^
2 |
3 | export default @decorator class {}
- 4 |"
+ 4 |
+Cause: Unexpected character '@'"
`;
exports[`after_export.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`after_export.js [meriyah] format 1`] = `
| ^
2 |
3 | export default @decorator class {}
- 4 |"
+ 4 |
+Cause: [1:8]: Unexpected token: '@'"
`;
exports[`after_export.js format 1`] = `
@@ -55,7 +58,8 @@ exports[`before_export.js [acorn] format 1`] = `
| ^
2 | export class Foo {}
3 |
- 4 | @decorator"
+ 4 | @decorator
+Cause: Unexpected character '@' (1:0)"
`;
exports[`before_export.js [espree] format 1`] = `
@@ -64,7 +68,8 @@ exports[`before_export.js [espree] format 1`] = `
| ^
2 | export class Foo {}
3 |
- 4 | @decorator"
+ 4 | @decorator
+Cause: Unexpected character '@'"
`;
exports[`before_export.js format 1`] = `
diff --git a/tests/format/js/decorators/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/decorators/__snapshots__/jsfmt.spec.js.snap
index 2206dd70a..749084e88 100644
--- a/tests/format/js/decorators/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/decorators/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`classes.js [acorn] format 1`] = `
| ^
2 |
3 | @deco export class Bar {}
- 4 |"
+ 4 |
+Cause: Unexpected character '@' (1:0)"
`;
exports[`classes.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`classes.js [espree] format 1`] = `
| ^
2 |
3 | @deco export class Bar {}
- 4 |"
+ 4 |
+Cause: Unexpected character '@'"
`;
exports[`classes.js format 1`] = `
@@ -73,7 +75,8 @@ exports[`comments.js [acorn] format 1`] = `
| ^
4 | a: 'a', // Comment is in the wrong place
5 | // test
- 6 | b: '2'"
+ 6 | b: '2'
+Cause: Unexpected character '@' (3:0)"
`;
exports[`comments.js [espree] format 1`] = `
@@ -84,7 +87,8 @@ exports[`comments.js [espree] format 1`] = `
| ^
4 | a: 'a', // Comment is in the wrong place
5 | // test
- 6 | b: '2'"
+ 6 | b: '2'
+Cause: Unexpected character '@'"
`;
exports[`comments.js format 1`] = `
@@ -176,7 +180,8 @@ exports[`member-expression.js [acorn] format 1`] = `
| ^
4 | method() {}
5 | },
- 6 | class {"
+ 6 | class {
+Cause: Unexpected character '@' (3:4)"
`;
exports[`member-expression.js [espree] format 1`] = `
@@ -187,7 +192,8 @@ exports[`member-expression.js [espree] format 1`] = `
| ^
4 | method() {}
5 | },
- 6 | class {"
+ 6 | class {
+Cause: Unexpected character '@'"
`;
exports[`member-expression.js format 1`] = `
@@ -310,7 +316,8 @@ exports[`methods.js [acorn] format 1`] = `
| ^
4 | async plop() {}
5 |
- 6 | @anotherDecoratorWithALongName("and a very long string as a first argument")"
+ 6 | @anotherDecoratorWithALongName("and a very long string as a first argument")
+Cause: Unexpected character '@' (3:2)"
`;
exports[`methods.js [espree] format 1`] = `
@@ -321,7 +328,8 @@ exports[`methods.js [espree] format 1`] = `
| ^
4 | async plop() {}
5 |
- 6 | @anotherDecoratorWithALongName("and a very long string as a first argument")"
+ 6 | @anotherDecoratorWithALongName("and a very long string as a first argument")
+Cause: Unexpected character '@'"
`;
exports[`methods.js format 1`] = `
@@ -364,7 +372,8 @@ exports[`mixed.js [acorn] format 1`] = `
| ^
4 | export default class MyComponent {
5 | @task
- 6 | *foo() {"
+ 6 | *foo() {
+Cause: Unexpected character '@' (3:0)"
`;
exports[`mixed.js [espree] format 1`] = `
@@ -375,7 +384,8 @@ exports[`mixed.js [espree] format 1`] = `
| ^
4 | export default class MyComponent {
5 | @task
- 6 | *foo() {"
+ 6 | *foo() {
+Cause: Unexpected character '@'"
`;
exports[`mixed.js format 1`] = `
@@ -412,7 +422,8 @@ exports[`mobx.js [acorn] format 1`] = `
| ^
4 | @observable price = 0;
5 | @observable amount = 1;
- 6 |"
+ 6 |
+Cause: Unexpected character '@' (3:0)"
`;
exports[`mobx.js [espree] format 1`] = `
@@ -423,7 +434,8 @@ exports[`mobx.js [espree] format 1`] = `
| ^
4 | @observable price = 0;
5 | @observable amount = 1;
- 6 |"
+ 6 |
+Cause: Unexpected character '@'"
`;
exports[`mobx.js format 1`] = `
@@ -525,7 +537,8 @@ exports[`multiline.js [acorn] format 1`] = `
| ^
3 | foo,
4 | bar
- 5 | ]) prop = value;"
+ 5 | ]) prop = value;
+Cause: Unexpected character '@' (2:2)"
`;
exports[`multiline.js [espree] format 1`] = `
@@ -535,7 +548,8 @@ exports[`multiline.js [espree] format 1`] = `
| ^
3 | foo,
4 | bar
- 5 | ]) prop = value;"
+ 5 | ]) prop = value;
+Cause: Unexpected character '@'"
`;
exports[`multiline.js format 1`] = `
@@ -584,7 +598,8 @@ exports[`multiple.js [acorn] format 1`] = `
| ^
3 | @nonenumerable
4 | @doubledValue
- 5 | legs = 4;"
+ 5 | legs = 4;
+Cause: Unexpected character '@' (2:2)"
`;
exports[`multiple.js [espree] format 1`] = `
@@ -594,7 +609,8 @@ exports[`multiple.js [espree] format 1`] = `
| ^
3 | @nonenumerable
4 | @doubledValue
- 5 | legs = 4;"
+ 5 | legs = 4;
+Cause: Unexpected character '@'"
`;
exports[`multiple.js format 1`] = `
@@ -653,7 +669,8 @@ exports[`parens.js [acorn] format 1`] = `
| ^
3 | x
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected character '@' (2:2)"
`;
exports[`parens.js [espree] format 1`] = `
@@ -663,7 +680,8 @@ exports[`parens.js [espree] format 1`] = `
| ^
3 | x
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected character '@'"
`;
exports[`parens.js format 1`] = `
@@ -692,7 +710,8 @@ exports[`redux.js [acorn] format 1`] = `
| ^
2 | export class MyApp extends React.Component {}
3 |
- 4 | @connect(state => ({ todos: state.todos }))"
+ 4 | @connect(state => ({ todos: state.todos }))
+Cause: Unexpected character '@' (1:0)"
`;
exports[`redux.js [espree] format 1`] = `
@@ -701,7 +720,8 @@ exports[`redux.js [espree] format 1`] = `
| ^
2 | export class MyApp extends React.Component {}
3 |
- 4 | @connect(state => ({ todos: state.todos }))"
+ 4 | @connect(state => ({ todos: state.todos }))
+Cause: Unexpected character '@'"
`;
exports[`redux.js format 1`] = `
diff --git a/tests/format/js/decorators/class-expression/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/decorators/class-expression/__snapshots__/jsfmt.spec.js.snap
index 26ee81411..933869c6e 100644
--- a/tests/format/js/decorators/class-expression/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/decorators/class-expression/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,8 @@ exports[`arguments.js [acorn] format 1`] = `
> 1 | console.log(@deco class Foo {})
| ^
2 | console.log(@deco class {})
- 3 |"
+ 3 |
+Cause: Unexpected character '@' (1:12)"
`;
exports[`arguments.js [espree] format 1`] = `
@@ -13,7 +14,8 @@ exports[`arguments.js [espree] format 1`] = `
> 1 | console.log(@deco class Foo {})
| ^
2 | console.log(@deco class {})
- 3 |"
+ 3 |
+Cause: Unexpected character '@'"
`;
exports[`arguments.js [flow] format 1`] = `
@@ -29,7 +31,8 @@ exports[`arguments.js - {"semi":false} [acorn] format 1`] = `
> 1 | console.log(@deco class Foo {})
| ^
2 | console.log(@deco class {})
- 3 |"
+ 3 |
+Cause: Unexpected character '@' (1:12)"
`;
exports[`arguments.js - {"semi":false} [espree] format 1`] = `
@@ -37,7 +40,8 @@ exports[`arguments.js - {"semi":false} [espree] format 1`] = `
> 1 | console.log(@deco class Foo {})
| ^
2 | console.log(@deco class {})
- 3 |"
+ 3 |
+Cause: Unexpected character '@'"
`;
exports[`arguments.js - {"semi":false} [flow] format 1`] = `
@@ -99,7 +103,8 @@ exports[`class-expression.js [acorn] format 1`] = `
| ^
2 | const a2 = (@deco class {});
3 |
- 4 | (@deco class Foo {});"
+ 4 | (@deco class Foo {});
+Cause: Unexpected character '@' (1:12)"
`;
exports[`class-expression.js [espree] format 1`] = `
@@ -108,7 +113,8 @@ exports[`class-expression.js [espree] format 1`] = `
| ^
2 | const a2 = (@deco class {});
3 |
- 4 | (@deco class Foo {});"
+ 4 | (@deco class Foo {});
+Cause: Unexpected character '@'"
`;
exports[`class-expression.js [flow] format 1`] = `
@@ -126,7 +132,8 @@ exports[`class-expression.js - {"semi":false} [acorn] format 1`] = `
| ^
2 | const a2 = (@deco class {});
3 |
- 4 | (@deco class Foo {});"
+ 4 | (@deco class Foo {});
+Cause: Unexpected character '@' (1:12)"
`;
exports[`class-expression.js - {"semi":false} [espree] format 1`] = `
@@ -135,7 +142,8 @@ exports[`class-expression.js - {"semi":false} [espree] format 1`] = `
| ^
2 | const a2 = (@deco class {});
3 |
- 4 | (@deco class Foo {});"
+ 4 | (@deco class Foo {});
+Cause: Unexpected character '@'"
`;
exports[`class-expression.js - {"semi":false} [flow] format 1`] = `
@@ -267,7 +275,8 @@ exports[`member-expression.js [acorn] format 1`] = `
> 1 | (@deco class Foo {}).name;
| ^
2 | (@deco class {}).name;
- 3 |"
+ 3 |
+Cause: Unexpected character '@' (1:1)"
`;
exports[`member-expression.js [espree] format 1`] = `
@@ -275,7 +284,8 @@ exports[`member-expression.js [espree] format 1`] = `
> 1 | (@deco class Foo {}).name;
| ^
2 | (@deco class {}).name;
- 3 |"
+ 3 |
+Cause: Unexpected character '@'"
`;
exports[`member-expression.js [flow] format 1`] = `
@@ -291,7 +301,8 @@ exports[`member-expression.js - {"semi":false} [acorn] format 1`] = `
> 1 | (@deco class Foo {}).name;
| ^
2 | (@deco class {}).name;
- 3 |"
+ 3 |
+Cause: Unexpected character '@' (1:1)"
`;
exports[`member-expression.js - {"semi":false} [espree] format 1`] = `
@@ -299,7 +310,8 @@ exports[`member-expression.js - {"semi":false} [espree] format 1`] = `
> 1 | (@deco class Foo {}).name;
| ^
2 | (@deco class {}).name;
- 3 |"
+ 3 |
+Cause: Unexpected character '@'"
`;
exports[`member-expression.js - {"semi":false} [flow] format 1`] = `
@@ -361,7 +373,8 @@ exports[`super-class.js [acorn] format 1`] = `
| ^
2 |
3 | class Foo extends (@deco class {}){}
- 4 |"
+ 4 |
+Cause: Unexpected character '@' (1:19)"
`;
exports[`super-class.js [espree] format 1`] = `
@@ -370,7 +383,8 @@ exports[`super-class.js [espree] format 1`] = `
| ^
2 |
3 | class Foo extends (@deco class {}){}
- 4 |"
+ 4 |
+Cause: Unexpected character '@'"
`;
exports[`super-class.js [flow] format 1`] = `
@@ -388,7 +402,8 @@ exports[`super-class.js - {"semi":false} [acorn] format 1`] = `
| ^
2 |
3 | class Foo extends (@deco class {}){}
- 4 |"
+ 4 |
+Cause: Unexpected character '@' (1:19)"
`;
exports[`super-class.js - {"semi":false} [espree] format 1`] = `
@@ -397,7 +412,8 @@ exports[`super-class.js - {"semi":false} [espree] format 1`] = `
| ^
2 |
3 | class Foo extends (@deco class {}){}
- 4 |"
+ 4 |
+Cause: Unexpected character '@'"
`;
exports[`super-class.js - {"semi":false} [flow] format 1`] = `
diff --git a/tests/format/js/deferred-import-evaluation/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/deferred-import-evaluation/__snapshots__/jsfmt.spec.js.snap
index 082f67737..30b6fec05 100644
--- a/tests/format/js/deferred-import-evaluation/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/deferred-import-evaluation/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`import-defer.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import defer * as ns from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`import-defer.js [espree] format 1`] = `
"Unexpected token * (1:14)
> 1 | import defer * as ns from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token *"
`;
exports[`import-defer.js [meriyah] format 1`] = `
"Import source must be string (1:14)
> 1 | import defer * as ns from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Import source must be string"
`;
exports[`import-defer.js format 1`] = `
@@ -39,21 +42,24 @@ exports[`import-defer-attributes-declaration.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import defer * as ns from "x" with { attr: "val" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`import-defer-attributes-declaration.js [espree] format 1`] = `
"Unexpected token * (1:14)
> 1 | import defer * as ns from "x" with { attr: "val" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token *"
`;
exports[`import-defer-attributes-declaration.js [meriyah] format 1`] = `
"Import source must be string (1:14)
> 1 | import defer * as ns from "x" with { attr: "val" };
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Import source must be string"
`;
exports[`import-defer-attributes-declaration.js format 1`] = `
@@ -74,68 +80,78 @@ exports[`no-default.js [__babel_estree] format 1`] = `
"Only \`import defer * as x from "./module"\` is valid. (1:14)
> 1 | import defer x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import defer * as x from "./module"\` is valid. (1:13)"
`;
exports[`no-default.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import defer x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`no-default.js [babel] format 1`] = `
"Only \`import defer * as x from "./module"\` is valid. (1:14)
> 1 | import defer x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import defer * as x from "./module"\` is valid. (1:13)"
`;
exports[`no-default.js [espree] format 1`] = `
"Unexpected token x (1:14)
> 1 | import defer x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token x"
`;
exports[`no-default.js [meriyah] format 1`] = `
"Import source must be string (1:14)
> 1 | import defer x from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Import source must be string"
`;
exports[`no-named.js [__babel_estree] format 1`] = `
"Only \`import defer * as x from "./module"\` is valid. (1:16)
> 1 | import defer { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import defer * as x from "./module"\` is valid. (1:15)"
`;
exports[`no-named.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import defer { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`no-named.js [babel] format 1`] = `
"Only \`import defer * as x from "./module"\` is valid. (1:16)
> 1 | import defer { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import defer * as x from "./module"\` is valid. (1:15)"
`;
exports[`no-named.js [espree] format 1`] = `
"Unexpected token { (1:14)
> 1 | import defer { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token {"
`;
exports[`no-named.js [meriyah] format 1`] = `
"Import source must be string (1:14)
> 1 | import defer { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Import source must be string"
`;
diff --git a/tests/format/js/destructuring-private-fields/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/destructuring-private-fields/__snapshots__/jsfmt.spec.js.snap
index 43e7fa3a4..3dd5e8d76 100644
--- a/tests/format/js/destructuring-private-fields/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/destructuring-private-fields/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`arrow-params.js [acorn] format 1`] = `
> 3 | #p = ({ #x: x }) => {}
| ^
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token (3:10)"
`;
exports[`arrow-params.js [espree] format 1`] = `
@@ -17,7 +18,8 @@ exports[`arrow-params.js [espree] format 1`] = `
> 3 | #p = ({ #x: x }) => {}
| ^
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token #x"
`;
exports[`arrow-params.js [meriyah] format 1`] = `
@@ -27,7 +29,8 @@ exports[`arrow-params.js [meriyah] format 1`] = `
> 3 | #p = ({ #x: x }) => {}
| ^
4 | }
- 5 |"
+ 5 |
+Cause: [3:11]: Unexpected token: 'PrivateField'"
`;
exports[`arrow-params.js format 1`] = `
@@ -58,7 +61,8 @@ exports[`assignment.js [acorn] format 1`] = `
| ^
6 | }
7 | }
- 8 |"
+ 8 |
+Cause: Unexpected token (5:7)"
`;
exports[`assignment.js [espree] format 1`] = `
@@ -69,7 +73,8 @@ exports[`assignment.js [espree] format 1`] = `
| ^
6 | }
7 | }
- 8 |"
+ 8 |
+Cause: Unexpected token #x"
`;
exports[`assignment.js [meriyah] format 1`] = `
@@ -80,7 +85,8 @@ exports[`assignment.js [meriyah] format 1`] = `
| ^
6 | }
7 | }
- 8 |"
+ 8 |
+Cause: [5:8]: Unexpected token: 'PrivateField'"
`;
exports[`assignment.js format 1`] = `
@@ -116,7 +122,8 @@ exports[`async-arrow-params.js [acorn] format 1`] = `
> 3 | #p = async ({ #x: x }) => {}
| ^
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token (3:16)"
`;
exports[`async-arrow-params.js [espree] format 1`] = `
@@ -126,7 +133,8 @@ exports[`async-arrow-params.js [espree] format 1`] = `
> 3 | #p = async ({ #x: x }) => {}
| ^
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token #x"
`;
exports[`async-arrow-params.js [meriyah] format 1`] = `
@@ -136,7 +144,8 @@ exports[`async-arrow-params.js [meriyah] format 1`] = `
> 3 | #p = async ({ #x: x }) => {}
| ^
4 | }
- 5 |"
+ 5 |
+Cause: [3:17]: Unexpected token: 'PrivateField'"
`;
exports[`async-arrow-params.js format 1`] = `
@@ -167,7 +176,8 @@ exports[`bindings.js [acorn] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token (4:11)"
`;
exports[`bindings.js [espree] format 1`] = `
@@ -178,7 +188,8 @@ exports[`bindings.js [espree] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token #x"
`;
exports[`bindings.js [meriyah] format 1`] = `
@@ -189,7 +200,8 @@ exports[`bindings.js [meriyah] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: [4:12]: Unexpected token: 'PrivateField'"
`;
exports[`bindings.js format 1`] = `
@@ -224,7 +236,8 @@ exports[`for-lhs.js [acorn] format 1`] = `
| ^
6 | }
7 | }
- 8 |"
+ 8 |
+Cause: Unexpected token (5:10)"
`;
exports[`for-lhs.js [espree] format 1`] = `
@@ -235,7 +248,8 @@ exports[`for-lhs.js [espree] format 1`] = `
| ^
6 | }
7 | }
- 8 |"
+ 8 |
+Cause: Unexpected token #x"
`;
exports[`for-lhs.js [meriyah] format 1`] = `
@@ -246,7 +260,8 @@ exports[`for-lhs.js [meriyah] format 1`] = `
| ^
6 | }
7 | }
- 8 |"
+ 8 |
+Cause: [5:11]: Unexpected token: 'PrivateField'"
`;
exports[`for-lhs.js format 1`] = `
@@ -283,7 +298,8 @@ exports[`nested-bindings.js [acorn] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token (4:16)"
`;
exports[`nested-bindings.js [espree] format 1`] = `
@@ -294,7 +310,8 @@ exports[`nested-bindings.js [espree] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token #x"
`;
exports[`nested-bindings.js [meriyah] format 1`] = `
@@ -305,7 +322,8 @@ exports[`nested-bindings.js [meriyah] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: [4:17]: Unexpected token: 'PrivateField'"
`;
exports[`nested-bindings.js format 1`] = `
@@ -345,7 +363,8 @@ exports[`valid-multiple-bindings.js [acorn] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token (4:11)"
`;
exports[`valid-multiple-bindings.js [espree] format 1`] = `
@@ -356,7 +375,8 @@ exports[`valid-multiple-bindings.js [espree] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: Unexpected token #x"
`;
exports[`valid-multiple-bindings.js [meriyah] format 1`] = `
@@ -367,7 +387,8 @@ exports[`valid-multiple-bindings.js [meriyah] format 1`] = `
| ^
5 | }
6 | }
- 7 |"
+ 7 |
+Cause: [4:12]: Unexpected token: 'PrivateField'"
`;
exports[`valid-multiple-bindings.js format 1`] = `
diff --git a/tests/format/js/do/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/do/__snapshots__/jsfmt.spec.js.snap
index 1123ad3db..809934681 100644
--- a/tests/format/js/do/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/do/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`call-arguments.js [acorn] format 1`] = `
| ^
4 | var bar = "foo";
5 | if (!bar) throw new Error(
- 6 | "unreachable""
+ 6 | "unreachable"
+Cause: Unexpected token (3:2)"
`;
exports[`call-arguments.js [espree] format 1`] = `
@@ -19,7 +20,8 @@ exports[`call-arguments.js [espree] format 1`] = `
| ^
4 | var bar = "foo";
5 | if (!bar) throw new Error(
- 6 | "unreachable""
+ 6 | "unreachable"
+Cause: Unexpected token do"
`;
exports[`call-arguments.js [meriyah] format 1`] = `
@@ -30,7 +32,8 @@ exports[`call-arguments.js [meriyah] format 1`] = `
| ^
4 | var bar = "foo";
5 | if (!bar) throw new Error(
- 6 | "unreachable""
+ 6 | "unreachable"
+Cause: [3:4]: Unexpected token: 'do'"
`;
exports[`call-arguments.js format 1`] = `
@@ -127,7 +130,8 @@ exports[`do.js [acorn] format 1`] = `
| ^
4 | if(env === 'production') 'https://abc.mno.com/';
5 | else if(env === 'development') 'http://localhost:4000';
- 6 | }"
+ 6 | }
+Cause: Unexpected token (3:4)"
`;
exports[`do.js [espree] format 1`] = `
@@ -138,7 +142,8 @@ exports[`do.js [espree] format 1`] = `
| ^
4 | if(env === 'production') 'https://abc.mno.com/';
5 | else if(env === 'development') 'http://localhost:4000';
- 6 | }"
+ 6 | }
+Cause: Unexpected token do"
`;
exports[`do.js [meriyah] format 1`] = `
@@ -149,7 +154,8 @@ exports[`do.js [meriyah] format 1`] = `
| ^
4 | if(env === 'production') 'https://abc.mno.com/';
5 | else if(env === 'development') 'http://localhost:4000';
- 6 | }"
+ 6 | }
+Cause: [3:6]: Unexpected token: 'do'"
`;
exports[`do.js format 1`] = `
diff --git a/tests/format/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap
index 2f14318ed..58413f20f 100644
--- a/tests/format/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,16 @@ exports[`assertions.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`assertions.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`assertions.js [flow] format 1`] = `
@@ -25,7 +27,8 @@ exports[`assertions.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`assertions.js format 1`] = `
diff --git a/tests/format/js/explicit-resource-management/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/explicit-resource-management/__snapshots__/jsfmt.spec.js.snap
index 37ead1b3d..b68238451 100644
--- a/tests/format/js/explicit-resource-management/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/explicit-resource-management/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,16 @@ exports[`for-await-using-of-comments.js [acorn] format 1`] = `
"Unexpected token (1:19)
> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:18)"
`;
exports[`for-await-using-of-comments.js [espree] format 1`] = `
"Unexpected token await (1:19)
> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token await"
`;
exports[`for-await-using-of-comments.js [flow] format 1`] = `
@@ -25,7 +27,8 @@ exports[`for-await-using-of-comments.js [meriyah] format 1`] = `
"for await (... of ...) is only valid in async functions and async generators (1:52)
> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
| ^
- 2 |"
+ 2 |
+Cause: [1:52]: for await (... of ...) is only valid in async functions and async generators"
`;
exports[`for-await-using-of-comments.js format 1`] = `
@@ -49,7 +52,8 @@ exports[`invalid-duplicate-using-bindings.js [acorn] format 1`] = `
| ^
3 | }
4 | {
- 5 | using g = foo();"
+ 5 | using g = foo();
+Cause: Unexpected token (2:8)"
`;
exports[`invalid-duplicate-using-bindings.js [espree] format 1`] = `
@@ -59,7 +63,8 @@ exports[`invalid-duplicate-using-bindings.js [espree] format 1`] = `
| ^
3 | }
4 | {
- 5 | using g = foo();"
+ 5 | using g = foo();
+Cause: Unexpected token f"
`;
exports[`invalid-duplicate-using-bindings.js [flow] format 1`] = `
@@ -79,7 +84,8 @@ exports[`invalid-duplicate-using-bindings.js [meriyah] format 1`] = `
| ^
3 | }
4 | {
- 5 | using g = foo();"
+ 5 | using g = foo();
+Cause: [2:9]: Unexpected token: 'identifier'"
`;
exports[`invalid-duplicate-using-bindings.js [typescript] format 1`] = `
@@ -89,7 +95,8 @@ exports[`invalid-duplicate-using-bindings.js [typescript] format 1`] = `
| ^
3 | }
4 | {
- 5 | using g = foo();"
+ 5 | using g = foo();
+Cause: 'using' declarations must be initialized."
`;
exports[`invalid-duplicate-using-bindings.js format 1`] = `
@@ -123,14 +130,16 @@ exports[`invalid-script-top-level-using-binding.js [acorn] format 1`] = `
"Unexpected token (1:7)
> 1 | using x = bar();
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:6)"
`;
exports[`invalid-script-top-level-using-binding.js [espree] format 1`] = `
"Unexpected token x (1:7)
> 1 | using x = bar();
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token x"
`;
exports[`invalid-script-top-level-using-binding.js [flow] format 1`] = `
@@ -144,7 +153,8 @@ exports[`invalid-script-top-level-using-binding.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:7)
> 1 | using x = bar();
| ^
- 2 |"
+ 2 |
+Cause: [1:7]: Unexpected token: 'identifier'"
`;
exports[`invalid-script-top-level-using-binding.js format 1`] = `
@@ -168,7 +178,8 @@ exports[`using-declarations.js [acorn] format 1`] = `
| ^
3 | }
4 |
- 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);"
+ 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);
+Cause: Unexpected token (2:16)"
`;
exports[`using-declarations.js [espree] format 1`] = `
@@ -178,7 +189,8 @@ exports[`using-declarations.js [espree] format 1`] = `
| ^
3 | }
4 |
- 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);"
+ 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);
+Cause: Unexpected token a"
`;
exports[`using-declarations.js [flow] format 1`] = `
@@ -198,7 +210,8 @@ exports[`using-declarations.js [meriyah] format 1`] = `
| ^
3 | }
4 |
- 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);"
+ 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);
+Cause: [2:17]: Unexpected token: 'identifier'"
`;
exports[`using-declarations.js [typescript] format 1`] = `
@@ -209,7 +222,8 @@ exports[`using-declarations.js [typescript] format 1`] = `
| ^^^^^^^^^
6 |
7 | for(using /* 1 */ foo of bar());
- 8 |"
+ 8 |
+Cause: 'using' declarations may not be initialized in for statement."
`;
exports[`using-declarations.js format 1`] = `
@@ -321,7 +335,8 @@ exports[`valid-await-using-binding-basic.js [acorn] format 1`] = `
> 2 | await using basic = getReader();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:14)"
`;
exports[`valid-await-using-binding-basic.js [espree] format 1`] = `
@@ -330,7 +345,8 @@ exports[`valid-await-using-binding-basic.js [espree] format 1`] = `
> 2 | await using basic = getReader();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token basic"
`;
exports[`valid-await-using-binding-basic.js [flow] format 1`] = `
@@ -348,7 +364,8 @@ exports[`valid-await-using-binding-basic.js [meriyah] format 1`] = `
> 2 | await using basic = getReader();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: [2:19]: Unexpected token: 'identifier'"
`;
exports[`valid-await-using-binding-basic.js format 1`] = `
@@ -375,7 +392,8 @@ exports[`valid-await-using-binding-escaped.js [acorn] format 1`] = `
> 2 | await using \\u0061b = c;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:14)"
`;
exports[`valid-await-using-binding-escaped.js [espree] format 1`] = `
@@ -384,7 +402,8 @@ exports[`valid-await-using-binding-escaped.js [espree] format 1`] = `
> 2 | await using \\u0061b = c;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token \\u0061b"
`;
exports[`valid-await-using-binding-escaped.js [flow] format 1`] = `
@@ -402,7 +421,8 @@ exports[`valid-await-using-binding-escaped.js [meriyah] format 1`] = `
> 2 | await using \\u0061b = c;
| ^
3 | }
- 4 |"
+ 4 |
+Cause: [2:15]: Unexpected token: 'identifier'"
`;
exports[`valid-await-using-binding-escaped.js format 1`] = `
@@ -429,7 +449,8 @@ exports[`valid-await-using-binding-non-bmp.js [acorn] format 1`] = `
> 2 | await using 𠮷 = foo();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:14)"
`;
exports[`valid-await-using-binding-non-bmp.js [espree] format 1`] = `
@@ -438,7 +459,8 @@ exports[`valid-await-using-binding-non-bmp.js [espree] format 1`] = `
> 2 | await using 𠮷 = foo();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token 𠮷"
`;
exports[`valid-await-using-binding-non-bmp.js [flow] format 1`] = `
@@ -456,7 +478,8 @@ exports[`valid-await-using-binding-non-bmp.js [meriyah] format 1`] = `
> 2 | await using 𠮷 = foo();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: [2:17]: Unexpected token: 'identifier'"
`;
exports[`valid-await-using-binding-non-bmp.js format 1`] = `
@@ -484,7 +507,8 @@ exports[`valid-await-using-binding-using.js [acorn] format 1`] = `
| ^
3 | for (await using using of of);
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token (2:14)"
`;
exports[`valid-await-using-binding-using.js [espree] format 1`] = `
@@ -494,7 +518,8 @@ exports[`valid-await-using-binding-using.js [espree] format 1`] = `
| ^
3 | for (await using using of of);
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token using"
`;
exports[`valid-await-using-binding-using.js [flow] format 1`] = `
@@ -514,7 +539,8 @@ exports[`valid-await-using-binding-using.js [meriyah] format 1`] = `
| ^
3 | for (await using using of of);
4 | }
- 5 |"
+ 5 |
+Cause: [2:19]: Unexpected token: 'identifier'"
`;
exports[`valid-await-using-binding-using.js format 1`] = `
@@ -545,7 +571,8 @@ exports[`valid-await-using-comments.js [acorn] format 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 token (3:27)"
`;
exports[`valid-await-using-comments.js [espree] format 1`] = `
@@ -556,7 +583,8 @@ exports[`valid-await-using-comments.js [espree] format 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 token b"
`;
exports[`valid-await-using-comments.js [flow] format 1`] = `
@@ -578,7 +606,8 @@ exports[`valid-await-using-comments.js [meriyah] format 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: [3:28]: Unexpected token: 'identifier'"
`;
exports[`valid-await-using-comments.js [typescript] format 1`] = `
@@ -589,7 +618,8 @@ exports[`valid-await-using-comments.js [typescript] format 1`] = `
| ^^^^^^^^^^^^^
7 | }
8 | {
- 9 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/;"
+ 9 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/;
+Cause: 'await using' declarations may not be initialized in for statement."
`;
exports[`valid-await-using-comments.js format 1`] = `
@@ -676,7 +706,8 @@ exports[`valid-for-using-binding-of-of.js [acorn] format 1`] = `
| ^
3 | for await (await using of of of);
4 | }
- 5 |"
+ 5 |
+Cause: Assigning to rvalue (2:7)"
`;
exports[`valid-for-using-binding-of-of.js [espree] format 1`] = `
@@ -686,7 +717,8 @@ exports[`valid-for-using-binding-of-of.js [espree] format 1`] = `
| ^
3 | for await (await using of of of);
4 | }
- 5 |"
+ 5 |
+Cause: Assigning to rvalue"
`;
exports[`valid-for-using-binding-of-of.js [flow] format 1`] = `
@@ -706,7 +738,8 @@ exports[`valid-for-using-binding-of-of.js [meriyah] format 1`] = `
| ^
3 | for await (await using of of of);
4 | }
- 5 |"
+ 5 |
+Cause: [2:21]: Invalid left-hand side in for-of"
`;
exports[`valid-for-using-binding-of-of.js [typescript] format 1`] = `
@@ -716,7 +749,8 @@ exports[`valid-for-using-binding-of-of.js [typescript] format 1`] = `
| ^
3 | for await (await using of of of);
4 | }
- 5 |"
+ 5 |
+Cause: ')' expected."
`;
exports[`valid-for-using-binding-of-of.js format 1`] = `
@@ -745,7 +779,8 @@ exports[`valid-for-using-declaration.js [acorn] format 1`] = `
> 2 | for (await using basic = reader();;);
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:19)"
`;
exports[`valid-for-using-declaration.js [espree] format 1`] = `
@@ -754,7 +789,8 @@ exports[`valid-for-using-declaration.js [espree] format 1`] = `
> 2 | for (await using basic = reader();;);
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token basic"
`;
exports[`valid-for-using-declaration.js [flow] format 1`] = `
@@ -772,7 +808,8 @@ exports[`valid-for-using-declaration.js [meriyah] format 1`] = `
> 2 | for (await using basic = reader();;);
| ^
3 | }
- 4 |"
+ 4 |
+Cause: [2:24]: Expected ';'"
`;
exports[`valid-for-using-declaration.js [typescript] format 1`] = `
@@ -781,7 +818,8 @@ exports[`valid-for-using-declaration.js [typescript] format 1`] = `
> 2 | for (await using basic = reader();;);
| ^^^^^^^^^^^^^^^^
3 | }
- 4 |"
+ 4 |
+Cause: 'await using' declarations may not be initialized in for statement."
`;
exports[`valid-for-using-declaration.js format 1`] = `
@@ -808,7 +846,8 @@ exports[`valid-module-block-top-level-await-using-binding.js [acorn] format 1`]
| ^
2 | await using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (1:17)"
`;
exports[`valid-module-block-top-level-await-using-binding.js [espree] format 1`] = `
@@ -817,7 +856,8 @@ exports[`valid-module-block-top-level-await-using-binding.js [espree] format 1`]
| ^
2 | await using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token {"
`;
exports[`valid-module-block-top-level-await-using-binding.js [flow] format 1`] = `
@@ -835,7 +875,8 @@ exports[`valid-module-block-top-level-await-using-binding.js [meriyah] format 1`
| ^
2 | await using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: [1:18]: Unexpected token: '{'"
`;
exports[`valid-module-block-top-level-await-using-binding.js [typescript] format 1`] = `
@@ -844,7 +885,8 @@ exports[`valid-module-block-top-level-await-using-binding.js [typescript] format
| ^
2 | await using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: ',' expected."
`;
exports[`valid-module-block-top-level-await-using-binding.js format 1`] = `
@@ -871,7 +913,8 @@ exports[`valid-module-block-top-level-using-binding.js [acorn] format 1`] = `
| ^
2 | using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (1:7)"
`;
exports[`valid-module-block-top-level-using-binding.js [espree] format 1`] = `
@@ -880,7 +923,8 @@ exports[`valid-module-block-top-level-using-binding.js [espree] format 1`] = `
| ^
2 | using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token {"
`;
exports[`valid-module-block-top-level-using-binding.js [flow] format 1`] = `
@@ -898,7 +942,8 @@ exports[`valid-module-block-top-level-using-binding.js [meriyah] format 1`] = `
| ^
2 | using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: [1:8]: Unexpected token: '{'"
`;
exports[`valid-module-block-top-level-using-binding.js [typescript] format 1`] = `
@@ -907,7 +952,8 @@ exports[`valid-module-block-top-level-using-binding.js [typescript] format 1`] =
| ^
2 | using foo = bar();
3 | }
- 4 |"
+ 4 |
+Cause: Namespace must be given a name."
`;
exports[`valid-module-block-top-level-using-binding.js format 1`] = `
@@ -1057,7 +1103,8 @@ exports[`valid-using-binding-basic.js [acorn] format 1`] = `
> 2 | using basic = getReader();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token (2:8)"
`;
exports[`valid-using-binding-basic.js [espree] format 1`] = `
@@ -1066,7 +1113,8 @@ exports[`valid-using-binding-basic.js [espree] format 1`] = `
> 2 | using basic = getReader();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: Unexpected token basic"
`;
exports[`valid-using-binding-basic.js [flow] format 1`] = `
@@ -1084,7 +1132,8 @@ exports[`valid-using-binding-basic.js [meriyah] format 1`] = `
> 2 | using basic = getReader();
| ^
3 | }
- 4 |"
+ 4 |
+Cause: [2:13]: Unexpected token: 'identifier'"
`;
exports[`valid-using-binding-basic.js format 1`] = `
@@ -1109,14 +1158,16 @@ exports[`valid-using-binding-escaped.js [acorn] format 1`] = `
"Unexpected token (1:9)
> 1 | { using \\u0061b = c; }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:8)"
`;
exports[`valid-using-binding-escaped.js [espree] format 1`] = `
"Unexpected token \\u0061b (1:9)
> 1 | { using \\u0061b = c; }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token \\u0061b"
`;
exports[`valid-using-binding-escaped.js [flow] format 1`] = `
@@ -1130,7 +1181,8 @@ exports[`valid-using-binding-escaped.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:9)
> 1 | { using \\u0061b = c; }
| ^
- 2 |"
+ 2 |
+Cause: [1:9]: Unexpected token: 'identifier'"
`;
exports[`valid-using-binding-escaped.js format 1`] = `
@@ -1153,14 +1205,16 @@ exports[`valid-using-binding-non-bmp.js [acorn] format 1`] = `
"Unexpected token (1:9)
> 1 | { using 𠮷 = foo(); }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:8)"
`;
exports[`valid-using-binding-non-bmp.js [espree] format 1`] = `
"Unexpected token 𠮷 (1:9)
> 1 | { using 𠮷 = foo(); }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token 𠮷"
`;
exports[`valid-using-binding-non-bmp.js [flow] format 1`] = `
@@ -1174,7 +1228,8 @@ exports[`valid-using-binding-non-bmp.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:11)
> 1 | { using 𠮷 = foo(); }
| ^
- 2 |"
+ 2 |
+Cause: [1:11]: Unexpected token: 'identifier'"
`;
exports[`valid-using-binding-non-bmp.js format 1`] = `
@@ -1200,7 +1255,8 @@ exports[`valid-using-binding-using.js [acorn] format 1`] = `
| ^
3 | for (using using of of);
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token (2:8)"
`;
exports[`valid-using-binding-using.js [espree] format 1`] = `
@@ -1210,7 +1266,8 @@ exports[`valid-using-binding-using.js [espree] format 1`] = `
| ^
3 | for (using using of of);
4 | }
- 5 |"
+ 5 |
+Cause: Unexpected token using"
`;
exports[`valid-using-binding-using.js [flow] format 1`] = `
@@ -1230,7 +1287,8 @@ exports[`valid-using-binding-using.js [meriyah] format 1`] = `
| ^
3 | for (using using of of);
4 | }
- 5 |"
+ 5 |
+Cause: [2:13]: Unexpected token: 'identifier'"
`;
exports[`valid-using-binding-using.js format 1`] = `
diff --git a/tests/format/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap
index 2dd6c96d2..69728e9f7 100644
--- a/tests/format/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,16 @@ exports[`default-escaped.js [acorn] format 1`] = `
"Unexpected token (2:8)
1 | // export asyn\\u{63} from "async";
> 2 | export n\\u{63} from "async";
- | ^"
+ | ^
+Cause: Unexpected token (2:7)"
`;
exports[`default-escaped.js [espree] format 1`] = `
"Unexpected token n\\u{63} (2:8)
1 | // export asyn\\u{63} from "async";
> 2 | export n\\u{63} from "async";
- | ^"
+ | ^
+Cause: Unexpected token n\\u{63}"
`;
exports[`default-escaped.js [flow] format 1`] = `
@@ -25,7 +27,8 @@ exports[`default-escaped.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (2:12)
1 | // export asyn\\u{63} from "async";
> 2 | export n\\u{63} from "async";
- | ^"
+ | ^
+Cause: [2:12]: Unexpected token: 'identifier'"
`;
exports[`default-escaped.js format 1`] = `
diff --git a/tests/format/js/export-default/export-default-from/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/export-default/export-default-from/__snapshots__/jsfmt.spec.js.snap
index fa0a79dc1..556afb71d 100644
--- a/tests/format/js/export-default/export-default-from/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/export-default/export-default-from/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`export.js [acorn] format 1`] = `
| ^
3 | export a, * as b from 'mod';
4 | export c, { foo } from 'mod';
- 5 | export * as d from 'mod';"
+ 5 | export * as d from 'mod';
+Cause: Unexpected token (2:7)"
`;
exports[`export.js [espree] format 1`] = `
@@ -17,7 +18,8 @@ exports[`export.js [espree] format 1`] = `
| ^
3 | export a, * as b from 'mod';
4 | export c, { foo } from 'mod';
- 5 | export * as d from 'mod';"
+ 5 | export * as d from 'mod';
+Cause: Unexpected token v"
`;
exports[`export.js [meriyah] format 1`] = `
@@ -27,7 +29,8 @@ exports[`export.js [meriyah] format 1`] = `
| ^
3 | export a, * as b from 'mod';
4 | export c, { foo } from 'mod';
- 5 | export * as d from 'mod';"
+ 5 | export * as d from 'mod';
+Cause: [2:8]: Unexpected token: 'identifier'"
`;
exports[`export.js format 1`] = `
diff --git a/tests/format/js/export-star/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/export-star/__snapshots__/jsfmt.spec.js.snap
index 854ded8a5..473e7b1ba 100644
--- a/tests/format/js/export-star/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/export-star/__snapshots__/jsfmt.spec.js.snap
@@ -75,7 +75,8 @@ exports[`export-star-as-string.js [typescript] format 1`] = `
"Identifier expected. (1:13)
> 1 | export * as 'foo' from 'foo'
| ^
- 2 |"
+ 2 |
+Cause: Identifier expected."
`;
exports[`export-star-as-string.js format 1`] = `
@@ -103,7 +104,8 @@ exports[`export-star-as-string2.js [typescript] format 1`] = `
"Identifier expected. (1:13)
> 1 | export * as "foo" from 'foo'
| ^
- 2 |"
+ 2 |
+Cause: Identifier expected."
`;
exports[`export-star-as-string2.js format 1`] = `
diff --git a/tests/format/js/export/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/export/__snapshots__/jsfmt.spec.js.snap
index 052c9ed21..5eff834ed 100644
--- a/tests/format/js/export/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/export/__snapshots__/jsfmt.spec.js.snap
@@ -349,28 +349,32 @@ exports[`undefined.js [acorn] format 1`] = `
"Export 'undefinedExport' is not defined (1:10)
> 1 | export { undefinedExport };
| ^
- 2 |"
+ 2 |
+Cause: Export 'undefinedExport' is not defined (1:9)"
`;
exports[`undefined.js [espree] format 1`] = `
"Export 'undefinedExport' is not defined (1:10)
> 1 | export { undefinedExport };
| ^
- 2 |"
+ 2 |
+Cause: Export 'undefinedExport' is not defined"
`;
exports[`undefined.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Export 'undefinedExport' is not defined (1:10)
> 1 | export { undefinedExport };
| ^
- 2 |"
+ 2 |
+Cause: Export 'undefinedExport' is not defined (1:9)"
`;
exports[`undefined.js - {"bracketSpacing":false} [espree] format 1`] = `
"Export 'undefinedExport' is not defined (1:10)
> 1 | export { undefinedExport };
| ^
- 2 |"
+ 2 |
+Cause: Export 'undefinedExport' is not defined"
`;
exports[`undefined.js - {"bracketSpacing":false} format 1`] = `
diff --git a/tests/format/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
index 1c6fa187c..864243cdb 100644
--- a/tests/format/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
@@ -243,7 +243,8 @@ exports[`tuple-and-record.js [acorn] format 1`] = `
| ^
23 | }
24 |
- 25 | function StatelessFunctionalComponent3(["
+ 25 | function StatelessFunctionalComponent3([
+Cause: Unexpected character '{' (22:5)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
@@ -254,7 +255,8 @@ exports[`tuple-and-record.js [espree] format 1`] = `
| ^
23 | }
24 |
- 25 | function StatelessFunctionalComponent3(["
+ 25 | function StatelessFunctionalComponent3([
+Cause: Unexpected character '{'"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
@@ -276,7 +278,8 @@ exports[`tuple-and-record.js [meriyah] format 1`] = `
| ^
23 | }
24 |
- 25 | function StatelessFunctionalComponent3(["
+ 25 | function StatelessFunctionalComponent3([
+Cause: [22:5]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js format 1`] = `
diff --git a/tests/format/js/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/ignore/__snapshots__/jsfmt.spec.js.snap
index 710718ef2..82a7a8e26 100644
--- a/tests/format/js/ignore/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/ignore/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`class-expression-decorator.js [acorn] format 1`] = `
| ^
4 | class {}
5 | );
- 6 |"
+ 6 |
+Cause: Unexpected character '@' (3:2)"
`;
exports[`class-expression-decorator.js [espree] format 1`] = `
@@ -19,7 +20,8 @@ exports[`class-expression-decorator.js [espree] format 1`] = `
| ^
4 | class {}
5 | );
- 6 |"
+ 6 |
+Cause: Unexpected character '@'"
`;
exports[`class-expression-decorator.js [flow] format 1`] = `
@@ -61,7 +63,8 @@ exports[`decorator.js [acorn] format 1`] = `
> 2 | @decorator
| ^
3 | class A {}
- 4 |"
+ 4 |
+Cause: Unexpected character '@' (2:0)"
`;
exports[`decorator.js [espree] format 1`] = `
@@ -70,7 +73,8 @@ exports[`decorator.js [espree] format 1`] = `
> 2 | @decorator
| ^
3 | class A {}
- 4 |"
+ 4 |
+Cause: Unexpected character '@'"
`;
exports[`decorator.js format 1`] = `
diff --git a/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap
index d6ea22a64..cd510baf0 100644
--- a/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`dynamic-import.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`dynamic-import.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`dynamic-import.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`dynamic-import.js format 1`] = `
@@ -42,7 +45,8 @@ exports[`empty.js [acorn] format 1`] = `
| ^
3 | export * as baz from "baz.json" assert { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: Unexpected token (2:32)"
`;
exports[`empty.js [espree] format 1`] = `
@@ -52,7 +56,8 @@ exports[`empty.js [espree] format 1`] = `
| ^
3 | export * as baz from "baz.json" assert { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: Unexpected token assert"
`;
exports[`empty.js [meriyah] format 1`] = `
@@ -62,7 +67,8 @@ exports[`empty.js [meriyah] format 1`] = `
| ^
3 | export * as baz from "baz.json" assert { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: [2:38]: Unexpected token: 'identifier'"
`;
exports[`empty.js format 1`] = `
@@ -94,21 +100,24 @@ exports[`multi-types.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" assert { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`multi-types.js [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from "./foo.json" assert { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`multi-types.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:36)
> 1 | import json from "./foo.json" assert { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: [1:36]: Unexpected token: 'identifier'"
`;
exports[`multi-types.js format 1`] = `
@@ -129,21 +138,24 @@ exports[`non-type.js [acorn] format 1`] = `
"Unexpected token (1:28)
> 1 | import foo from "foo.json" assert { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:27)"
`;
exports[`non-type.js [espree] format 1`] = `
"Unexpected token assert (1:28)
> 1 | import foo from "foo.json" assert { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`non-type.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:33)
> 1 | import foo from "foo.json" assert { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: [1:33]: Unexpected token: 'identifier'"
`;
exports[`non-type.js format 1`] = `
@@ -182,7 +194,8 @@ exports[`re-export.js [acorn] format 1`] = `
| ^
2 | export * from "foo.json" assert { type: "json" };
3 | export * as foo3 from "foo.json" assert { type: "json" };
- 4 |"
+ 4 |
+Cause: Unexpected token (1:43)"
`;
exports[`re-export.js [espree] format 1`] = `
@@ -191,7 +204,8 @@ exports[`re-export.js [espree] format 1`] = `
| ^
2 | export * from "foo.json" assert { type: "json" };
3 | export * as foo3 from "foo.json" assert { type: "json" };
- 4 |"
+ 4 |
+Cause: Unexpected token assert"
`;
exports[`re-export.js [meriyah] format 1`] = `
@@ -200,7 +214,8 @@ exports[`re-export.js [meriyah] format 1`] = `
| ^
2 | export * from "foo.json" assert { type: "json" };
3 | export * as foo3 from "foo.json" assert { type: "json" };
- 4 |"
+ 4 |
+Cause: [1:49]: Unexpected token: 'identifier'"
`;
exports[`re-export.js format 1`] = `
@@ -225,21 +240,24 @@ exports[`static-import.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`static-import.js [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`static-import.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:36)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:36]: Unexpected token: 'identifier'"
`;
exports[`static-import.js format 1`] = `
@@ -260,21 +278,24 @@ exports[`without-from.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import "foo" assert { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`without-from.js [espree] format 1`] = `
"Unexpected token assert (1:14)
> 1 | import "foo" assert { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`without-from.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:19)
> 1 | import "foo" assert { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: [1:19]: Unexpected token: 'identifier'"
`;
exports[`without-from.js format 1`] = `
diff --git a/tests/format/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
index 8ac26309b..884bb803b 100644
--- a/tests/format/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { assert: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = `
@@ -39,19 +42,22 @@ import("./foo.json", {assert: {type: "json"}});
exports[`empty.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:33)
> 1 | export * as bar from "bar.json" assert { }
- | ^"
+ | ^
+Cause: Unexpected token (1:32)"
`;
exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token assert (1:33)
> 1 | export * as bar from "bar.json" assert { }
- | ^"
+ | ^
+Cause: Unexpected token assert"
`;
exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:38)
> 1 | export * as bar from "bar.json" assert { }
- | ^"
+ | ^
+Cause: [1:38]: Unexpected token: 'identifier'"
`;
exports[`empty.js - {"bracketSpacing":false} format 1`] = `
@@ -72,21 +78,24 @@ exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:44)
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:43)"
`;
exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token assert (1:44)
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:49)
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:49]: Unexpected token: 'identifier'"
`;
exports[`re-export.js - {"bracketSpacing":false} format 1`] = `
@@ -108,21 +117,24 @@ exports[`static-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token assert (1:31)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token assert"
`;
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:36)
> 1 | import json from "./foo.json" assert { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:36]: Unexpected token: 'identifier'"
`;
exports[`static-import.js - {"bracketSpacing":false} format 1`] = `
diff --git a/tests/format/js/import-attributes/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-attributes/__snapshots__/jsfmt.spec.js.snap
index 08fa4fda4..9024e0269 100644
--- a/tests/format/js/import-attributes/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/import-attributes/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`dynamic-import.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`dynamic-import.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`dynamic-import.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`dynamic-import.js format 1`] = `
@@ -42,7 +45,8 @@ exports[`empty.js [acorn] format 1`] = `
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: Unexpected token (2:32)"
`;
exports[`empty.js [espree] format 1`] = `
@@ -52,7 +56,8 @@ exports[`empty.js [espree] format 1`] = `
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: Unexpected token with"
`;
exports[`empty.js [meriyah] format 1`] = `
@@ -62,7 +67,8 @@ exports[`empty.js [meriyah] format 1`] = `
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: [2:36]: Unexpected token: 'with'"
`;
exports[`empty.js [typescript] format 1`] = `
@@ -72,7 +78,8 @@ exports[`empty.js [typescript] format 1`] = `
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
- 5 | import * as foo from "foo.json""
+ 5 | import * as foo from "foo.json"
+Cause: ';' expected."
`;
exports[`empty.js format 1`] = `
@@ -105,28 +112,32 @@ exports[`multi-types.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`multi-types.js [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`multi-types.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: [1:34]: Unexpected token: 'with'"
`;
exports[`multi-types.js [typescript] format 1`] = `
"';' expected. (1:31)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
- 2 |"
+ 2 |
+Cause: ';' expected."
`;
exports[`multi-types.js format 1`] = `
@@ -147,28 +158,32 @@ exports[`non-type.js [acorn] format 1`] = `
"Unexpected token (1:28)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:27)"
`;
exports[`non-type.js [espree] format 1`] = `
"Unexpected token with (1:28)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`non-type.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:31)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: [1:31]: Unexpected token: 'with'"
`;
exports[`non-type.js [typescript] format 1`] = `
"';' expected. (1:28)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
- 2 |"
+ 2 |
+Cause: ';' expected."
`;
exports[`non-type.js format 1`] = `
@@ -191,7 +206,8 @@ exports[`re-export.js [acorn] format 1`] = `
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
- 4 |"
+ 4 |
+Cause: Unexpected token (1:43)"
`;
exports[`re-export.js [espree] format 1`] = `
@@ -200,7 +216,8 @@ exports[`re-export.js [espree] format 1`] = `
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
- 4 |"
+ 4 |
+Cause: Unexpected token with"
`;
exports[`re-export.js [meriyah] format 1`] = `
@@ -209,7 +226,8 @@ exports[`re-export.js [meriyah] format 1`] = `
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
- 4 |"
+ 4 |
+Cause: [1:47]: Unexpected token: 'with'"
`;
exports[`re-export.js [typescript] format 1`] = `
@@ -218,7 +236,8 @@ exports[`re-export.js [typescript] format 1`] = `
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
- 4 |"
+ 4 |
+Cause: ';' expected."
`;
exports[`re-export.js format 1`] = `
@@ -243,28 +262,32 @@ exports[`static-import.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`static-import.js [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`static-import.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:34]: Unexpected token: 'with'"
`;
exports[`static-import.js [typescript] format 1`] = `
"';' expected. (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: ';' expected."
`;
exports[`static-import.js format 1`] = `
@@ -285,28 +308,32 @@ exports[`without-from.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import "foo" with { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:13)"
`;
exports[`without-from.js [espree] format 1`] = `
"Unexpected token with (1:14)
> 1 | import "foo" with { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`without-from.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:17)
> 1 | import "foo" with { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: [1:17]: Unexpected token: 'with'"
`;
exports[`without-from.js [typescript] format 1`] = `
"';' expected. (1:14)
> 1 | import "foo" with { type: "json" }
| ^
- 2 |"
+ 2 |
+Cause: ';' expected."
`;
exports[`without-from.js format 1`] = `
diff --git a/tests/format/js/import-attributes/bracket-spacing/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-attributes/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
index 828d539d1..18d759c64 100644
--- a/tests/format/js/import-attributes/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/import-attributes/bracket-spacing/__snapshots__/jsfmt.spec.js.snap
@@ -4,21 +4,24 @@ exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ,"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Expected ')'"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = `
@@ -39,19 +42,22 @@ import("./foo.json", {with: {type: "json"}});
exports[`empty.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:33)
> 1 | export * as bar from "bar.json" with { }
- | ^"
+ | ^
+Cause: Unexpected token (1:32)"
`;
exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token with (1:33)
> 1 | export * as bar from "bar.json" with { }
- | ^"
+ | ^
+Cause: Unexpected token with"
`;
exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'with' (1:36)
> 1 | export * as bar from "bar.json" with { }
- | ^"
+ | ^
+Cause: [1:36]: Unexpected token: 'with'"
`;
exports[`empty.js - {"bracketSpacing":false} format 1`] = `
@@ -72,21 +78,24 @@ exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:43)"
`;
exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token with (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'with' (1:47)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:47]: Unexpected token: 'with'"
`;
exports[`re-export.js - {"bracketSpacing":false} format 1`] = `
@@ -108,21 +117,24 @@ exports[`static-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:30)"
`;
exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token with"
`;
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
- 2 |"
+ 2 |
+Cause: [1:34]: Unexpected token: 'with'"
`;
exports[`static-import.js - {"bracketSpacing":false} format 1`] = `
diff --git a/tests/format/js/import-reflection/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-reflection/__snapshots__/jsfmt.spec.js.snap
index 96fa08e87..ef3380bf9 100644
--- a/tests/format/js/import-reflection/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/import-reflection/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,16 @@ exports[`comments.js [acorn] format 1`] = `
"Unexpected token (1:48)
> 1 | /* 0 */import /* 1 */module /* 2 */from /* 3 */from /* 4 */"./module.wasm"/* 5 */;
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:47)"
`;
exports[`comments.js [espree] format 1`] = `
"Unexpected token from (1:48)
> 1 | /* 0 */import /* 1 */module /* 2 */from /* 3 */from /* 4 */"./module.wasm"/* 5 */;
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token from"
`;
exports[`comments.js [flow] format 1`] = `
@@ -25,14 +27,16 @@ exports[`comments.js [meriyah] format 1`] = `
"Import source must be string (1:51)
> 1 | /* 0 */import /* 1 */module /* 2 */from /* 3 */from /* 4 */"./module.wasm"/* 5 */;
| ^
- 2 |"
+ 2 |
+Cause: [1:51]: Import source must be string"
`;
exports[`comments.js [typescript] format 1`] = `
"';' expected. (1:60)
> 1 | /* 0 */import /* 1 */module /* 2 */from /* 3 */from /* 4 */"./module.wasm"/* 5 */;
| ^
- 2 |"
+ 2 |
+Cause: ';' expected."
`;
exports[`comments.js format 1`] = `
@@ -53,14 +57,16 @@ exports[`import-reflection.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`import-reflection.js [espree] format 1`] = `
"Unexpected token foo (1:15)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token foo"
`;
exports[`import-reflection.js [flow] format 1`] = `
@@ -74,14 +80,16 @@ exports[`import-reflection.js [meriyah] format 1`] = `
"Import source must be string (1:17)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: [1:17]: Import source must be string"
`;
exports[`import-reflection.js [typescript] format 1`] = `
"'=' expected. (1:15)
> 1 | import module foo from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: '=' expected."
`;
exports[`import-reflection.js format 1`] = `
@@ -103,7 +111,8 @@ exports[`valid-default-import.mjs [acorn] format 1`] = `
> 1 | import module foo from "./module.wasm";
| ^
2 | import bar from "./module.wasm";
- 3 |"
+ 3 |
+Cause: Unexpected token (1:14)"
`;
exports[`valid-default-import.mjs [espree] format 1`] = `
@@ -111,7 +120,8 @@ exports[`valid-default-import.mjs [espree] format 1`] = `
> 1 | import module foo from "./module.wasm";
| ^
2 | import bar from "./module.wasm";
- 3 |"
+ 3 |
+Cause: Unexpected token foo"
`;
exports[`valid-default-import.mjs [flow] format 1`] = `
@@ -127,7 +137,8 @@ exports[`valid-default-import.mjs [meriyah] format 1`] = `
> 1 | import module foo from "./module.wasm";
| ^
2 | import bar from "./module.wasm";
- 3 |"
+ 3 |
+Cause: [1:17]: Import source must be string"
`;
exports[`valid-default-import.mjs [typescript] format 1`] = `
@@ -135,7 +146,8 @@ exports[`valid-default-import.mjs [typescript] format 1`] = `
> 1 | import module foo from "./module.wasm";
| ^
2 | import bar from "./module.wasm";
- 3 |"
+ 3 |
+Cause: '=' expected."
`;
exports[`valid-default-import.mjs format 1`] = `
@@ -158,14 +170,16 @@ exports[`valid-from-as-default-module-binding.mjs [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import module from from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`valid-from-as-default-module-binding.mjs [espree] format 1`] = `
"Unexpected token from (1:20)
> 1 | import module from from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token from"
`;
exports[`valid-from-as-default-module-binding.mjs [flow] format 1`] = `
@@ -179,14 +193,16 @@ exports[`valid-from-as-default-module-binding.mjs [meriyah] format 1`] = `
"Import source must be string (1:23)
> 1 | import module from from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: [1:23]: Import source must be string"
`;
exports[`valid-from-as-default-module-binding.mjs [typescript] format 1`] = `
"';' expected. (1:25)
> 1 | import module from from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: ';' expected."
`;
exports[`valid-from-as-default-module-binding.mjs format 1`] = `
@@ -207,14 +223,16 @@ exports[`valid-from-as-default-module-binding-escaped.mjs [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import module \\u0066rom from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`valid-from-as-default-module-binding-escaped.mjs [espree] format 1`] = `
"Unexpected token \\u0066rom (1:15)
> 1 | import module \\u0066rom from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token \\u0066rom"
`;
exports[`valid-from-as-default-module-binding-escaped.mjs [flow] format 1`] = `
@@ -228,14 +246,16 @@ exports[`valid-from-as-default-module-binding-escaped.mjs [meriyah] format 1`] =
"Import source must be string (1:17)
> 1 | import module \\u0066rom from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: [1:17]: Import source must be string"
`;
exports[`valid-from-as-default-module-binding-escaped.mjs [typescript] format 1`] = `
"Keywords cannot contain escape characters. (1:15)
> 1 | import module \\u0066rom from "./module.wasm";
| ^
- 2 |"
+ 2 |
+Cause: Keywords cannot contain escape characters."
`;
exports[`valid-from-as-default-module-binding-escaped.mjs format 1`] = `
diff --git a/tests/format/js/invalid-code/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/invalid-code/__snapshots__/jsfmt.spec.js.snap
index a40691a62..ac2c64bef 100644
--- a/tests/format/js/invalid-code/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/invalid-code/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,16 @@ exports[`duplicate_bindings.js [acorn] format 1`] = `
"Identifier 'A' has already been declared (1:19)
> 1 | class A{} class A{}
| ^
- 2 |"
+ 2 |
+Cause: Identifier 'A' has already been declared (1:18)"
`;
exports[`duplicate_bindings.js [espree] format 1`] = `
"Identifier 'A' has already been declared (1:19)
> 1 | class A{} class A{}
| ^
- 2 |"
+ 2 |
+Cause: Identifier 'A' has already been declared"
`;
exports[`duplicate_bindings.js format 1`] = `
diff --git a/tests/format/js/method-chain/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/method-chain/__snapshots__/jsfmt.spec.js.snap
index 91a032d9b..b3f594e45 100644
--- a/tests/format/js/method-chain/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/method-chain/__snapshots__/jsfmt.spec.js.snap
@@ -1553,7 +1553,8 @@ exports[`tuple-and-record.js [acorn] format 1`] = `
| ^
3 |
4 | foo.a().b().c({n, o})
- 5 | foo.a().b().c(#{n, o})"
+ 5 | foo.a().b().c(#{n, o})
+Cause: Unexpected character '[' (2:15)"
`;
exports[`tuple-and-record.js [espree] format 1`] = `
@@ -1563,7 +1564,8 @@ exports[`tuple-and-record.js [espree] format 1`] = `
| ^
3 |
4 | foo.a().b().c({n, o})
- 5 | foo.a().b().c(#{n, o})"
+ 5 | foo.a().b().c(#{n, o})
+Cause: Unexpected character '['"
`;
exports[`tuple-and-record.js [flow] format 1`] = `
@@ -1583,7 +1585,8 @@ exports[`tuple-and-record.js [meriyah] format 1`] = `
| ^
3 |
4 | foo.a().b().c({n, o})
- 5 | foo.a().b().c(#{n, o})"
+ 5 | foo.a().b().c(#{n, o})
+Cause: [2:15]: '#' not followed by identifier"
`;
exports[`tuple-and-record.js [typescript] format 1`] = `
@@ -1593,7 +1596,8 @@ exports[`tuple-and-record.js [typescript] format 1`] = `
| ^
3 |
4 | foo.a().b().c({n, o})
- 5 | foo.a().b().c(#{n, o})"
+ 5 | foo.a().b().c(#{n, o})
+Cause: Invalid character."
`;
exports[`tuple-and-record.js format 1`] = `
diff --git a/tests/format/js/module-blocks/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/module-blocks/__snapshots__/jsfmt.spec.js.snap
index 6c178e55c..61cd278bf 100644
--- a/tests/format/js/module-blocks/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/module-blocks/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`comments.js [acorn] format 1`] = `
| ^
2 | /*A4*/
3 | export const foo = "foo";
- 4 | export { foo }; /*A5*/"
+ 4 | export { foo }; /*A5*/
+Cause: Unexpected token (1:31)"
`;
exports[`comments.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`comments.js [espree] format 1`] = `
| ^
2 | /*A4*/
3 | export const foo = "foo";
- 4 | export { foo }; /*A5*/"
+ 4 | export { foo }; /*A5*/
+Cause: Unexpected token {"
`;
exports[`comments.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`comments.js [meriyah] format 1`] = `
| ^
2 | /*A4*/
3 | export const foo = "foo";
- 4 | export { foo }; /*A5*/"
+ 4 | export { foo }; /*A5*/
+Cause: [1:32]: Unexpected token: '{'"
`;
exports[`comments.js format 1`] = `
@@ -67,7 +70,8 @@ exports[`module-blocks.js [acorn] format 1`] = `
| ^
2 |
3 | class B {
- 4 | #p() {"
+ 4 | #p() {
+Cause: Unexpected token (1:7)"
`;
exports[`module-blocks.js [espree] format 1`] = `
@@ -76,7 +80,8 @@ exports[`module-blocks.js [espree] format 1`] = `
| ^
2 |
3 | class B {
- 4 | #p() {"
+ 4 | #p() {
+Cause: Unexpected token {"
`;
exports[`module-blocks.js [meriyah] format 1`] = `
@@ -85,7 +90,8 @@ exports[`module-blocks.js [meriyah] format 1`] = `
| ^
2 |
3 | class B {
- 4 | #p() {"
+ 4 | #p() {
+Cause: [1:8]: Unexpected token: '{'"
`;
exports[`module-blocks.js format 1`] = `
@@ -211,7 +217,8 @@ exports[`range.js [acorn] format 1`] = `
| ^
2 | };
3 |
- 4 | foo(module { export let foo = "foo"; })"
+ 4 | foo(module { export let foo = "foo"; })
+Cause: Unexpected token (1:25)"
`;
exports[`range.js [espree] format 1`] = `
@@ -220,7 +227,8 @@ exports[`range.js [espree] format 1`] = `
| ^
2 | };
3 |
- 4 | foo(module { export let foo = "foo"; })"
+ 4 | foo(module { export let foo = "foo"; })
+Cause: Unexpected token {"
`;
exports[`range.js [meriyah] format 1`] = `
@@ -229,7 +237,8 @@ exports[`range.js [meriyah] format 1`] = `
| ^
2 | };
3 |
- 4 | foo(module { export let foo = "foo"; })"
+ 4 | foo(module { export let foo = "foo"; })
+Cause: [1:26]: Unexpected token: '{'"
`;
exports[`range.js format 1`] = `
@@ -267,7 +276,8 @@ exports[`worker.js [acorn] format 1`] = `
| ^
2 | onmessage = function({data}) {
3 | let mod = import(data);
- 4 | postMessage(mod.fn());"
+ 4 | postMessage(mod.fn());
+Cause: Unexpected token (1:31)"
`;
exports[`worker.js [espree] format 1`] = `
@@ -276,7 +286,8 @@ exports[`worker.js [espree] format 1`] = `
| ^
2 | onmessage = function({data}) {
3 | let mod = import(data);
- 4 | postMessage(mod.fn());"
+ 4 | postMessage(mod.fn());
+Cause: Unexpected token {"
`;
exports[`worker.js [meriyah] format 1`] = `
@@ -285,7 +296,8 @@ exports[`worker.js [meriyah] format 1`] = `
| ^
2 | onmessage = function({data}) {
3 | let mod = import(data);
- 4 | postMessage(mod.fn());"
+ 4 | postMessage(mod.fn());
+Cause: [1:32]: Expected ')'"
`;
exports[`worker.js format 1`] = `
diff --git a/tests/format/js/module-string-names/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/module-string-names/__snapshots__/jsfmt.spec.js.snap
index 59fca2ebe..2f1408a20 100644
--- a/tests/format/js/module-string-names/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/module-string-names/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`module-string-names-export.js [meriyah] format 1`] = `
| ^
2 | export { "smile" as smile2 } from "./emojis.js";
3 | export { "smile" as "smile3" } from "./emojis.js";
- 4 | export { foo1, bar as "foo2" } from "./emojis.js";"
+ 4 | export { foo1, bar as "foo2" } from "./emojis.js";
+Cause: [1:26]: Only a identifier can be used to indicate alias"
`;
exports[`module-string-names-export.js format 1`] = `
@@ -42,7 +43,8 @@ exports[`module-string-names-import.js [meriyah] format 1`] = `
| ^
2 | import { "foo" as bar, "default" as qux } from "module-a";
3 | import { "學而時習之,不亦說乎?" as quotation2 } from "Confucius";
- 4 |"
+ 4 |
+Cause: [1:18]: Expected '}'"
`;
exports[`module-string-names-import.js format 1`] = `
diff --git a/tests/format/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap
index b01edb089..99efe4ece 100644
--- a/tests/format/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap
@@ -8,7 +8,8 @@ exports[`text.js [acorn] format 1`] = `
| ^
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
8 |
- 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
+ 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;
+Cause: Bad escape sequence in untagged template literal (6:17)"
`;
exports[`text.js [espree] format 1`] = `
@@ -19,7 +20,8 @@ exports[`text.js [espree] format 1`] = `
| ^
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
8 |
- 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
+ 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;
+Cause: Bad escape sequence in untagged template literal"
`;
exports[`text.js [flow] format 1`] = `
@@ -39,7 +41,8 @@ exports[`text.js [meriyah] format 1`] = `
| ^
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
8 |
- 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
+ 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;
+Cause: [6:20]: Invalid hexadecimal escape sequence"
`;
exports[`text.js [typescript] format 1`] = `
@@ -50,7 +53,8 @@ exports[`text.js [typescript] format 1`] = `
| ^
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
8 |
- 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
+ 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;
+Cause: Hexadecimal digit expected."
`;
exports[`text.js format 1`] = `
diff --git a/tests/format/js/new-target/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/new-target/__snapshots__/jsfmt.spec.js.snap
index 5afd170cc..26c0be5b8 100644
--- a/tests/format/js/new-target/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/new-target/__snapshots__/jsfmt.spec.js.snap
@@ -4,14 +4,16 @@ exports[`outside-functions.js [acorn] format 1`] = `
"'new.target' can only be used in functions and class static block (1:11)
> 1 | const x = new.target;
| ^
- 2 |"
+ 2 |
+Cause: 'new.target' can only be used in functions and class static block (1:10)"
`;
exports[`outside-functions.js [espree] format 1`] = `
"'new.target' can only be used in functions and class static block (1:11)
> 1 | const x = new.target;
| ^
- 2 |"
+ 2 |
+Cause: 'new.target' can only be used in functions and class static block"
`;
exports[`outside-functions.js [flow] format 1`] = `
@@ -25,7 +27,8 @@ exports[`outside-functions.js [meriyah] format 1`] = `
"new.target only allowed within functions (1:20)
> 1 | const x = new.target;
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: new.target only allowed within functions"
`;
exports[`outside-functions.js format 1`] = `
@@ -46,14 +49,16 @@ exports[`range.js [acorn] format 1`] = `
"'new.target' can only be used in functions and class static block (2:1)
1 | const x =
> 2 | new.target;
- | ^"
+ | ^
+Cause: 'new.target' can only be used in functions and class static block (2:0)"
`;
exports[`range.js [espree] format 1`] = `
"'new.target' can only be used in functions and class static block (2:1)
1 | const x =
> 2 | new.target;
- | ^"
+ | ^
+Cause: 'new.target' can only be used in functions and class static block"
`;
exports[`range.js [flow] format 1`] = `
@@ -67,7 +72,8 @@ exports[`range.js [meriyah] format 1`] = `
"new.target only allowed within functions (2:10)
1 | const x =
> 2 | new.target;
- | ^"
+ | ^
+Cause: [2:10]: new.target only allowed within functions"
`;
exports[`range.js format 1`] = `
diff --git a/tests/format/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap
index 62fddaed3..a41e9e189 100644
--- a/tests/format/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`no-semi.js [acorn] format 1`] = `
| ^
3 |
4 | class A {
- 5 | a = b;"
+ 5 | a = b;
+Cause: Unexpected token (2:1)"
`;
exports[`no-semi.js [espree] format 1`] = `
@@ -17,7 +18,8 @@ exports[`no-semi.js [espree] format 1`] = `
| ^
3 |
4 | class A {
- 5 | a = b;"
+ 5 | a = b;
+Cause: Unexpected token :"
`;
exports[`no-semi.js [meriyah] format 1`] = `
@@ -27,7 +29,8 @@ exports[`no-semi.js [meriyah] format 1`] = `
| ^
3 |
4 | class A {
- 5 | a = b;"
+ 5 | a = b;
+Cause: [2:2]: Unexpected token: ':'"
`;
exports[`no-semi.js - {"semi":false} [acorn] format 1`] = `
@@ -37,7 +40,8 @@ exports[`no-semi.js - {"semi":false} [acorn] format 1`] = `
| ^
3 |
4 | class A {
- 5 | a = b;"
+ 5 | a = b;
+Cause: Unexpected token (2:1)"
`;
exports[`no-semi.js - {"semi":false} [espree] format 1`] = `
@@ -47,7 +51,8 @@ exports[`no-semi.js - {"semi":false} [espree] format 1`] = `
| ^
3 |
4 | class A {
- 5 | a = b;"
+ 5 | a = b;
+Cause: Unexpected token :"
`;
exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = `
@@ -57,7 +62,8 @@ exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = `
| ^
3 |
4 | class A {
- 5 | a = b;"
+ 5 | a = b;
+Cause: [2:2]: Unexpected token: ':'"
`;
exports[`no-semi.js - {"semi":false} format 1`] = `
diff --git a/tests/format/js/non-strict/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/non-strict/__snapshots__/jsfmt.spec.js.snap
index 19773df14..391c9d291 100644
--- a/tests/format/js/non-strict/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/non-strict/__snapshots__/jsfmt.spec.js.snap
@@ -48,7 +48,8 @@ exports[`octal-number.js [typescript] format 1`] = `
"Octal literals are not allowed. Use the syntax '0o777'. (1:1)
> 1 | 0777
| ^
- 2 |"
+ 2 |
+Cause: Octal literals are not allowed. Use the syntax '0o777'."
`;
exports[`octal-number.js format 1`] = `
diff --git a/tests/format/js/numeric-separators/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/numeric-separators/__snapshots__/jsfmt.spec.js.snap
index f74cde3be..b4d516a88 100644
--- a/tests/format/js/numeric-separators/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/numeric-separators/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`number.js [typescript] format 1`] = `
> 3 | a = 09e1_1;
| ^
4 | a = 09.1_1;
- 5 |"
+ 5 |
+Cause: Decimals with leading zeros are not allowed."
`;
exports[`number.js format 1`] = `
diff --git a/tests/format/js/objects/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/objects/__snapshots__/jsfmt.spec.js.snap
index 1aa2deba2..259a9b285 100644
--- a/tests/format/js/objects/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/objects/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`bigint-key.js [typescript] format 1`] = `
| ^
2 | a = {1n() {}}
3 | a = {get 1n() {}}
- 4 |"
+ 4 |
+Cause: Property assignment expected."
`;
exports[`bigint-key.js format 1`] = `
@@ -87,7 +88,8 @@ exports[`expression.js [acorn] format 1`] = `
| ^
6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0);
7 | ({}(), 0);
- 8 | ({} = 0);"
+ 8 | ({} = 0);
+Cause: Unexpected token (5:3)"
`;
exports[`expression.js [espree] format 1`] = `
@@ -98,7 +100,8 @@ exports[`expression.js [espree] format 1`] = `
| ^
6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0);
7 | ({}(), 0);
- 8 | ({} = 0);"
+ 8 | ({} = 0);
+Cause: Unexpected token :"
`;
exports[`expression.js [flow] format 1`] = `
@@ -120,7 +123,8 @@ exports[`expression.js [meriyah] format 1`] = `
| ^
6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0);
7 | ({}(), 0);
- 8 | ({} = 0);"
+ 8 | ({} = 0);
+Cause: [5:4]: Expected ')'"
`;
exports[`expression.js [typescript] format 1`] = `
@@ -131,7 +135,8 @@ exports[`expression.js [typescript] format 1`] = `
| ^
6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0);
7 | ({}(), 0);
- 8 | ({} = 0);"
+ 8 | ({} = 0);
+Cause: ')' expected."
`;
exports[`expression.js format 1`] = `
diff --git a/tests/format/js/optional-chaining-assignment/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/optional-chaining-assignment/__snapshots__/jsfmt.spec.js.snap
index a805cf434..2b0544122 100644
--- a/tests/format/js/optional-chaining-assignment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/optional-chaining-assignment/__snapshots__/jsfmt.spec.js.snap
@@ -4,350 +4,400 @@ exports[`invalid-destructuring-arr.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of array destructuring pattern. (1:2)
> 1 | [a?.b] = [];
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of array destructuring pattern. (1:1)"
`;
exports[`invalid-destructuring-arr.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:2)
> 1 | [a?.b] = [];
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:1)"
`;
exports[`invalid-destructuring-arr.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of array destructuring pattern. (1:2)
> 1 | [a?.b] = [];
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of array destructuring pattern. (1:1)"
`;
exports[`invalid-destructuring-arr.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:2)
> 1 | [a?.b] = [];
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-destructuring-arr.js [meriyah] format 1`] = `
"Invalid left-hand side in assignment (1:10)
> 1 | [a?.b] = [];
| ^
- 2 |"
+ 2 |
+Cause: [1:10]: Invalid left-hand side in assignment"
`;
exports[`invalid-destructuring-obj.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of object destructuring pattern. (1:10)
> 1 | ({ prop: a?.b } = {});
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of object destructuring pattern. (1:9)"
`;
exports[`invalid-destructuring-obj.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:10)
> 1 | ({ prop: a?.b } = {});
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:9)"
`;
exports[`invalid-destructuring-obj.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of object destructuring pattern. (1:10)
> 1 | ({ prop: a?.b } = {});
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of object destructuring pattern. (1:9)"
`;
exports[`invalid-destructuring-obj.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:10)
> 1 | ({ prop: a?.b } = {});
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-destructuring-obj.js [meriyah] format 1`] = `
"Invalid left-hand side in assignment (1:19)
> 1 | ({ prop: a?.b } = {});
| ^
- 2 |"
+ 2 |
+Cause: [1:19]: Invalid left-hand side in assignment"
`;
exports[`invalid-fn-param.js [__babel_estree] format 1`] = `
"Unexpected token, expected "," (1:13)
> 1 | function f(a?.b) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token, expected "," (1:12)"
`;
exports[`invalid-fn-param.js [acorn] format 1`] = `
"Unexpected token (1:13)
> 1 | function f(a?.b) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:12)"
`;
exports[`invalid-fn-param.js [babel] format 1`] = `
"Unexpected token, expected "," (1:13)
> 1 | function f(a?.b) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token, expected "," (1:12)"
`;
exports[`invalid-fn-param.js [espree] format 1`] = `
"Unexpected token ?. (1:13)
> 1 | function f(a?.b) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ?."
`;
exports[`invalid-fn-param.js [meriyah] format 1`] = `
"Expected ')' (1:14)
> 1 | function f(a?.b) {}
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Expected ')'"
`;
exports[`invalid-fn-param-arrow.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of function parameter list. (1:2)
> 1 | (a?.b) => {}
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of function parameter list. (1:1)"
`;
exports[`invalid-fn-param-arrow.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:2)
> 1 | (a?.b) => {}
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:1)"
`;
exports[`invalid-fn-param-arrow.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of function parameter list. (1:2)
> 1 | (a?.b) => {}
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of function parameter list. (1:1)"
`;
exports[`invalid-fn-param-arrow.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:2)
> 1 | (a?.b) => {}
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-fn-param-arrow.js [meriyah] format 1`] = `
"The left-hand side of the arrow can only be destructed through assignment (1:9)
> 1 | (a?.b) => {}
| ^
- 2 |"
+ 2 |
+Cause: [1:9]: The left-hand side of the arrow can only be destructed through assignment"
`;
exports[`invalid-fn-param-assign.js [__babel_estree] format 1`] = `
"Unexpected token, expected "," (1:13)
> 1 | function f(a?.b = c) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token, expected "," (1:12)"
`;
exports[`invalid-fn-param-assign.js [acorn] format 1`] = `
"Unexpected token (1:13)
> 1 | function f(a?.b = c) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:12)"
`;
exports[`invalid-fn-param-assign.js [babel] format 1`] = `
"Unexpected token, expected "," (1:13)
> 1 | function f(a?.b = c) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token, expected "," (1:12)"
`;
exports[`invalid-fn-param-assign.js [espree] format 1`] = `
"Unexpected token ?. (1:13)
> 1 | function f(a?.b = c) {}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ?."
`;
exports[`invalid-fn-param-assign.js [meriyah] format 1`] = `
"Expected ')' (1:14)
> 1 | function f(a?.b = c) {}
| ^
- 2 |"
+ 2 |
+Cause: [1:14]: Expected ')'"
`;
exports[`invalid-for-await-of.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of for-of statement. (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of for-of statement. (1:5)"
`;
exports[`invalid-for-await-of.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:5)"
`;
exports[`invalid-for-await-of.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of for-of statement. (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of for-of statement. (1:5)"
`;
exports[`invalid-for-await-of.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-for-await-of.js [meriyah] format 1`] = `
"Invalid left-hand side in for-of (1:12)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: [1:12]: Invalid left-hand side in for-of"
`;
exports[`invalid-for-in.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of for-in statement. (1:6)
> 1 | for (a?.b in x);
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of for-in statement. (1:5)"
`;
exports[`invalid-for-in.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:6)
> 1 | for (a?.b in x);
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:5)"
`;
exports[`invalid-for-in.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of for-in statement. (1:6)
> 1 | for (a?.b in x);
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of for-in statement. (1:5)"
`;
exports[`invalid-for-in.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:6)
> 1 | for (a?.b in x);
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-for-in.js [meriyah] format 1`] = `
"Invalid left-hand side in for-in (1:12)
> 1 | for (a?.b in x);
| ^
- 2 |"
+ 2 |
+Cause: [1:12]: Invalid left-hand side in for-in"
`;
exports[`invalid-for-of.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of for-of statement. (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of for-of statement. (1:5)"
`;
exports[`invalid-for-of.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:5)"
`;
exports[`invalid-for-of.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of for-of statement. (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of for-of statement. (1:5)"
`;
exports[`invalid-for-of.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:6)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-for-of.js [meriyah] format 1`] = `
"Invalid left-hand side in for-of (1:12)
> 1 | for (a?.b of x);
| ^
- 2 |"
+ 2 |
+Cause: [1:12]: Invalid left-hand side in for-of"
`;
exports[`invalid-inc-postfix.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | a?.b++;
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of postfix operation. (1:0)"
`;
exports[`invalid-inc-postfix.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | a?.b++;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:0)"
`;
exports[`invalid-inc-postfix.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | a?.b++;
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of postfix operation. (1:0)"
`;
exports[`invalid-inc-postfix.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | a?.b++;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-inc-postfix.js [meriyah] format 1`] = `
"Invalid increment/decrement operand (1:6)
> 1 | a?.b++;
| ^
- 2 |"
+ 2 |
+Cause: [1:6]: Invalid increment/decrement operand"
`;
exports[`invalid-inc-prefix.js [__babel_estree] format 1`] = `
"Invalid optional chaining in the left-hand side of prefix operation. (1:3)
> 1 | ++a?.b;
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of prefix operation. (1:2)"
`;
exports[`invalid-inc-prefix.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:3)
> 1 | ++a?.b;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:2)"
`;
exports[`invalid-inc-prefix.js [babel] format 1`] = `
"Invalid optional chaining in the left-hand side of prefix operation. (1:3)
> 1 | ++a?.b;
| ^
- 2 |"
+ 2 |
+Cause: Invalid optional chaining in the left-hand side of prefix operation. (1:2)"
`;
exports[`invalid-inc-prefix.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:3)
> 1 | ++a?.b;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`invalid-inc-prefix.js [meriyah] format 1`] = `
"Invalid increment/decrement operand (1:7)
> 1 | ++a?.b;
| ^
- 2 |"
+ 2 |
+Cause: [1:7]: Invalid increment/decrement operand"
`;
exports[`valid-complex-case.js [acorn] format 1`] = `
@@ -355,7 +405,8 @@ exports[`valid-complex-case.js [acorn] format 1`] = `
> 1 | let?.()[a] =1;
| ^
2 | let?.[a] = 1;
- 3 |"
+ 3 |
+Cause: The keyword 'let' is reserved (1:0)"
`;
exports[`valid-complex-case.js [espree] format 1`] = `
@@ -363,7 +414,8 @@ exports[`valid-complex-case.js [espree] format 1`] = `
> 1 | let?.()[a] =1;
| ^
2 | let?.[a] = 1;
- 3 |"
+ 3 |
+Cause: The keyword 'let' is reserved"
`;
exports[`valid-complex-case.js [meriyah] format 1`] = `
@@ -371,7 +423,8 @@ exports[`valid-complex-case.js [meriyah] format 1`] = `
> 1 | let?.()[a] =1;
| ^
2 | let?.[a] = 1;
- 3 |"
+ 3 |
+Cause: [1:5]: \`let\` declaration not allowed here and \`let\` cannot be a regular var name in strict mode"
`;
exports[`valid-complex-case.js format 1`] = `
@@ -394,14 +447,16 @@ exports[`valid-lhs-eq.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | a?.b.c = d;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:0)"
`;
exports[`valid-lhs-eq.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | a?.b.c = d;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`valid-lhs-eq.js format 1`] = `
@@ -422,14 +477,16 @@ exports[`valid-lhs-plus-eq.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | a?.b.c += d;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:0)"
`;
exports[`valid-lhs-plus-eq.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:1)
> 1 | a?.b.c += d;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`valid-lhs-plus-eq.js format 1`] = `
@@ -450,21 +507,24 @@ exports[`valid-parenthesized.js [acorn] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:2)
> 1 | (a?.b) = c;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side (1:1)"
`;
exports[`valid-parenthesized.js [espree] format 1`] = `
"Optional chaining cannot appear in left-hand side (1:2)
> 1 | (a?.b) = c;
| ^
- 2 |"
+ 2 |
+Cause: Optional chaining cannot appear in left-hand side"
`;
exports[`valid-parenthesized.js [meriyah] format 1`] = `
"Invalid left-hand side in assignment (1:8)
> 1 | (a?.b) = c;
| ^
- 2 |"
+ 2 |
+Cause: [1:8]: Invalid left-hand side in assignment"
`;
exports[`valid-parenthesized.js format 1`] = `
diff --git a/tests/format/js/partial-application/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/partial-application/__snapshots__/jsfmt.spec.js.snap
index de5ca9608..534fd87c8 100644
--- a/tests/format/js/partial-application/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/partial-application/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`test.js [acorn] format 1`] = `
| ^
2 | addOne(2); // 3
3 |
- 4 | const addTen = add(?, 10); // apply from the right"
+ 4 | const addTen = add(?, 10); // apply from the right
+Cause: Unexpected token (1:22)"
`;
exports[`test.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`test.js [espree] format 1`] = `
| ^
2 | addOne(2); // 3
3 |
- 4 | const addTen = add(?, 10); // apply from the right"
+ 4 | const addTen = add(?, 10); // apply from the right
+Cause: Unexpected token ?"
`;
exports[`test.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`test.js [meriyah] format 1`] = `
| ^
2 | addOne(2); // 3
3 |
- 4 | const addTen = add(?, 10); // apply from the right"
+ 4 | const addTen = add(?, 10); // apply from the right
+Cause: [1:23]: Unexpected token: '?'"
`;
exports[`test.js format 1`] = `
diff --git a/tests/format/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap
index c532009d4..4d736530d 100644
--- a/tests/format/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`block-comments.js [acorn] format 1`] = `
| ^
3 | |> foo2 /* comment1 */
4 | |> foo3 /* comment2 */
- 5 | |> kochabCooieGameOnOboleUnweave"
+ 5 | |> kochabCooieGameOnOboleUnweave
+Cause: Unexpected token (2:1)"
`;
exports[`block-comments.js [espree] format 1`] = `
@@ -17,7 +18,8 @@ exports[`block-comments.js [espree] format 1`] = `
| ^
3 | |> foo2 /* comment1 */
4 | |> foo3 /* comment2 */
- 5 | |> kochabCooieGameOnOboleUnweave"
+ 5 | |> kochabCooieGameOnOboleUnweave
+Cause: Unexpected token >"
`;
exports[`block-comments.js [meriyah] format 1`] = `
@@ -27,7 +29,8 @@ exports[`block-comments.js [meriyah] format 1`] = `
| ^
3 | |> foo2 /* comment1 */
4 | |> foo3 /* comment2 */
- 5 | |> kochabCooieGameOnOboleUnweave"
+ 5 | |> kochabCooieGameOnOboleUnweave
+Cause: [2:2]: Unexpected token: '>'"
`;
exports[`block-comments.js format 1`] = `
@@ -61,7 +64,8 @@ exports[`fsharp_style_pipeline_operator.js [acorn] format 1`] = `
| ^
3 | |> x => doubleSay(x, ', ')
4 | |> capitalize
- 5 | |> x => x + '!'"
+ 5 | |> x => x + '!'
+Cause: Unexpected token (2:3)"
`;
exports[`fsharp_style_pipeline_operator.js [espree] format 1`] = `
@@ -71,7 +75,8 @@ exports[`fsharp_style_pipeline_operator.js [espree] format 1`] = `
| ^
3 | |> x => doubleSay(x, ', ')
4 | |> capitalize
- 5 | |> x => x + '!'"
+ 5 | |> x => x + '!'
+Cause: Unexpected token >"
`;
exports[`fsharp_style_pipeline_operator.js [meriyah] format 1`] = `
@@ -81,7 +86,8 @@ exports[`fsharp_style_pipeline_operator.js [meriyah] format 1`] = `
| ^
3 | |> x => doubleSay(x, ', ')
4 | |> capitalize
- 5 | |> x => x + '!'"
+ 5 | |> x => x + '!'
+Cause: [2:4]: Unexpected token: '>'"
`;
exports[`fsharp_style_pipeline_operator.js format 1`] = `
@@ -185,7 +191,8 @@ exports[`hack_pipeline_operator.js [acorn] format 1`] = `
| ^
2 |
3 | foo
- 4 | |> await %"
+ 4 | |> await %
+Cause: Unexpected token (1:3)"
`;
exports[`hack_pipeline_operator.js [espree] format 1`] = `
@@ -194,7 +201,8 @@ exports[`hack_pipeline_operator.js [espree] format 1`] = `
| ^
2 |
3 | foo
- 4 | |> await %"
+ 4 | |> await %
+Cause: Unexpected token >"
`;
exports[`hack_pipeline_operator.js [meriyah] format 1`] = `
@@ -203,7 +211,8 @@ exports[`hack_pipeline_operator.js [meriyah] format 1`] = `
| ^
2 |
3 | foo
- 4 | |> await %"
+ 4 | |> await %
+Cause: [1:4]: Unexpected token: '>'"
`;
exports[`hack_pipeline_operator.js format 1`] = `
@@ -326,7 +335,8 @@ exports[`minimal_pipeline_operator.js [acorn] format 1`] = `
| ^
2 |
3 | a |> (b |> c);
- 4 |"
+ 4 |
+Cause: Unexpected token (1:3)"
`;
exports[`minimal_pipeline_operator.js [espree] format 1`] = `
@@ -335,7 +345,8 @@ exports[`minimal_pipeline_operator.js [espree] format 1`] = `
| ^
2 |
3 | a |> (b |> c);
- 4 |"
+ 4 |
+Cause: Unexpected token >"
`;
exports[`minimal_pipeline_operator.js [meriyah] format 1`] = `
@@ -344,7 +355,8 @@ exports[`minimal_pipeline_operator.js [meriyah] format 1`] = `
| ^
2 |
3 | a |> (b |> c);
- 4 |"
+ 4 |
+Cause: [1:4]: Unexpected token: '>'"
`;
exports[`minimal_pipeline_operator.js format 1`] = `
diff --git a/tests/format/js/private-in/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/private-in/__snapshots__/jsfmt.spec.js.snap
index 7d384bd0d..a0bd23767 100644
--- a/tests/format/js/private-in/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/private-in/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`private-in.js [acorn] format 1`] = `
| ^
2 | }
3 |
- 4 | #prop in obj;"
+ 4 | #prop in obj;
+Cause: Unexpected token (1:4)"
`;
exports[`private-in.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`private-in.js [espree] format 1`] = `
| ^
2 | }
3 |
- 4 | #prop in obj;"
+ 4 | #prop in obj;
+Cause: Unexpected token #prop"
`;
exports[`private-in.js format 1`] = `
diff --git a/tests/format/js/record/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/record/__snapshots__/jsfmt.spec.js.snap
index 066838221..a5a3007ea 100644
--- a/tests/format/js/record/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/record/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`computed.js [acorn] format 1`] = `
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
4 |
- 5 | assert(#{ [true]: 1 } === #{ true: 1 })"
+ 5 | assert(#{ [true]: 1 } === #{ true: 1 })
+Cause: Unexpected character '{' (2:8)"
`;
exports[`computed.js [espree] format 1`] = `
@@ -17,7 +18,8 @@ exports[`computed.js [espree] format 1`] = `
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
4 |
- 5 | assert(#{ [true]: 1 } === #{ true: 1 })"
+ 5 | assert(#{ [true]: 1 } === #{ true: 1 })
+Cause: Unexpected character '{'"
`;
exports[`computed.js [meriyah] format 1`] = `
@@ -27,7 +29,8 @@ exports[`computed.js [meriyah] format 1`] = `
| ^
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
4 |
- 5 | assert(#{ [true]: 1 } === #{ true: 1 })"
+ 5 | assert(#{ [true]: 1 } === #{ true: 1 })
+Cause: [2:8]: '#' not followed by identifier"
`;
exports[`computed.js format 1`] = `
@@ -66,7 +69,8 @@ exports[`destructuring.js [acorn] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 |"
+ 4 |
+Cause: Unexpected character '{' (1:18)"
`;
exports[`destructuring.js [espree] format 1`] = `
@@ -75,7 +79,8 @@ exports[`destructuring.js [espree] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 |"
+ 4 |
+Cause: Unexpected character '{'"
`;
exports[`destructuring.js [meriyah] format 1`] = `
@@ -84,7 +89,8 @@ exports[`destructuring.js [meriyah] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 |"
+ 4 |
+Cause: [1:18]: '#' not followed by identifier"
`;
exports[`destructuring.js format 1`] = `
@@ -123,7 +129,8 @@ exports[`record.js [acorn] format 1`] = `
| ^
2 | a: 1,
3 | b: 2,
- 4 | c: 3,"
+ 4 | c: 3,
+Cause: Unexpected character '{' (1:17)"
`;
exports[`record.js [espree] format 1`] = `
@@ -132,7 +139,8 @@ exports[`record.js [espree] format 1`] = `
| ^
2 | a: 1,
3 | b: 2,
- 4 | c: 3,"
+ 4 | c: 3,
+Cause: Unexpected character '{'"
`;
exports[`record.js [meriyah] format 1`] = `
@@ -141,7 +149,8 @@ exports[`record.js [meriyah] format 1`] = `
| ^
2 | a: 1,
3 | b: 2,
- 4 | c: 3,"
+ 4 | c: 3,
+Cause: [1:17]: '#' not followed by identifier"
`;
exports[`record.js format 1`] = `
@@ -194,7 +203,8 @@ exports[`shorthand.js [acorn] format 1`] = `
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
- 4 |"
+ 4 |
+Cause: Unexpected character '{' (2:16)"
`;
exports[`shorthand.js [espree] format 1`] = `
@@ -203,7 +213,8 @@ exports[`shorthand.js [espree] format 1`] = `
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
- 4 |"
+ 4 |
+Cause: Unexpected character '{'"
`;
exports[`shorthand.js [meriyah] format 1`] = `
@@ -212,7 +223,8 @@ exports[`shorthand.js [meriyah] format 1`] = `
> 2 | const record = #{ url }
| ^
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
- 4 |"
+ 4 |
+Cause: [2:16]: '#' not followed by identifier"
`;
exports[`shorthand.js format 1`] = `
@@ -239,7 +251,8 @@ exports[`spread.js [acorn] format 1`] = `
| ^
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
3 | const taskLater = #{ ...taskNow, status: "DONE" }
- 4 |"
+ 4 |
+Cause: Unexpected character '{' (1:18)"
`;
exports[`spread.js [espree] format 1`] = `
@@ -248,7 +261,8 @@ exports[`spread.js [espree] format 1`] = `
| ^
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
3 | const taskLater = #{ ...taskNow, status: "DONE" }
- 4 |"
+ 4 |
+Cause: Unexpected character '{'"
`;
exports[`spread.js [meriyah] format 1`] = `
@@ -257,7 +271,8 @@ exports[`spread.js [meriyah] format 1`] = `
| ^
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
3 | const taskLater = #{ ...taskNow, status: "DONE" }
- 4 |"
+ 4 |
+Cause: [1:18]: '#' not followed by identifier"
`;
exports[`spread.js format 1`] = `
@@ -290,7 +305,8 @@ exports[`syntax.js [acorn] format 1`] = `
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
- 4 |"
+ 4 |
+Cause: Unexpected character '{' (1:1)"
`;
exports[`syntax.js [espree] format 1`] = `
@@ -299,7 +315,8 @@ exports[`syntax.js [espree] format 1`] = `
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
- 4 |"
+ 4 |
+Cause: Unexpected character '{'"
`;
exports[`syntax.js [meriyah] format 1`] = `
@@ -308,7 +325,8 @@ exports[`syntax.js [meriyah] format 1`] = `
| ^
2 | #{ a: 1, b: 2 }
3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] }
- 4 |"
+ 4 |
+Cause: [1:1]: '#' not followed by identifier"
`;
exports[`syntax.js format 1`] = `
diff --git a/tests/format/js/regex/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/regex/__snapshots__/jsfmt.spec.js.snap
index bd5699df4..fadd9276f 100644
--- a/tests/format/js/regex/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/regex/__snapshots__/jsfmt.spec.js.snap
@@ -36,7 +36,8 @@ exports[`regexp-modifiers.js [acorn] format 1`] = `
| ^
2 | /(?-ims:^[a-z].)(^[a-z].)/uims;
3 | /(?ims:^[a-z].1$)/;
- 4 |"
+ 4 |
+Cause: Invalid regular expression: /(?ims:^[a-z])/: Invalid group (1:1)"
`;
exports[`regexp-modifiers.js [espree] format 1`] = `
@@ -45,7 +46,8 @@ exports[`regexp-modifiers.js [espree] format 1`] = `
| ^
2 | /(?-ims:^[a-z].)(^[a-z].)/uims;
3 | /(?ims:^[a-z].1$)/;
- 4 |"
+ 4 |
+Cause: Invalid regular expression: /(?ims:^[a-z])/: Invalid group"
`;
exports[`regexp-modifiers.js [meriyah] format 1`] = `
@@ -54,7 +56,8 @@ exports[`regexp-modifiers.js [meriyah] format 1`] = `
| ^
2 | /(?-ims:^[a-z].)(^[a-z].)/uims;
3 | /(?ims:^[a-z].1$)/;
- 4 |"
+ 4 |
+Cause: [1:16]: Unterminated regular expression"
`;
exports[`regexp-modifiers.js format 1`] = `
@@ -100,7 +103,8 @@ exports[`v-flag.js [meriyah] format 1`] = `
"Unexpected regular expression flag (1:3)
> 1 | /a/v;
| ^
- 2 |"
+ 2 |
+Cause: [1:3]: Unexpected regular expression flag"
`;
exports[`v-flag.js format 1`] = `
diff --git a/tests/format/js/sloppy-mode/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/sloppy-mode/__snapshots__/jsfmt.spec.js.snap
index 78a0d596b..0b8385d1b 100644
--- a/tests/format/js/sloppy-mode/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/sloppy-mode/__snapshots__/jsfmt.spec.js.snap
@@ -77,14 +77,16 @@ exports[`function-declaration-in-while.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | while (false) function foo(){}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`function-declaration-in-while.js [espree] format 1`] = `
"Unexpected token function (1:15)
> 1 | while (false) function foo(){}
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token function"
`;
exports[`function-declaration-in-while.js [flow] format 1`] = `
@@ -98,7 +100,8 @@ exports[`function-declaration-in-while.js [meriyah] format 1`] = `
"In strict mode code, functions can only be declared at top level or inside a block (1:22)
> 1 | while (false) function foo(){}
| ^
- 2 |"
+ 2 |
+Cause: [1:22]: In strict mode code, functions can only be declared at top level or inside a block"
`;
exports[`function-declaration-in-while.js format 1`] = `
diff --git a/tests/format/js/source-phase-imports/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/source-phase-imports/__snapshots__/jsfmt.spec.js.snap
index 70cd79bfc..8d5c332b7 100644
--- a/tests/format/js/source-phase-imports/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/source-phase-imports/__snapshots__/jsfmt.spec.js.snap
@@ -18,21 +18,24 @@ exports[`import-source.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import source x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`import-source.js [espree] format 1`] = `
"Unexpected token x (1:15)
> 1 | import source x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token x"
`;
exports[`import-source.js [meriyah] format 1`] = `
"Import source must be string (1:15)
> 1 | import source x from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:15]: Import source must be string"
`;
exports[`import-source.js format 1`] = `
@@ -53,21 +56,24 @@ exports[`import-source-attributes-declaration.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import source s from "x" with { attr: "val" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`import-source-attributes-declaration.js [espree] format 1`] = `
"Unexpected token s (1:15)
> 1 | import source s from "x" with { attr: "val" };
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token s"
`;
exports[`import-source-attributes-declaration.js [meriyah] format 1`] = `
"Import source must be string (1:15)
> 1 | import source s from "x" with { attr: "val" };
| ^
- 2 |"
+ 2 |
+Cause: [1:15]: Import source must be string"
`;
exports[`import-source-attributes-declaration.js format 1`] = `
@@ -88,21 +94,24 @@ exports[`import-source-attributes-expression.js [acorn] format 1`] = `
"The only valid meta property for import is 'import.meta' (1:8)
> 1 | import.source("x", { with: { attr: "val" } });
| ^
- 2 |"
+ 2 |
+Cause: The only valid meta property for import is 'import.meta' (1:7)"
`;
exports[`import-source-attributes-expression.js [espree] format 1`] = `
"The only valid meta property for import is 'import.meta' (1:8)
> 1 | import.source("x", { with: { attr: "val" } });
| ^
- 2 |"
+ 2 |
+Cause: The only valid meta property for import is 'import.meta'"
`;
exports[`import-source-attributes-expression.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:13)
> 1 | import.source("x", { with: { attr: "val" } });
| ^
- 2 |"
+ 2 |
+Cause: [1:13]: Unexpected token: 'identifier'"
`;
exports[`import-source-attributes-expression.js format 1`] = `
@@ -123,21 +132,24 @@ exports[`import-source-binding-from.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import source from from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:19)"
`;
exports[`import-source-binding-from.js [espree] format 1`] = `
"Unexpected token from (1:20)
> 1 | import source from from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token from"
`;
exports[`import-source-binding-from.js [meriyah] format 1`] = `
"Import source must be string (1:23)
> 1 | import source from from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:23]: Import source must be string"
`;
exports[`import-source-binding-from.js format 1`] = `
@@ -158,21 +170,24 @@ exports[`import-source-binding-source.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import source source from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`import-source-binding-source.js [espree] format 1`] = `
"Unexpected token source (1:15)
> 1 | import source source from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token source"
`;
exports[`import-source-binding-source.js [meriyah] format 1`] = `
"Import source must be string (1:20)
> 1 | import source source from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:20]: Import source must be string"
`;
exports[`import-source-binding-source.js format 1`] = `
@@ -193,21 +208,24 @@ exports[`import-source-dynamic-import.js [acorn] format 1`] = `
"The only valid meta property for import is 'import.meta' (1:8)
> 1 | import.source("foo");
| ^
- 2 |"
+ 2 |
+Cause: The only valid meta property for import is 'import.meta' (1:7)"
`;
exports[`import-source-dynamic-import.js [espree] format 1`] = `
"The only valid meta property for import is 'import.meta' (1:8)
> 1 | import.source("foo");
| ^
- 2 |"
+ 2 |
+Cause: The only valid meta property for import is 'import.meta'"
`;
exports[`import-source-dynamic-import.js [meriyah] format 1`] = `
"Unexpected token: 'identifier' (1:13)
> 1 | import.source("foo");
| ^
- 2 |"
+ 2 |
+Cause: [1:13]: Unexpected token: 'identifier'"
`;
exports[`import-source-dynamic-import.js format 1`] = `
@@ -228,68 +246,78 @@ exports[`no-named.js [__babel_estree] format 1`] = `
"Only \`import source x from "./module"\` is valid. (1:17)
> 1 | import source { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import source x from "./module"\` is valid. (1:16)"
`;
exports[`no-named.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import source { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`no-named.js [babel] format 1`] = `
"Only \`import source x from "./module"\` is valid. (1:17)
> 1 | import source { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import source x from "./module"\` is valid. (1:16)"
`;
exports[`no-named.js [espree] format 1`] = `
"Unexpected token { (1:15)
> 1 | import source { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token {"
`;
exports[`no-named.js [meriyah] format 1`] = `
"Import source must be string (1:15)
> 1 | import source { x } from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:15]: Import source must be string"
`;
exports[`no-namespace.js [__babel_estree] format 1`] = `
"Only \`import source x from "./module"\` is valid. (1:15)
> 1 | import source * as x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import source x from "./module"\` is valid. (1:14)"
`;
exports[`no-namespace.js [acorn] format 1`] = `
"Unexpected token (1:15)
> 1 | import source * as x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token (1:14)"
`;
exports[`no-namespace.js [babel] format 1`] = `
"Only \`import source x from "./module"\` is valid. (1:15)
> 1 | import source * as x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Only \`import source x from "./module"\` is valid. (1:14)"
`;
exports[`no-namespace.js [espree] format 1`] = `
"Unexpected token * (1:15)
> 1 | import source * as x from "x";
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token *"
`;
exports[`no-namespace.js [meriyah] format 1`] = `
"Import source must be string (1:15)
> 1 | import source * as x from "x";
| ^
- 2 |"
+ 2 |
+Cause: [1:15]: Import source must be string"
`;
diff --git a/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap
index 70ea41b3b..c3a825e87 100644
--- a/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap
@@ -120,7 +120,8 @@ exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [acorn] format 1`
| ^
4 | () => {
5 | "use strict";
- 6 | "\\8", "\\9";"
+ 6 | "\\8", "\\9";
+Cause: Invalid escape sequence (3:2)"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1`] = `
@@ -131,7 +132,8 @@ exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1
| ^
4 | () => {
5 | "use strict";
- 6 | "\\8", "\\9";"
+ 6 | "\\8", "\\9";
+Cause: Invalid escape sequence"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} format 1`] = `
@@ -169,7 +171,8 @@ exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} [acorn] format 1`
| ^
4 | () => {
5 | "use strict";
- 6 | "\\8", "\\9";"
+ 6 | "\\8", "\\9";
+Cause: Invalid escape sequence (3:2)"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} [espree] format 1`] = `
@@ -180,7 +183,8 @@ exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} [espree] format 1
| ^
4 | () => {
5 | "use strict";
- 6 | "\\8", "\\9";"
+ 6 | "\\8", "\\9";
+Cause: Invalid escape sequence"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} format 1`] = `
diff --git a/tests/format/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap
index f1daf3964..a23a08385 100644
--- a/tests/format/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`throw_expression.js [acorn] format 1`] = `
| ^
2 |
3 | lint(ast, {
- 4 | with: () => throw new Error("avoid using 'with' statements.")"
+ 4 | with: () => throw new Error("avoid using 'with' statements.")
+Cause: Unexpected token (1:25)"
`;
exports[`throw_expression.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`throw_expression.js [espree] format 1`] = `
| ^
2 |
3 | lint(ast, {
- 4 | with: () => throw new Error("avoid using 'with' statements.")"
+ 4 | with: () => throw new Error("avoid using 'with' statements.")
+Cause: Unexpected token throw"
`;
exports[`throw_expression.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`throw_expression.js [meriyah] format 1`] = `
| ^
2 |
3 | lint(ast, {
- 4 | with: () => throw new Error("avoid using 'with' statements.")"
+ 4 | with: () => throw new Error("avoid using 'with' statements.")
+Cause: [1:30]: Unexpected token: 'throw'"
`;
exports[`throw_expression.js format 1`] = `
diff --git a/tests/format/js/tuple/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/tuple/__snapshots__/jsfmt.spec.js.snap
index d1bcea401..0ff3c3842 100644
--- a/tests/format/js/tuple/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/tuple/__snapshots__/jsfmt.spec.js.snap
@@ -6,7 +6,8 @@ exports[`destructuring.js [acorn] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 |"
+ 4 |
+Cause: Unexpected character '[' (1:16)"
`;
exports[`destructuring.js [espree] format 1`] = `
@@ -15,7 +16,8 @@ exports[`destructuring.js [espree] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 |"
+ 4 |
+Cause: Unexpected character '['"
`;
exports[`destructuring.js [meriyah] format 1`] = `
@@ -24,7 +26,8 @@ exports[`destructuring.js [meriyah] format 1`] = `
| ^
2 | assert(a === 1);
3 | assert(b === 2);
- 4 |"
+ 4 |
+Cause: [1:16]: '#' not followed by identifier"
`;
exports[`destructuring.js format 1`] = `
@@ -61,35 +64,40 @@ exports[`invalid-tuple-holes.js [__babel_estree] format 1`] = `
"Unexpected token ','. (1:4)
> 1 | #[,]
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ','. (1:3)"
`;
exports[`invalid-tuple-holes.js [acorn] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[,]
| ^
- 2 |"
+ 2 |
+Cause: Unexpected character '[' (1:1)"
`;
exports[`invalid-tuple-holes.js [babel] format 1`] = `
"Unexpected token ','. (1:4)
> 1 | #[,]
| ^
- 2 |"
+ 2 |
+Cause: Unexpected token ','. (1:3)"
`;
exports[`invalid-tuple-holes.js [espree] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[,]
| ^
- 2 |"
+ 2 |
+Cause: Unexpected character '['"
`;
exports[`invalid-tuple-holes.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:1)
> 1 | #[,]
| ^
- 2 |"
+ 2 |
+Cause: [1:1]: '#' not followed by identifier"
`;
exports[`syntax.js [acorn] format 1`] = `
@@ -98,7 +106,8 @@ exports[`syntax.js [acorn] format 1`] = `
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
- 4 |"
+ 4 |
+Cause: Unexpected character '[' (1:1)"
`;
exports[`syntax.js [espree] format 1`] = `
@@ -107,7 +116,8 @@ exports[`syntax.js [espree] format 1`] = `
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
- 4 |"
+ 4 |
+Cause: Unexpected character '['"
`;
exports[`syntax.js [meriyah] format 1`] = `
@@ -116,7 +126,8 @@ exports[`syntax.js [meriyah] format 1`] = `
| ^
2 | #[1, 2]
3 | #[1, 2, #{ a: 3 }]
- 4 |"
+ 4 |
+Cause: [1:1]: '#' not followed by identifier"
`;
exports[`syntax.js format 1`] = `
@@ -143,7 +154,8 @@ exports[`tuple.js [acorn] format 1`] = `
| ^
2 |
3 | assert(tuple1[0] === 1);
- 4 |"
+ 4 |
+Cause: Unexpected character '[' (1:16)"
`;
exports[`tuple.js [espree] format 1`] = `
@@ -152,7 +164,8 @@ exports[`tuple.js [espree] format 1`] = `
| ^
2 |
3 | assert(tuple1[0] === 1);
- 4 |"
+ 4 |
+Cause: Unexpected character '['"
`;
exports[`tuple.js [meriyah] format 1`] = `
@@ -161,7 +174,8 @@ exports[`tuple.js [meriyah] format 1`] = `
| ^
2 |
3 | assert(tuple1[0] === 1);
- 4 |"
+ 4 |
+Cause: [1:16]: '#' not followed by identifier"
`;
exports[`tuple.js format 1`] = `
@@ -214,21 +228,24 @@ exports[`tuple-trailing-comma.js [acorn] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[1,]
| ^
- 2 |"
+ 2 |
+Cause: Unexpected character '[' (1:1)"
`;
exports[`tuple-trailing-comma.js [espree] format 1`] = `
"Unexpected character '[' (1:2)
> 1 | #[1,]
| ^
- 2 |"
+ 2 |
+Cause: Unexpected character '['"
`;
exports[`tuple-trailing-comma.js [meriyah] format 1`] = `
"'#' not followed by identifier (1:1)
> 1 | #[1,]
| ^
- 2 |"
+ 2 |
+Cause: [1:1]: '#' not followed by identifier"
`;
exports[`tuple-trailing-comma.js format 1`] = `
diff --git a/tests/format/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap
index edd7e8084..bd28b02ea 100644
--- a/tests/format/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap
@@ -5,7 +5,8 @@ exports[`avoid-conflicts-to-pipeline.js [acorn] format 1`] = `
1 | // |>
> 2 | const status = %GetOptimizationStatus(fn);
| ^
- 3 |"
+ 3 |
+Cause: Unexpected token (2:15)"
`;
exports[`avoid-conflicts-to-pipeline.js [espree] format 1`] = `
@@ -13,7 +14,8 @@ exports[`avoid-conflicts-to-pipeline.js [espree] format 1`] = `
1 | // |>
> 2 | const status = %GetOptimizationStatus(fn);
| ^
- 3 |"
+ 3 |
+Cause: Unexpected token %"
`;
exports[`avoid-conflicts-to-pipeline.js [meriyah] format 1`] = `
@@ -21,7 +23,8 @@ exports[`avoid-conflicts-to-pipeline.js [meriyah] format 1`] = `
1 | // |>
> 2 | const status = %GetOptimizationStatus(fn);
| ^
- 3 |"
+ 3 |
+Cause: [2:16]: Unexpected token: '%'"
`;
exports[`avoid-conflicts-to-pipeline.js format 1`] = `
@@ -47,7 +50,8 @@ exports[`intrinsic_call.js [acorn] format 1`] = `
| ^
3 | (
4 | foo )
- 5 | }"
+ 5 | }
+Cause: Unexpected token (2:12)"
`;
exports[`intrinsic_call.js [espree] format 1`] = `
@@ -57,7 +61,8 @@ exports[`intrinsic_call.js [espree] format 1`] = `
| ^
3 | (
4 | foo )
- 5 | }"
+ 5 | }
+Cause: Unexpected token %"
`;
exports[`intrinsic_call.js [meriyah] format 1`] = `
@@ -67,7 +72,8 @@ exports[`intrinsic_call.js [meriyah] format 1`] = `
| ^
3 | (
4 | foo )
- 5 | }"
+ 5 | }
+Cause: [2:13]: Unexpected token: '%'"
`;
exports[`intrinsic_call.js format 1`] = `
diff --git a/tests/format/jsx/comments/__snapshots__/jsfmt.spec.js.snap b/tests/format/jsx/comments/__snapshots__/jsfmt.spec.js.snap
index 2a32185d1..339d80baa 100644
--- a/tests/format/jsx/comments/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/jsx/comments/__snapshots__/jsfmt.spec.js.snap
@@ -90,7 +90,8 @@ exports[`in-end-tag.js - {"bracketSameLine":true} [meriyah] format 1`] = `
| ^
3 | /a>;
4 | * block */
- 5 | /a>;"
+ 5 | /a>;
+Cause: [2:11]: Expected '>'"
`;
exports[`in-end-tag.js - {"bracketSameLine":true} [typescript] format 1`] = `
@@ -100,7 +101,8 @@ exports[`in-end-tag.js - {"bracketSameLine":true} [typescript] format 1`] = `
| ^
3 | /a>;
4 | * block */
- 5 | /a>;"
+ 5 | /a>;
+Cause: Identifier expected."
`;
exports[`in-end-tag.js - {"bracketSameLine":true} format 1`] = `
diff --git a/tests/format/jsx/do/__snapshots__/jsfmt.spec.js.snap b/tests/format/jsx/do/__snapshots__/jsfmt.spec.js.snap
index 2b9b10722..b81de0a07 100644
--- a/tests/format/jsx/do/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/jsx/do/__snapshots__/jsfmt.spec.js.snap
@@ -7,7 +7,8 @@ exports[`do.js [acorn] format 1`] = `
| ^
3 | 1
4 | }}
- 5 |