diff --git a/src/language-handlebars/parser-glimmer.js b/src/language-handlebars/parser-glimmer.js index 6fb2369e4..0ab852dac 100644 --- a/src/language-handlebars/parser-glimmer.js +++ b/src/language-handlebars/parser-glimmer.js @@ -166,10 +166,13 @@ function getErrorLocation(error) { const { location, hash } = error; if (location) { const { start, end } = location; - if (typeof end.line !== "number") { - return { start }; - } - return location; + return { + start: { line: start.line, column: start.column + 1 }, + end: + typeof end.line === "number" + ? { line: end.line, column: end.column + 1 } + : undefined, + }; } if (hash) { diff --git a/src/language-js/parse/hermes.js b/src/language-js/parse/hermes.js index 360da6caa..c8820b664 100644 --- a/src/language-js/parse/hermes.js +++ b/src/language-js/parse/hermes.js @@ -21,7 +21,7 @@ function createParseError(error) { return createError(message, { loc: { - start: { line, column }, + start: { line, column: column + 1 }, }, cause: error, }); diff --git a/tests/format/flow-repo/ambient_declarations/__snapshots__/format.test.js.snap b/tests/format/flow-repo/ambient_declarations/__snapshots__/format.test.js.snap index ca77e27df..70ffd07f5 100644 --- a/tests/format/flow-repo/ambient_declarations/__snapshots__/format.test.js.snap +++ b/tests/format/flow-repo/ambient_declarations/__snapshots__/format.test.js.snap @@ -30,11 +30,11 @@ export { ComponentNamespace }; `; exports[`component_namespace.js format[hermes] 1`] = ` -"'{' expected in component declaration (4:48) +"'{' expected in component declaration (4:49) 2 | declare namespace ComponentNamespace { 3 | // Ambient component declarations with simple types > 4 | component Card(title: string, content: string); - | ^ + | ^ 5 | 6 | component Modal(isOpen: boolean, onClose: () => void); 7 | } @@ -75,11 +75,11 @@ declare export { Button, Input }; `; exports[`components.js.flow format[hermes] 1`] = ` -"'{' expected in component declaration (5:42) +"'{' expected in component declaration (5:43) 3 | 4 | // Ambient components without body - these should be allowed > 5 | component Button(props: { label: string }); - | ^ + | ^ 6 | 7 | component Input(value: string, onChange: (string) => void); 8 | @@ -122,11 +122,11 @@ export { ImplicitFunctions }; `; exports[`implicit_functions.js format[hermes] 1`] = ` -"'{' expected in function declaration (4:38) +"'{' expected in function declaration (4:39) 2 | declare namespace ImplicitFunctions { 3 | // Simple implicit declare functions > 4 | function greet(name: string): string; - | ^ + | ^ 5 | function add(a: number, b: number): number; 6 | 7 | // Explicit declare function still works @@ -193,11 +193,11 @@ export { MyNamespace }; `; exports[`namespace.js format[hermes] 1`] = ` -"missing initializer in const declaration (4:8) +"missing initializer in const declaration (4:9) 2 | declare namespace MyNamespace { 3 | // Implicit ambient variables (without 'declare' keyword) > 4 | const value: number; - | ^ + | ^ 5 | let mutableValue: string; 6 | 7 | // Implicit ambient functions (without 'declare' keyword) @@ -621,11 +621,11 @@ declare export { foo, bar, baz, genericVal, ambient, regular, withBoth }; `; exports[`variables.js.flow format[hermes] 1`] = ` -"missing initializer in const declaration (5:6) +"missing initializer in const declaration (5:7) 3 | 4 | // Implicit ambient declarations (without 'declare' keyword) > 5 | const foo: string; - | ^ + | ^ 6 | let bar: number; 7 | var baz: boolean; 8 | diff --git a/tests/format/flow-repo/ambient_declarations/flow-typed/__snapshots__/format.test.js.snap b/tests/format/flow-repo/ambient_declarations/flow-typed/__snapshots__/format.test.js.snap index 3374ed786..262f12725 100644 --- a/tests/format/flow-repo/ambient_declarations/flow-typed/__snapshots__/format.test.js.snap +++ b/tests/format/flow-repo/ambient_declarations/flow-typed/__snapshots__/format.test.js.snap @@ -26,11 +26,11 @@ declare module "component-library" { `; exports[`components.js format[hermes] 1`] = ` -"'{' expected in component declaration (3:33) +"'{' expected in component declaration (3:34) 1 | // Declare module with ambient components 2 | declare module 'component-library' { > 3 | component Button(label: string); - | ^ + | ^ 4 | component Icon(name: string); 5 | 6 | declare export { Button, Icon }; @@ -75,11 +75,11 @@ declare module "test-module" { `; exports[`lib.js format[hermes] 1`] = ` -"missing initializer in const declaration (4:8) +"missing initializer in const declaration (4:9) 2 | declare module 'test-module' { 3 | // Implicit ambient const/let/var (without 'declare' keyword) > 4 | const foo: string; - | ^ + | ^ 5 | let bar: number; 6 | var baz: boolean; 7 | diff --git a/tests/format/flow/_errors_/invalid-match/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/invalid-match/__snapshots__/format.test.js.snap index 1f7fdc7cd..d27f67e27 100644 --- a/tests/format/flow/_errors_/invalid-match/__snapshots__/format.test.js.snap +++ b/tests/format/flow/_errors_/invalid-match/__snapshots__/format.test.js.snap @@ -7,9 +7,9 @@ exports[`snippet: #0 format[flow] 1`] = ` `; exports[`snippet: #0 format[hermes] 1`] = ` -"'match' argument must not be empty (1:6) +"'match' argument must not be empty (1:7) > 1 | match () {} - | ^ + | ^ Cause: 'match' argument must not be empty (1:6) match () {} ^~" @@ -22,9 +22,9 @@ exports[`snippet: #1 format[flow] 1`] = ` `; exports[`snippet: #1 format[hermes] 1`] = ` -"'match' argument cannot contain spread elements (1:7) +"'match' argument cannot contain spread elements (1:8) > 1 | match (...b) {} - | ^ + | ^ Cause: 'match' argument cannot contain spread elements (1:7) match (...b) {} ^~~~" diff --git a/tests/format/flow/_errors_/record/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/record/__snapshots__/format.test.js.snap index db29304f9..0b735965e 100644 --- a/tests/format/flow/_errors_/record/__snapshots__/format.test.js.snap +++ b/tests/format/flow/_errors_/record/__snapshots__/format.test.js.snap @@ -7,9 +7,9 @@ exports[`snippet: #0 format[flow] 1`] = ` `; exports[`snippet: #0 format[hermes] 1`] = ` -"';' expected (1:23) +"';' expected (1:24) > 1 | const a = not_a_record {} - | ^ + | ^ Cause: ';' expected (1:23) const a = not_a_record {} ^" diff --git a/tests/format/flow/as-satisfies-expression/__snapshots__/format.test.js.snap b/tests/format/flow/as-satisfies-expression/__snapshots__/format.test.js.snap index d42db639e..3afaed64b 100644 --- a/tests/format/flow/as-satisfies-expression/__snapshots__/format.test.js.snap +++ b/tests/format/flow/as-satisfies-expression/__snapshots__/format.test.js.snap @@ -419,11 +419,11 @@ function satisfiesChain() { `; exports[`satisfies.js format[hermes] 1`] = ` -"';' expected (3:12) +"';' expected (3:13) 1 | // @flow 2 | > 3 | const x = y satisfies T; - | ^ + | ^ 4 | 5 | // demonstrating how "satisfies" expression can be practically used as expression statement. 6 | const _ = (type: 'foo' | 'bar') => { @@ -538,10 +538,11 @@ bifornCringerMoshedPerplexSawder = `; exports[`ternary.js format[hermes] 1`] = ` -"invalid assignment left-hand side (3:0) +"invalid assignment left-hand side (3:1) 1 | // @flow 2 | > 3 | foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + | ^ 4 | ? baaaaaaaaaaaaaaaaaaaaar 5 | : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo; 6 | diff --git a/tests/format/flow/await/__snapshots__/format.test.js.snap b/tests/format/flow/await/__snapshots__/format.test.js.snap index 85ae14239..ca984fea4 100644 --- a/tests/format/flow/await/__snapshots__/format.test.js.snap +++ b/tests/format/flow/await/__snapshots__/format.test.js.snap @@ -80,10 +80,10 @@ await(0); `; exports[`await-keywords.js format[hermes] 1`] = ` -"'await' not in an async function (2:6) +"'await' not in an async function (2:7) 1 | export class C1 { > 2 | p = await (0); - | ^ + | ^ 3 | } 4 | 5 | await (0); diff --git a/tests/format/flow/component/__snapshots__/format.test.js.snap b/tests/format/flow/component/__snapshots__/format.test.js.snap index 1d4a6a567..62953b421 100644 --- a/tests/format/flow/component/__snapshots__/format.test.js.snap +++ b/tests/format/flow/component/__snapshots__/format.test.js.snap @@ -614,10 +614,10 @@ declare module "foo" { `; exports[`implicit.js format[hermes] 1`] = ` -"'{' expected in component declaration (2:33) +"'{' expected in component declaration (2:34) 1 | declare module "foo" { > 2 | component Button(label: string); - | ^ + | ^ 3 | } 4 | Cause: '{' expected in component declaration (2:33) diff --git a/tests/format/flow/declare-function/__snapshots__/format.test.js.snap b/tests/format/flow/declare-function/__snapshots__/format.test.js.snap index 83c3cc022..453a722bf 100644 --- a/tests/format/flow/declare-function/__snapshots__/format.test.js.snap +++ b/tests/format/flow/declare-function/__snapshots__/format.test.js.snap @@ -33,10 +33,10 @@ declare module "foo" { `; exports[`implicit.js format[hermes] 1`] = ` -"'{' expected in function declaration (2:38) +"'{' expected in function declaration (2:39) 1 | declare module "foo" { > 2 | function greet(name: string): string; - | ^ + | ^ 3 | } 4 | Cause: '{' expected in function declaration (2:38) diff --git a/tests/format/flow/declare-variable/__snapshots__/format.test.js.snap b/tests/format/flow/declare-variable/__snapshots__/format.test.js.snap index ad9227363..e5ccc1cb7 100644 --- a/tests/format/flow/declare-variable/__snapshots__/format.test.js.snap +++ b/tests/format/flow/declare-variable/__snapshots__/format.test.js.snap @@ -37,9 +37,9 @@ declare const s = "foo"; `; exports[`initializer.js format[hermes] 1`] = ` -"expected type annotation on declared var (1:14) +"expected type annotation on declared var (1:15) > 1 | declare const s = 'foo'; - | ^ + | ^ 2 | Cause: expected type annotation on declared var (1:14) declare const s = 'foo'; @@ -60,9 +60,9 @@ declare const x: string, y: number; `; exports[`multiple.js format[hermes] 1`] = ` -"';' expected (1:23) +"';' expected (1:24) > 1 | declare const x: string, y: number; - | ^ + | ^ 2 | Cause: ';' expected (1:23) declare const x: string, y: number; diff --git a/tests/format/flow/flow-repo/binding/__snapshots__/format.test.js.snap b/tests/format/flow/flow-repo/binding/__snapshots__/format.test.js.snap index f4d6d5e69..1f0ed9f87 100644 --- a/tests/format/flow/flow-repo/binding/__snapshots__/format.test.js.snap +++ b/tests/format/flow/flow-repo/binding/__snapshots__/format.test.js.snap @@ -66,10 +66,11 @@ for (const { baz } of bazzes) { `; exports[`const.js format[hermes] 1`] = ` -"invalid operand in update operation (4:0) +"invalid operand in update operation (4:1) 2 | 3 | // errors: const cannot be reassigned > 4 | x++; + | ^ 5 | x--; 6 | x += 0; 7 | x -= 0; @@ -484,11 +485,11 @@ function fn_params_clash_fn_binding(x, y) { `; exports[`rebinding.js format[hermes] 1`] = ` -"Identifier 'A' is already declared (53:8) +"Identifier 'A' is already declared (53:9) 51 | function class_class() { 52 | class A {} > 53 | class A {} // error: name already bound - | ^ + | ^ 54 | } 55 | 56 | function class_let() { @@ -734,11 +735,11 @@ function default_param_2() { `; exports[`scope.js format[hermes] 1`] = ` -"Identifier 'a' is already declared (19:10) +"Identifier 'a' is already declared (19:11) 17 | break; 18 | case "bar": > 19 | let a = ""; // error: a already bound in switch - | ^ + | ^ 20 | break; 21 | } 22 | } diff --git a/tests/format/flow/flow-repo/find-module/__snapshots__/format.test.js.snap b/tests/format/flow/flow-repo/find-module/__snapshots__/format.test.js.snap index ba0136e74..fe9941eea 100644 --- a/tests/format/flow/flow-repo/find-module/__snapshots__/format.test.js.snap +++ b/tests/format/flow/flow-repo/find-module/__snapshots__/format.test.js.snap @@ -33,11 +33,11 @@ import x from "./req"; `; exports[`test.js format[hermes] 1`] = ` -"Identifier 'x' is already declared (4:7) +"Identifier 'x' is already declared (4:8) 2 | (x: string); 3 | > 4 | import x from './req'; - | ^ + | ^ 5 | Cause: Identifier 'x' is already declared (4:7) import x from './req'; diff --git a/tests/format/flow/flow-repo/type_only_vars/__snapshots__/format.test.js.snap b/tests/format/flow/flow-repo/type_only_vars/__snapshots__/format.test.js.snap index 263c8b58a..487e9d371 100644 --- a/tests/format/flow/flow-repo/type_only_vars/__snapshots__/format.test.js.snap +++ b/tests/format/flow/flow-repo/type_only_vars/__snapshots__/format.test.js.snap @@ -85,11 +85,11 @@ var duck: string = "quack"; `; exports[`bad_shadowing.js format[hermes] 1`] = ` -"Identifier 'A' is already declared (13:4) +"Identifier 'A' is already declared (13:5) 11 | 12 | // These string types should confict with the imported types > 13 | var A: string = "Hello"; - | ^ + | ^ 14 | var Foo: string = "Goodbye"; 15 | var Baz: string = "Go away please"; 16 | @@ -153,11 +153,11 @@ var b: Foo = new A.Foo(); `; exports[`good_shadowing.js format[hermes] 1`] = ` -"Identifier 'A' is already declared (8:4) +"Identifier 'A' is already declared (8:5) 6 | import type {Foo, Bar as Baz} from "./A.js"; 7 | > 8 | var A = require('./A.js'); - | ^ + | ^ 9 | var Foo = A.Foo; 10 | var Baz = A.Bar; 11 | diff --git a/tests/format/flow/flow-repo/unary/__snapshots__/format.test.js.snap b/tests/format/flow/flow-repo/unary/__snapshots__/format.test.js.snap index 5284c3183..3bdca5836 100644 --- a/tests/format/flow/flow-repo/unary/__snapshots__/format.test.js.snap +++ b/tests/format/flow/flow-repo/unary/__snapshots__/format.test.js.snap @@ -137,11 +137,11 @@ let tests = [ `; exports[`update.js format[hermes] 1`] = ` -"invalid operand in update operation (31:4) +"invalid operand in update operation (31:5) 29 | function() { 30 | const y = 123; > 31 | y++; // error, can't update const - | ^ + | ^ 32 | y--; // error, can't update const 33 | }, 34 | diff --git a/tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap b/tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap index 806d9d1e5..ffc23a9c4 100644 --- a/tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap +++ b/tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap @@ -13,7 +13,7 @@ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SE `; exports[`invalid-2.hbs format 1`] = ` -"Unclosed element \`@name\` (3:0) +"Unclosed element \`@name\` (3:1) 1 | 2 | > 3 | <{@name> @@ -42,7 +42,7 @@ Expecting 'OPEN_SEXPR', 'ID', 'OPEN_ARRAY', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDE `; exports[`snippet: IMG format 1`] = ` -"Unclosed element \`IMG\` (1:0) +"Unclosed element \`IMG\` (1:1) > 1 | | ^^^^^ Cause: Unclosed element \`IMG\`: @@ -55,7 +55,7 @@ Cause: Unclosed element \`IMG\`: `; exports[`snippet: INPUT format 1`] = ` -"Unclosed element \`INPUT\` (1:0) +"Unclosed element \`INPUT\` (1:1) > 1 | | ^^^^^^^ Cause: Unclosed element \`INPUT\`: @@ -68,9 +68,9 @@ Cause: Unclosed element \`INPUT\`: `; exports[`snippet: area format 1`] = ` -" elements do not need end tags. You should remove it (1:6) +" elements do not need end tags. You should remove it (1:7) > 1 | - | ^^^^^^^ + | ^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -81,9 +81,9 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: base format 1`] = ` -" elements do not need end tags. You should remove it (1:6) +" elements do not need end tags. You should remove it (1:7) > 1 | - | ^^^^^^^ + | ^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -94,7 +94,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: basefont format 1`] = ` -"Unclosed element \`basefont\` (1:0) +"Unclosed element \`basefont\` (1:1) > 1 | | ^^^^^^^^^^ Cause: Unclosed element \`basefont\`: @@ -107,7 +107,7 @@ Cause: Unclosed element \`basefont\`: `; exports[`snippet: bgsound format 1`] = ` -"Unclosed element \`bgsound\` (1:0) +"Unclosed element \`bgsound\` (1:1) > 1 | | ^^^^^^^^^ Cause: Unclosed element \`bgsound\`: @@ -120,9 +120,9 @@ Cause: Unclosed element \`bgsound\`: `; exports[`snippet: br format 1`] = ` -"
elements do not need end tags. You should remove it (1:4) +"
elements do not need end tags. You should remove it (1:5) > 1 |

- | ^^^^^ + | ^^^^^ Cause:
elements do not need end tags. You should remove it: | @@ -133,9 +133,9 @@ Cause:
elements do not need end tags. You should remove it: `; exports[`snippet: col format 1`] = ` -" elements do not need end tags. You should remove it (1:5) +" elements do not need end tags. You should remove it (1:6) > 1 | - | ^^^^^^ + | ^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -146,9 +146,9 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: command format 1`] = ` -" elements do not need end tags. You should remove it (1:9) +" elements do not need end tags. You should remove it (1:10) > 1 | - | ^^^^^^^^^^ + | ^^^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -159,7 +159,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: div format 1`] = ` -"Unclosed element \`div\` (1:0) +"Unclosed element \`div\` (1:1) > 1 |
| ^^^^^ Cause: Unclosed element \`div\`: @@ -172,9 +172,9 @@ Cause: Unclosed element \`div\`: `; exports[`snippet: embed format 1`] = ` -" elements do not need end tags. You should remove it (1:7) +" elements do not need end tags. You should remove it (1:8) > 1 | - | ^^^^^^^^ + | ^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -185,7 +185,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: frame format 1`] = ` -"Unclosed element \`frame\` (1:0) +"Unclosed element \`frame\` (1:1) > 1 | | ^^^^^^^ Cause: Unclosed element \`frame\`: @@ -198,9 +198,9 @@ Cause: Unclosed element \`frame\`: `; exports[`snippet: hr format 1`] = ` -"
elements do not need end tags. You should remove it (1:4) +"
elements do not need end tags. You should remove it (1:5) > 1 |
- | ^^^^^ + | ^^^^^ Cause:
elements do not need end tags. You should remove it: | @@ -211,7 +211,7 @@ Cause:
elements do not need end tags. You should remove it: `; exports[`snippet: imG format 1`] = ` -"Unclosed element \`imG\` (1:0) +"Unclosed element \`imG\` (1:1) > 1 | | ^^^^^ Cause: Unclosed element \`imG\`: @@ -224,7 +224,7 @@ Cause: Unclosed element \`imG\`: `; exports[`snippet: image format 1`] = ` -"Unclosed element \`image\` (1:0) +"Unclosed element \`image\` (1:1) > 1 | | ^^^^^^^ Cause: Unclosed element \`image\`: @@ -237,9 +237,9 @@ Cause: Unclosed element \`image\`: `; exports[`snippet: img format 1`] = ` -" elements do not need end tags. You should remove it (1:5) +" elements do not need end tags. You should remove it (1:6) > 1 | - | ^^^^^^ + | ^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -250,9 +250,9 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: input format 1`] = ` -" elements do not need end tags. You should remove it (1:7) +" elements do not need end tags. You should remove it (1:8) > 1 | - | ^^^^^^^^ + | ^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -263,7 +263,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: isindex format 1`] = ` -"Unclosed element \`isindex\` (1:0) +"Unclosed element \`isindex\` (1:1) > 1 | | ^^^^^^^^^ Cause: Unclosed element \`isindex\`: @@ -276,9 +276,9 @@ Cause: Unclosed element \`isindex\`: `; exports[`snippet: keygen format 1`] = ` -" elements do not need end tags. You should remove it (1:8) +" elements do not need end tags. You should remove it (1:9) > 1 | - | ^^^^^^^^^ + | ^^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -289,7 +289,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: lINk format 1`] = ` -"Unclosed element \`lINk\` (1:0) +"Unclosed element \`lINk\` (1:1) > 1 | | ^^^^^^ Cause: Unclosed element \`lINk\`: @@ -302,9 +302,9 @@ Cause: Unclosed element \`lINk\`: `; exports[`snippet: link format 1`] = ` -" elements do not need end tags. You should remove it (1:6) +" elements do not need end tags. You should remove it (1:7) > 1 | - | ^^^^^^^ + | ^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -315,7 +315,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: menuitem format 1`] = ` -"Unclosed element \`menuitem\` (1:0) +"Unclosed element \`menuitem\` (1:1) > 1 | | ^^^^^^^^^^ Cause: Unclosed element \`menuitem\`: @@ -328,9 +328,9 @@ Cause: Unclosed element \`menuitem\`: `; exports[`snippet: meta format 1`] = ` -" elements do not need end tags. You should remove it (1:6) +" elements do not need end tags. You should remove it (1:7) > 1 | - | ^^^^^^^ + | ^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -341,7 +341,7 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: nextid format 1`] = ` -"Unclosed element \`nextid\` (1:0) +"Unclosed element \`nextid\` (1:1) > 1 | | ^^^^^^^^ Cause: Unclosed element \`nextid\`: @@ -354,9 +354,9 @@ Cause: Unclosed element \`nextid\`: `; exports[`snippet: param format 1`] = ` -" elements do not need end tags. You should remove it (1:7) +" elements do not need end tags. You should remove it (1:8) > 1 | - | ^^^^^^^^ + | ^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -367,9 +367,9 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: source format 1`] = ` -" elements do not need end tags. You should remove it (1:8) +" elements do not need end tags. You should remove it (1:9) > 1 | - | ^^^^^^^^^ + | ^^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -380,9 +380,9 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: track format 1`] = ` -" elements do not need end tags. You should remove it (1:7) +" elements do not need end tags. You should remove it (1:8) > 1 | - | ^^^^^^^^ + | ^^^^^^^^ Cause: elements do not need end tags. You should remove it: | @@ -393,9 +393,9 @@ Cause: elements do not need end tags. You should remove it: `; exports[`snippet: wbr format 1`] = ` -" elements do not need end tags. You should remove it (1:5) +" elements do not need end tags. You should remove it (1:6) > 1 | - | ^^^^^^ + | ^^^^^^ Cause: elements do not need end tags. You should remove it: | diff --git a/tests/format/js/_errors_/class-property-named-constructor/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/class-property-named-constructor/__snapshots__/format.test.js.snap index 2d22497e1..217b6b353 100644 --- a/tests/format/js/_errors_/class-property-named-constructor/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/class-property-named-constructor/__snapshots__/format.test.js.snap @@ -45,10 +45,10 @@ exports[`snippet: #0 format[flow] 1`] = ` `; exports[`snippet: #0 format[hermes] 1`] = ` -"invalid class property name (2:2) +"invalid class property name (2:3) 1 | class Foo { > 2 | constructor - | ^ + | ^ 3 | } Cause: invalid class property name (2:2) constructor @@ -134,10 +134,10 @@ exports[`snippet: #1 format[flow] 1`] = ` `; exports[`snippet: #1 format[hermes] 1`] = ` -"invalid class property name (2:2) +"invalid class property name (2:3) 1 | class Foo { > 2 | 'constructor' - | ^ + | ^ 3 | } Cause: invalid class property name (2:2) 'constructor' @@ -223,10 +223,10 @@ exports[`snippet: #2 format[flow] 1`] = ` `; exports[`snippet: #2 format[hermes] 1`] = ` -"invalid class property name (2:2) +"invalid class property name (2:3) 1 | class Foo { > 2 | 'constructor' - | ^ + | ^ 3 | } Cause: invalid class property name (2:2) 'constructor' @@ -312,10 +312,10 @@ exports[`snippet: #3 format[flow] 1`] = ` `; exports[`snippet: #3 format[hermes] 1`] = ` -"';' expected after class property (2:11) +"';' expected after class property (2:12) 1 | class Foo { > 2 | accessor 'constructor' - | ^ + | ^ 3 | } Cause: ';' expected after class property (2:11) accessor 'constructor' @@ -401,10 +401,10 @@ exports[`snippet: #4 format[flow] 1`] = ` `; exports[`snippet: #4 format[hermes] 1`] = ` -"';' expected after class property (2:11) +"';' expected after class property (2:12) 1 | class Foo { > 2 | accessor 'constructor' - | ^ + | ^ 3 | } Cause: ';' expected after class property (2:11) accessor 'constructor' @@ -490,10 +490,10 @@ exports[`snippet: #5 format[flow] 1`] = ` `; exports[`snippet: #5 format[hermes] 1`] = ` -"';' expected after class property (2:11) +"';' expected after class property (2:12) 1 | class Foo { > 2 | accessor constructor - | ^ + | ^ 3 | } Cause: ';' expected after class property (2:11) accessor constructor diff --git a/tests/format/js/_errors_/discard-binding/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/discard-binding/__snapshots__/format.test.js.snap index cbabd43b3..1b98c2a07 100644 --- a/tests/format/js/_errors_/discard-binding/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/discard-binding/__snapshots__/format.test.js.snap @@ -31,9 +31,9 @@ Cause: Unexpected token ]" `; exports[`invalid-array-expression.js format[hermes] 1`] = ` -"invalid expression (1:8) +"invalid expression (1:9) > 1 | ([[[void], x, ], y]); - | ^ + | ^ 2 | 3 | ([[[x], void, ], y]); 4 | @@ -105,9 +105,9 @@ Cause: Unexpected token =" `; exports[`invalid-assignment-expression.js format[hermes] 1`] = ` -"invalid expression (1:5) +"invalid expression (1:6) > 1 | void = 0; - | ^ + | ^ 2 | Cause: invalid expression (1:5) void = 0; @@ -169,9 +169,9 @@ Cause: Unexpected token ]" `; exports[`invalid-assignment-for.js format[hermes] 1`] = ` -"invalid expression (1:14) +"invalid expression (1:15) > 1 | for (void of []); - | ^ + | ^ 2 | Cause: invalid expression (1:14) for (void of []); @@ -245,11 +245,11 @@ Cause: Unexpected keyword 'void'" `; exports[`invalid-assignment-pattern.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (3:13) +"identifier, '{' or '[' expected in binding pattern (3:14) 1 | { 2 | // function parameter > 3 | function f(void = 0) {} - | ^ + | ^ 4 | } 5 | { 6 | // arrow function parameter @@ -335,9 +335,9 @@ Cause: Unexpected token ," `; exports[`invalid-async-call-argument.js format[hermes] 1`] = ` -"invalid expression (1:10) +"invalid expression (1:11) > 1 | async(void, x); - | ^ + | ^ 2 | 3 | async(x, void); 4 | @@ -409,9 +409,9 @@ Cause: Unexpected keyword 'void'" `; exports[`invalid-catch-parameter.js format[hermes] 1`] = ` -"'identifier' expected inside catch list (1:14) +"'identifier' expected inside catch list (1:15) > 1 | try {} catch (void) {} - | ^ + | ^ 2 | Cause: 'identifier' expected inside catch list (1:14) try {} catch (void) {} @@ -473,9 +473,9 @@ Cause: Unexpected token =>" `; exports[`invalid-lone-arrow-function-parameter.js format[hermes] 1`] = ` -"invalid expression (1:5) +"invalid expression (1:6) > 1 | void => {} - | ^ + | ^ 2 | Cause: invalid expression (1:5) void => {} @@ -537,9 +537,9 @@ Cause: Unexpected token void" `; exports[`invalid-lone-async-arrow-function-parameter.js format[hermes] 1`] = ` -"';' expected (1:6) +"';' expected (1:7) > 1 | async void => {} - | ^ + | ^ 2 | Cause: ';' expected (1:6) async void => {} @@ -607,9 +607,9 @@ Cause: Unexpected token }" `; exports[`invalid-object-expression.js format[hermes] 1`] = ` -"invalid expression (1:21) +"invalid expression (1:22) > 1 | ({ p: { p: { p: void }, x, }, y}); - | ^ + | ^ 2 | 3 | ({ p: { x: { x }, p: void, }, y}); 4 | @@ -681,9 +681,9 @@ Cause: Unexpected token )" `; exports[`invalid-parenthesized-assignment.js format[hermes] 1`] = ` -"invalid expression (1:6) +"invalid expression (1:7) > 1 | [(void)] = []; - | ^ + | ^ 2 | Cause: invalid expression (1:6) [(void)] = []; @@ -745,9 +745,9 @@ Cause: Unexpected token (" `; exports[`invalid-parenthesized-binding.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (1:9) +"identifier, '{' or '[' expected in binding pattern (1:10) > 1 | const [, (void), ] = value; - | ^ + | ^ 2 | Cause: identifier, '{' or '[' expected in binding pattern (1:9) const [, (void), ] = value; @@ -818,10 +818,10 @@ Cause: Unexpected keyword 'void'" `; exports[`invalid-rest-element-array-pattern.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (2:11) +"identifier, '{' or '[' expected in binding pattern (2:12) 1 | { > 2 | var [ ...void ] = []; - | ^ + | ^ 3 | } 4 | { 5 | for (var [...void] of [[]]); @@ -897,9 +897,9 @@ Cause: Unexpected token ]" `; exports[`invalid-rest-element-array-pattern-for-lhs.js format[hermes] 1`] = ` -"invalid expression (1:15) +"invalid expression (1:16) > 1 | for ([ ...void ] of []); - | ^ + | ^ 2 | Cause: invalid expression (1:15) for ([ ...void ] of []); @@ -961,9 +961,9 @@ Cause: Unexpected token ]" `; exports[`invalid-rest-element-array-pattern-lhs.js format[hermes] 1`] = ` -"invalid expression (1:11) +"invalid expression (1:12) > 1 | ([ ...void ] = []); - | ^ + | ^ 2 | Cause: invalid expression (1:11) ([ ...void ] = []); @@ -1034,10 +1034,10 @@ Cause: Unexpected keyword 'void'" `; exports[`invalid-rest-element-object-pattern.js format[hermes] 1`] = ` -"identifier expected after '...' in object pattern (2:11) +"identifier expected after '...' in object pattern (2:12) 1 | { > 2 | var { ...void } = {}; - | ^ + | ^ 3 | } 4 | { 5 | for (var { ...void } of [{}]); @@ -1113,9 +1113,9 @@ Cause: Unexpected token }" `; exports[`invalid-rest-element-object-pattern-for-lhs.js format[hermes] 1`] = ` -"invalid expression (1:15) +"invalid expression (1:16) > 1 | for ({ ...void } of []); - | ^ + | ^ 2 | Cause: invalid expression (1:15) for ({ ...void } of []); @@ -1177,9 +1177,9 @@ Cause: Unexpected token }" `; exports[`invalid-rest-element-object-pattern-lhs.js format[hermes] 1`] = ` -"invalid expression (1:11) +"invalid expression (1:12) > 1 | ({ ...void } = {}); - | ^ + | ^ 2 | Cause: invalid expression (1:11) ({ ...void } = {}); @@ -1247,9 +1247,9 @@ Cause: Unexpected token ," `; exports[`invalid-sequence-expression.js format[hermes] 1`] = ` -"invalid expression (1:5) +"invalid expression (1:6) > 1 | (void, x); - | ^ + | ^ 2 | 3 | (x, void); 4 | @@ -1330,10 +1330,10 @@ Cause: Unexpected keyword 'void'" `; exports[`invalid-variable-declarator.js format[hermes] 1`] = ` -"'identifier' expected in declaration (2:6) +"'identifier' expected in declaration (2:7) 1 | { > 2 | var void = f(); - | ^ + | ^ 3 | } 4 | { 5 | let void = f(), void = g(); diff --git a/tests/format/js/_errors_/export-name/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/export-name/__snapshots__/format.test.js.snap index be6dd04ac..12e6f319d 100644 --- a/tests/format/js/_errors_/export-name/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/export-name/__snapshots__/format.test.js.snap @@ -56,9 +56,9 @@ exports[`snippet: #0 format[flow] 1`] = ` `; exports[`snippet: #0 format[hermes] 1`] = ` -"'identifier' expected in import specifier (1:9) +"'identifier' expected in import specifier (1:10) > 1 | import { "\\uD83C" as b } from "./foo"; - | ^ + | ^ Cause: 'identifier' expected in import specifier (1:9) import { "\\uD83C" as b } from "./foo"; ~~^" @@ -139,9 +139,9 @@ exports[`snippet: #1 format[flow] 1`] = ` `; exports[`snippet: #1 format[hermes] 1`] = ` -"'identifier' expected in export clause (1:9) +"'identifier' expected in export clause (1:10) > 1 | export { "\\uD83C" } from "./foo"; - | ^ + | ^ Cause: 'identifier' expected in export clause (1:9) export { "\\uD83C" } from "./foo"; ~~^" @@ -222,9 +222,9 @@ exports[`snippet: #2 format[flow] 1`] = ` `; exports[`snippet: #2 format[hermes] 1`] = ` -"'identifier' expected in export clause (1:9) +"'identifier' expected in export clause (1:10) > 1 | export { "\\uD83C" as b } from "./foo"; - | ^ + | ^ Cause: 'identifier' expected in export clause (1:9) export { "\\uD83C" as b } from "./foo"; ~~^" @@ -305,9 +305,9 @@ exports[`snippet: #3 format[flow] 1`] = ` `; exports[`snippet: #3 format[hermes] 1`] = ` -"'identifier' expected in export clause (1:14) +"'identifier' expected in export clause (1:15) > 1 | export { b as "\\uD83C" } from "./foo"; - | ^ + | ^ Cause: 'identifier' expected in export clause (1:14) export { b as "\\uD83C" } from "./foo"; ~~~~~~~^" diff --git a/tests/format/js/_errors_/reserved-word/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/reserved-word/__snapshots__/format.test.js.snap index 57692880e..02de91ab0 100644 --- a/tests/format/js/_errors_/reserved-word/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/reserved-word/__snapshots__/format.test.js.snap @@ -41,9 +41,9 @@ exports[`snippet: #0 format[flow] 2`] = ` `; exports[`snippet: #0 format[hermes] 1`] = ` -"expected declaration in export (1:7) +"expected declaration in export (1:8) > 1 | export asyn\\u{63} from "async"; - | ^ + | ^ Cause: expected declaration in export (1:7) export asyn\\u{63} from "async"; ^~~~~~~~~~" diff --git a/tests/format/js/assignment/__snapshots__/format.test.js.snap b/tests/format/js/assignment/__snapshots__/format.test.js.snap index 79d9282e5..d61fec779 100644 --- a/tests/format/js/assignment/__snapshots__/format.test.js.snap +++ b/tests/format/js/assignment/__snapshots__/format.test.js.snap @@ -28,10 +28,11 @@ computedDescriptionLines = `; exports[`binaryish.js format[hermes] 1`] = ` -"invalid assignment left-hand side (6:0) +"invalid assignment left-hand side (6:1) 4 | descriptionLines; 5 | > 6 | computedDescriptionLines = (focused && + | ^ 7 | !loading && 8 | descriptionLinesFocused) || 9 | descriptionLines; diff --git a/tests/format/js/comments/html-like/__snapshots__/format.test.js.snap b/tests/format/js/comments/html-like/__snapshots__/format.test.js.snap index 95bf5d043..d45721bf4 100644 --- a/tests/format/js/comments/html-like/__snapshots__/format.test.js.snap +++ b/tests/format/js/comments/html-like/__snapshots__/format.test.js.snap @@ -52,9 +52,9 @@ exports[`comment.js format[flow] 1`] = ` `; exports[`comment.js format[hermes] 1`] = ` -"'identifier' expected as JSX element name (1:1) +"'identifier' expected as JSX element name (1:2) > 1 | Cause: 'identifier' expected as JSX element name (1:1) diff --git a/tests/format/js/decorators/__snapshots__/format.test.js.snap b/tests/format/js/decorators/__snapshots__/format.test.js.snap index 5a176d48e..213d09b25 100644 --- a/tests/format/js/decorators/__snapshots__/format.test.js.snap +++ b/tests/format/js/decorators/__snapshots__/format.test.js.snap @@ -78,11 +78,11 @@ exports[`classes.js format[flow] 1`] = ` `; exports[`classes.js format[hermes] 1`] = ` -"'class' expected in class (3:6) +"'class' expected in class (3:7) 1 | @deco class Foo {} 2 | > 3 | @deco export class Bar {} - | ^ + | ^ 4 | 5 | @deco export default class Baz {} 6 | @@ -196,10 +196,11 @@ Cause: Unexpected character '@'" `; exports[`comments.js format[hermes] 1`] = ` -"'class' expected in class (24:0) +"'class' expected in class (24:1) 22 | ], 23 | }) > 24 | export class AppModule {} + | ^ 25 | 26 | // A 27 | @Foo() @@ -483,10 +484,11 @@ Cause: Unexpected character '@'" `; exports[`mixed.js format[hermes] 1`] = ` -"'class' expected in class (4:0) +"'class' expected in class (4:1) 2 | 3 | @foo > 4 | export default class MyComponent { + | ^ 5 | @task 6 | *foo() { 7 | } @@ -826,9 +828,10 @@ Cause: Unexpected character '@'" `; exports[`redux.js format[hermes] 1`] = ` -"'class' expected in class (2:0) +"'class' expected in class (2:1) 1 | @connect(mapStateToProps, mapDispatchToProps) > 2 | export class MyApp extends React.Component {} + | ^ 3 | 4 | @connect(state => ({ todos: state.todos })) 5 | export class Home extends React.Component {} diff --git a/tests/format/js/destructuring/__snapshots__/format.test.js.snap b/tests/format/js/destructuring/__snapshots__/format.test.js.snap index ca5b2653a..5f06af320 100644 --- a/tests/format/js/destructuring/__snapshots__/format.test.js.snap +++ b/tests/format/js/destructuring/__snapshots__/format.test.js.snap @@ -117,9 +117,10 @@ class A { `; exports[`destructuring.js format[hermes] 1`] = ` -"invalid assignment left-hand side (2:0) +"invalid assignment left-hand side (2:1) 1 | const [one, two = null, three = null] = arr; > 2 | a = ([s=1,]) => 1 + | ^ 3 | const { children, ...props } = this.props 4 | 5 | const { user: { firstName, lastName } } = this.props; diff --git a/tests/format/js/discard-binding/__snapshots__/format.test.js.snap b/tests/format/js/discard-binding/__snapshots__/format.test.js.snap index af0d63058..751464776 100644 --- a/tests/format/js/discard-binding/__snapshots__/format.test.js.snap +++ b/tests/format/js/discard-binding/__snapshots__/format.test.js.snap @@ -120,11 +120,11 @@ exports[`array-pattern.js format[flow] 1`] = ` `; exports[`array-pattern.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (3:11) +"identifier, '{' or '[' expected in binding pattern (3:12) 1 | { 2 | // destructuring binding > 3 | const [, void, ] = value; - | ^ + | ^ 4 | } 5 | { 6 | // for-of destructuring binding @@ -234,9 +234,9 @@ exports[`basic.js format[flow] 1`] = ` `; exports[`basic.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (1:7) +"identifier, '{' or '[' expected in binding pattern (1:8) > 1 | const [void] = [,void] = [void,] = []; - | ^ + | ^ 2 | 3 | function f(void, { p: void }, [ void ]) {} 4 | @@ -320,9 +320,9 @@ exports[`discard-binding-arrow-params.js format[flow] 1`] = ` `; exports[`discard-binding-arrow-params.js format[hermes] 1`] = ` -"invalid expression (1:5) +"invalid expression (1:6) > 1 | (void) => {} - | ^ + | ^ 2 | Cause: invalid expression (1:5) (void) => {} @@ -396,9 +396,9 @@ exports[`discard-binding-assignment.js format[flow] 1`] = ` `; exports[`discard-binding-assignment.js format[hermes] 1`] = ` -"invalid expression (1:6) +"invalid expression (1:7) > 1 | ([void] = []); - | ^ + | ^ 2 | Cause: invalid expression (1:6) ([void] = []); @@ -472,9 +472,9 @@ exports[`discard-binding-async-arrow-params.js format[flow] 1`] = ` `; exports[`discard-binding-async-arrow-params.js format[hermes] 1`] = ` -"invalid expression (1:11) +"invalid expression (1:12) > 1 | async (void) => {} - | ^ + | ^ 2 | Cause: invalid expression (1:11) async (void) => {} @@ -548,9 +548,9 @@ exports[`discard-binding-bindings.js format[flow] 1`] = ` `; exports[`discard-binding-bindings.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (1:11) +"identifier, '{' or '[' expected in binding pattern (1:12) > 1 | const { p: void } = {}; - | ^ + | ^ 2 | Cause: identifier, '{' or '[' expected in binding pattern (1:11) const { p: void } = {}; @@ -634,10 +634,10 @@ exports[`discard-binding-for-await-using-binding.js format[flow] 1`] = ` `; exports[`discard-binding-for-await-using-binding.js format[hermes] 1`] = ` -"invalid expression (2:27) +"invalid expression (2:28) 1 | async () => { > 2 | for(await using void of []); - | ^ + | ^ 3 | } 4 | Cause: invalid expression (2:27) @@ -720,9 +720,9 @@ exports[`discard-binding-for-bindings.js format[flow] 1`] = ` `; exports[`discard-binding-for-bindings.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (1:15) +"identifier, '{' or '[' expected in binding pattern (1:16) > 1 | for(const { p: void } of []); - | ^ + | ^ 2 | Cause: identifier, '{' or '[' expected in binding pattern (1:15) for(const { p: void } of []); @@ -796,9 +796,9 @@ exports[`discard-binding-for-lhs.js format[flow] 1`] = ` `; exports[`discard-binding-for-lhs.js format[hermes] 1`] = ` -"invalid expression (1:14) +"invalid expression (1:15) > 1 | for({ p: void } of []); - | ^ + | ^ 2 | Cause: invalid expression (1:14) for({ p: void } of []); @@ -882,7 +882,7 @@ exports[`discard-binding-for-using-binding.js format[flow] 1`] = ` `; exports[`discard-binding-for-using-binding.js format[hermes] 1`] = ` -"Failed to parse source (0:0) +"Failed to parse source (0:1) 1 | { 2 | for(using void of []); 3 | } @@ -1016,11 +1016,11 @@ exports[`function-parameter.js format[flow] 1`] = ` `; exports[`function-parameter.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (3:13) +"identifier, '{' or '[' expected in binding pattern (3:14) 1 | { 2 | // function parameter > 3 | function f(void) {} - | ^ + | ^ 4 | } 5 | { 6 | // arrow function parameter @@ -1213,11 +1213,11 @@ exports[`object-pattern.js format[flow] 1`] = ` `; exports[`object-pattern.js format[hermes] 1`] = ` -"identifier, '{' or '[' expected in binding pattern (3:16) +"identifier, '{' or '[' expected in binding pattern (3:17) 1 | { 2 | // destructuring binding > 3 | const { void: void } = value; - | ^ + | ^ 4 | } 5 | { 6 | // for-of destructuring binding @@ -1353,11 +1353,11 @@ exports[`unary-expression-void.js format[flow] 1`] = ` `; exports[`unary-expression-void.js format[hermes] 1`] = ` -"invalid expression (4:9) +"invalid expression (4:10) 2 | void [ 3 | // pattern > 4 | [ void ] = [{ - | ^ + | ^ 5 | // expr 6 | [ void [] ]: 7 | // pattern @@ -1468,10 +1468,10 @@ exports[`using.js format[flow] 1`] = ` `; exports[`using.js format[hermes] 1`] = ` -"'identifier' expected in declaration (2:8) +"'identifier' expected in declaration (2:9) 1 | { > 2 | using void = f(); - | ^ + | ^ 3 | } 4 | async (void) => { 5 | await using void = f(); @@ -1641,11 +1641,11 @@ exports[`using-variable-declarator.js format[flow] 1`] = ` `; exports[`using-variable-declarator.js format[hermes] 1`] = ` -"'identifier' expected in declaration (3:8) +"'identifier' expected in declaration (3:9) 1 | { 2 | // using 1 declarator > 3 | using void = f(); - | ^ + | ^ 4 | } 5 | { 6 | // using 2 declarators diff --git a/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap b/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap index 4aa91cc1a..c0019fa0d 100644 --- a/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap +++ b/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap @@ -68,9 +68,9 @@ exports[`import-phase.js format[flow] 1`] = ` `; exports[`import-phase.js format[hermes] 1`] = ` -"'meta' expected in member expression (1:7) +"'meta' expected in member expression (1:8) > 1 | import.source(\`data:text/javascript, - | ^ + | ^ 2 | console.log("RUN"); 3 | \`) 4 | @@ -127,9 +127,9 @@ exports[`template-literal.js format[flow] 1`] = ` `; exports[`template-literal.js format[hermes] 1`] = ` -"unexpected token after assignment expression (1:19) +"unexpected token after assignment expression (1:20) > 1 | module = await import(\`data:text/javascript, - | ^ + | ^ 2 | console.log("RUN"); 3 | \`); 4 | diff --git a/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap b/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap index f42b297f1..96c9cd2e8 100644 --- a/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap +++ b/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap @@ -21,9 +21,9 @@ exports[`for-await-using-of-comments.js format[flow] 1`] = ` `; exports[`for-await-using-of-comments.js format[hermes] 1`] = ` -"'(' expected after 'for' (1:18) +"'(' expected after 'for' (1:19) > 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - | ^ + | ^ 2 | Cause: '(' expected after 'for' (1:18) /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; @@ -97,10 +97,10 @@ exports[`invalid-duplicate-using-bindings.js format[flow] 1`] = ` `; exports[`invalid-duplicate-using-bindings.js format[hermes] 1`] = ` -"Identifier 'f' is already declared (2:19) +"Identifier 'f' is already declared (2:20) 1 | { > 2 | using f = foo(), f = foo(); - | ^ + | ^ 3 | } 4 | { 5 | using g = foo(); @@ -188,11 +188,11 @@ exports[`using-declarations.js format[flow] 1`] = ` `; exports[`using-declarations.js format[hermes] 1`] = ` -"';' or 'in' expected inside 'for' (5:20) +"';' or 'in' expected inside 'for' (5:21) 3 | } 4 | > 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - | ^ + | ^ 6 | 7 | for(using /* 1 */ foo of bar()); 8 | @@ -249,10 +249,10 @@ async function f() { `; exports[`valid-await-expr-using-in.js format[hermes] 1`] = ` -"'identifier' expected in declaration (2:14) +"'identifier' expected in declaration (2:15) 1 | async function f() { > 2 | await using in foo; - | ^ + | ^ 3 | } 4 | Cause: 'identifier' expected in declaration (2:14) @@ -278,10 +278,10 @@ async function f() { `; exports[`valid-await-expr-using-instanceof.js format[hermes] 1`] = ` -"'identifier' expected in declaration (2:14) +"'identifier' expected in declaration (2:15) 1 | async function f() { > 2 | await using instanceof foo; - | ^ + | ^ 3 | } 4 | Cause: 'identifier' expected in declaration (2:14) @@ -510,11 +510,11 @@ exports[`valid-await-using-comments.js format[flow] 1`] = ` `; exports[`valid-await-using-comments.js format[hermes] 1`] = ` -"';' or 'in' expected inside 'for' (6:47) +"';' or 'in' expected inside 'for' (6:48) 4 | } 5 | { > 6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; - | ^ + | ^ 7 | } 8 | { 9 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; @@ -654,10 +654,10 @@ exports[`valid-for-using-declaration.js format[flow] 1`] = ` `; exports[`valid-for-using-declaration.js format[hermes] 1`] = ` -"';' or 'in' expected inside 'for' (2:25) +"';' or 'in' expected inside 'for' (2:26) 1 | async function f() { > 2 | for (await using basic = reader();;); - | ^ + | ^ 3 | } 4 | Cause: ';' or 'in' expected inside 'for' (2:25) @@ -722,9 +722,9 @@ exports[`valid-module-block-top-level-await-using-binding.js format[flow] 1`] = `; exports[`valid-module-block-top-level-await-using-binding.js format[hermes] 1`] = ` -"';' expected (1:17) +"';' expected (1:18) > 1 | const m = module { - | ^ + | ^ 2 | await using foo = bar(); 3 | } 4 | @@ -818,9 +818,9 @@ exports[`valid-module-block-top-level-using-binding.js format[flow] 1`] = ` `; exports[`valid-module-block-top-level-using-binding.js format[hermes] 1`] = ` -"';' expected (1:7) +"';' expected (1:8) > 1 | module { - | ^ + | ^ 2 | using foo = bar(); 3 | } 4 | @@ -918,9 +918,9 @@ exports[`valid-using-as-identifier-for-await-of.js format[flow] 1`] = ` `; exports[`valid-using-as-identifier-for-await-of.js format[hermes] 1`] = ` -"'(' expected after 'for' (1:4) +"'(' expected after 'for' (1:5) > 1 | for await (using of of); - | ^ + | ^ 2 | Cause: '(' expected after 'for' (1:4) for await (using of of); @@ -947,7 +947,7 @@ for (using\`\`.foo in []); `; exports[`valid-using-as-identifier-for-in.js format[hermes] 1`] = ` -"Failed to parse source (0:0) +"Failed to parse source (0:1) 1 | for (using in []); 2 | for (using.foo in []); 3 | for (using().foo in []); @@ -1002,9 +1002,9 @@ using in using instanceof using; `; exports[`valid-using-as-identifier-in.js format[hermes] 1`] = ` -"'identifier' expected in declaration (1:6) +"'identifier' expected in declaration (1:7) > 1 | using in using instanceof using; - | ^ + | ^ 2 | Cause: 'identifier' expected in declaration (1:6) using in using instanceof using; diff --git a/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap b/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap index 5e0d21cf2..82ef05293 100644 --- a/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap +++ b/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap @@ -38,10 +38,10 @@ exports[`default-escaped.js format[flow] 1`] = ` `; exports[`default-escaped.js format[hermes] 1`] = ` -"expected declaration in export (2:7) +"expected declaration in export (2:8) 1 | // export asyn\\u{63} from "async"; > 2 | export n\\u{63} from "async"; - | ^ + | ^ Cause: expected declaration in export (2:7) export n\\u{63} from "async"; ^~~~~~~" diff --git a/tests/format/js/export-star/__snapshots__/format.test.js.snap b/tests/format/js/export-star/__snapshots__/format.test.js.snap index e79e75647..124abfb1c 100644 --- a/tests/format/js/export-star/__snapshots__/format.test.js.snap +++ b/tests/format/js/export-star/__snapshots__/format.test.js.snap @@ -81,9 +81,9 @@ exports[`export-star-as-string.js format[flow] 1`] = ` `; exports[`export-star-as-string.js format[hermes] 1`] = ` -"'identifier' expected in export clause (1:12) +"'identifier' expected in export clause (1:13) > 1 | export * as 'foo' from 'foo' - | ^ + | ^ 2 | Cause: 'identifier' expected in export clause (1:12) export * as 'foo' from 'foo' @@ -111,9 +111,9 @@ exports[`export-star-as-string2.js format[flow] 1`] = ` `; exports[`export-star-as-string2.js format[hermes] 1`] = ` -"'identifier' expected in export clause (1:12) +"'identifier' expected in export clause (1:13) > 1 | export * as "foo" from 'foo' - | ^ + | ^ 2 | Cause: 'identifier' expected in export clause (1:12) export * as "foo" from 'foo' diff --git a/tests/format/js/import-assertions/__snapshots__/format.test.js.snap b/tests/format/js/import-assertions/__snapshots__/format.test.js.snap index 93b9e163c..a2c7c8efa 100644 --- a/tests/format/js/import-assertions/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-assertions/__snapshots__/format.test.js.snap @@ -49,10 +49,10 @@ Cause: Missing semicolon. (2:31)" `; exports[`empty.js format[hermes] 1`] = ` -"';' expected (2:32) +"';' expected (2:33) 1 | export * as foo from "foo.json" > 2 | export * as bar from "bar.json" assert { } - | ^ + | ^ 3 | export * as baz from "baz.json" assert { /* comment */ } 4 | 5 | import * as foo from "foo.json" @@ -95,9 +95,9 @@ Cause: Missing semicolon. (1:20)" `; exports[`keyword-detect.js format[hermes] 1`] = ` -"';' expected (1:32) +"';' expected (1:33) > 1 | import "./test.json" /* with */ assert /* with */ { type: "json" } - | ^ + | ^ 2 | import {default as b} from "./test.json" /* with */ assert /* with */ { type: "json" } 3 | 4 | export {default as e} from "./test.json" /* with */ assert /* with */ { type: "json" } @@ -128,9 +128,9 @@ Cause: Unexpected token (1:57)" `; exports[`multi-types.js format[hermes] 1`] = ` -"';' expected (1:30) +"';' expected (1:31) > 1 | import json from "./foo.json" assert { type: "json", type: "bar" }; - | ^ + | ^ 2 | Cause: ';' expected (1:30) import json from "./foo.json" assert { type: "json", type: "bar" }; @@ -159,9 +159,9 @@ Cause: Missing semicolon. (1:26)" `; exports[`non-type.js format[hermes] 1`] = ` -"';' expected (1:27) +"';' expected (1:28) > 1 | import foo from "foo.json" assert { lazy: "true" }; - | ^ + | ^ 2 | Cause: ';' expected (1:27) import foo from "foo.json" assert { lazy: "true" }; @@ -211,9 +211,9 @@ Cause: Missing semicolon. (1:42)" `; exports[`re-export.js format[hermes] 1`] = ` -"';' expected (1:43) +"';' expected (1:44) > 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; - | ^ + | ^ 2 | export * from "foo.json" assert { type: "json" }; 3 | export * as foo3 from "foo.json" assert { type: "json" }; 4 | @@ -244,9 +244,9 @@ Cause: Missing semicolon. (1:29)" `; exports[`static-import.js format[hermes] 1`] = ` -"';' expected (1:30) +"';' expected (1:31) > 1 | import json from "./foo.json" assert { type: "json" }; - | ^ + | ^ 2 | Cause: ';' expected (1:30) import json from "./foo.json" assert { type: "json" }; @@ -275,9 +275,9 @@ Cause: Missing semicolon. (1:12)" `; exports[`without-from.js format[hermes] 1`] = ` -"';' expected (1:13) +"';' expected (1:14) > 1 | import "foo" assert { type: "json" } - | ^ + | ^ 2 | Cause: ';' expected (1:13) import "foo" assert { type: "json" } diff --git a/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap b/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap index be7bd1cde..d0b9084a5 100644 --- a/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap @@ -35,9 +35,9 @@ Cause: Missing semicolon. (1:31)" `; exports[`empty.js - {"bracketSpacing":false} format[hermes] 1`] = ` -"';' expected (1:32) +"';' expected (1:33) > 1 | export * as bar from "bar.json" assert { } - | ^ + | ^ Cause: ';' expected (1:32) export * as bar from "bar.json" assert { } ^" @@ -66,9 +66,9 @@ Cause: Missing semicolon. (1:42)" `; exports[`re-export.js - {"bracketSpacing":false} format[hermes] 1`] = ` -"';' expected (1:43) +"';' expected (1:44) > 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; - | ^ + | ^ 2 | Cause: ';' expected (1:43) export { default as foo2 } from "foo.json" assert { type: "json" }; @@ -98,9 +98,9 @@ Cause: Missing semicolon. (1:29)" `; exports[`static-import.js - {"bracketSpacing":false} format[hermes] 1`] = ` -"';' expected (1:30) +"';' expected (1:31) > 1 | import json from "./foo.json" assert { type: "json" }; - | ^ + | ^ 2 | Cause: ';' expected (1:30) import json from "./foo.json" assert { type: "json" }; diff --git a/tests/format/js/import/long-module-name/__snapshots__/format.test.js.snap b/tests/format/js/import/long-module-name/__snapshots__/format.test.js.snap index 420438f52..eb7e94586 100644 --- a/tests/format/js/import/long-module-name/__snapshots__/format.test.js.snap +++ b/tests/format/js/import/long-module-name/__snapshots__/format.test.js.snap @@ -51,9 +51,9 @@ exports[`import-defer.js format[flow] 1`] = ` `; exports[`import-defer.js format[hermes] 1`] = ` -"'meta' expected in member expression (1:7) +"'meta' expected in member expression (1:8) > 1 | import.defer("./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module"); - | ^ + | ^ 2 | import.defer( 3 | // Comment 4 | "./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module" @@ -150,9 +150,9 @@ exports[`import-source.js format[flow] 1`] = ` `; exports[`import-source.js format[hermes] 1`] = ` -"'meta' expected in member expression (1:7) +"'meta' expected in member expression (1:8) > 1 | import.source("./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module"); - | ^ + | ^ 2 | import.source( 3 | // Comment 4 | "./a/long/long/long/long/long/long/long/long/long/long/long/long/path/to/module" diff --git a/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap b/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap index fa8af572d..24be1ee65 100644 --- a/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap +++ b/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap @@ -107,11 +107,11 @@ exports[`text.js format[flow] 1`] = ` `; exports[`text.js format[hermes] 1`] = ` -"untagged template literal contains invalid escape sequence (6:16) +"untagged template literal contains invalid escape sequence (6:17) 4 | foo = markdown\`\\u{prettier}\\u{0065}\`; 5 | foo = css\`\\u{prettier}\\u{0065}\`; > 6 | foo = /* HTML */\`\\u{prettier}\\u{0065}\`; - | ^ + | ^ 7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`; 8 | 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`; diff --git a/tests/format/js/new-target/__snapshots__/format.test.js.snap b/tests/format/js/new-target/__snapshots__/format.test.js.snap index e41b151b3..5b8defbf0 100644 --- a/tests/format/js/new-target/__snapshots__/format.test.js.snap +++ b/tests/format/js/new-target/__snapshots__/format.test.js.snap @@ -21,9 +21,9 @@ exports[`outside-functions.js format[flow] 1`] = ` `; exports[`outside-functions.js format[hermes] 1`] = ` -"'new.target' not in a function (1:10) +"'new.target' not in a function (1:11) > 1 | const x = new.target; - | ^ + | ^ 2 | Cause: 'new.target' not in a function (1:10) const x = new.target; @@ -64,9 +64,10 @@ exports[`range.js format[flow] 1`] = ` `; exports[`range.js format[hermes] 1`] = ` -"'new.target' not in a function (2:0) +"'new.target' not in a function (2:1) 1 | const x = > 2 | new.target; + | ^ Cause: 'new.target' not in a function (2:0) new.target; ^~~~~~~~~~" diff --git a/tests/format/js/objects/__snapshots__/format.test.js.snap b/tests/format/js/objects/__snapshots__/format.test.js.snap index dcdd449f8..21dd851f9 100644 --- a/tests/format/js/objects/__snapshots__/format.test.js.snap +++ b/tests/format/js/objects/__snapshots__/format.test.js.snap @@ -163,11 +163,11 @@ exports[`expression.js format[flow] 1`] = ` `; exports[`expression.js format[hermes] 1`] = ` -"unexpected token in type annotation (5:4) +"unexpected token in type annotation (5:5) 3 | a = () => ({}).x; 4 | ({} && a, b); > 5 | ({}::b, 0); - | ^ + | ^ 6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0); 7 | ({}(), 0); 8 | ({} = 0); diff --git a/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap b/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap index 188f60e44..b3e11abb4 100644 --- a/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap +++ b/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap @@ -38,11 +38,11 @@ function myfunc() { `; exports[`eval-arguments.js format[hermes] 1`] = ` -"invalid assignment left-hand side (3:2) +"invalid assignment left-hand side (3:3) 1 | function myfunc() { 2 | eval = 1 > 3 | arguments = arguments; - | ^ + | ^ 4 | } 5 | Cause: invalid assignment left-hand side (3:2) @@ -119,9 +119,9 @@ exports[`function-declaration-in-while.js format[flow] 1`] = ` `; exports[`function-declaration-in-while.js format[hermes] 1`] = ` -"declaration not allowed as expression statement (1:14) +"declaration not allowed as expression statement (1:15) > 1 | while (false) function foo(){} - | ^ + | ^ 2 | Cause: declaration not allowed as expression statement (1:14) while (false) function foo(){} @@ -150,9 +150,9 @@ foo: function bar() {} `; exports[`labeled-function-declaration.js format[hermes] 1`] = ` -"Function declaration not allowed as body of labeled statement (1:5) +"Function declaration not allowed as body of labeled statement (1:6) > 1 | foo: function bar() {} - | ^ + | ^ 2 | Cause: Function declaration not allowed as body of labeled statement (1:5) foo: function bar() {} diff --git a/tests/format/jsx/_errors_/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap b/tests/format/jsx/_errors_/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap index 08721b27d..c329b6e7c 100644 --- a/tests/format/jsx/_errors_/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap +++ b/tests/format/jsx/_errors_/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap @@ -15,9 +15,9 @@ Cause: Sequence expressions cannot be directly nested inside JSX. Did you mean t `; exports[`snippet: #0 format[hermes] 1`] = ` -"'}' expected in JSX child expression (1:16) +"'}' expected in JSX child expression (1:17) > 1 | let x1 =
{a,b}
- | ^ + | ^ Cause: '}' expected in JSX child expression (1:16) let x1 =
{a,b}
~~^" diff --git a/tests/format/misc/filename-matters/flow-ambient/__snapshots__/format.test.js.snap b/tests/format/misc/filename-matters/flow-ambient/__snapshots__/format.test.js.snap index 047b237f8..57e3570b8 100644 --- a/tests/format/misc/filename-matters/flow-ambient/__snapshots__/format.test.js.snap +++ b/tests/format/misc/filename-matters/flow-ambient/__snapshots__/format.test.js.snap @@ -14,9 +14,9 @@ const foo: string; `; exports[`ambient.js.flow format[hermes] 1`] = ` -"missing initializer in const declaration (1:6) +"missing initializer in const declaration (1:7) > 1 | const foo: string; - | ^ + | ^ 2 | Cause: missing initializer in const declaration (1:6) const foo: string; @@ -36,9 +36,9 @@ const foo: string; `; exports[`snippet: #0 format[hermes] 1`] = ` -"missing initializer in const declaration (1:6) +"missing initializer in const declaration (1:7) > 1 | const foo: string; - | ^ + | ^ Cause: missing initializer in const declaration (1:6) const foo: string; ^~~~~~~~~~~" diff --git a/tests/format/typescript/as/break-after-keyword/__snapshots__/format.test.js.snap b/tests/format/typescript/as/break-after-keyword/__snapshots__/format.test.js.snap index b1ee1d3ba..b0e273968 100644 --- a/tests/format/typescript/as/break-after-keyword/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/as/break-after-keyword/__snapshots__/format.test.js.snap @@ -82,11 +82,11 @@ const firstItem_5 = ______________.items.find( `; exports[`18148.ts format[hermes] 1`] = ` -"';' expected (12:70) +"';' expected (12:71) 10 | 11 | // 79 width until \`as\` or \`satisfies\` keyword > 12 | const firstItem3 = _____________.find((item) => item.type === 'item') satisfies string | number; - | ^ + | ^ 13 | // 80 width until \`as\` or \`satisfies\` keyword 14 | const firstItem_3 = _____________.find((item) => item.type === 'item') satisfies string | number; 15 | diff --git a/tests/format/typescript/as/comments/__snapshots__/format.test.js.snap b/tests/format/typescript/as/comments/__snapshots__/format.test.js.snap index 670193621..f3eb56530 100644 --- a/tests/format/typescript/as/comments/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/as/comments/__snapshots__/format.test.js.snap @@ -146,11 +146,11 @@ Foo; `; exports[`18160.ts format[hermes] 1`] = ` -"';' expected (7:2) +"';' expected (7:3) 5 | comment 6 | */Foo; > 7 | 1 satisfies /* - | ^ + | ^ 8 | comment 9 | */Foo; 10 | diff --git a/tests/format/typescript/type-parameters-arguments/consistent/__snapshots__/format.test.js.snap b/tests/format/typescript/type-parameters-arguments/consistent/__snapshots__/format.test.js.snap index 06e010a97..930360316 100644 --- a/tests/format/typescript/type-parameters-arguments/consistent/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/type-parameters-arguments/consistent/__snapshots__/format.test.js.snap @@ -98,9 +98,9 @@ const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo exports[`template-literal-types.ts format[flow] 1`] = `"Missing visitor keys for 'TemplateLiteralTypeAnnotation'."`; exports[`template-literal-types.ts format[hermes] 1`] = ` -"unexpected token in type annotation (1:83) +"unexpected token in type annotation (1:84) > 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a; - | ^ + | ^ 2 | Cause: unexpected token in type annotation (1:83) const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a;