diff --git a/package.json b/package.json index 6065e55e9..b177a4abf 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ ], "dependencies": { "@angular/compiler": "11.1.1", - "@babel/code-frame": "7.12.11", + "@babel/code-frame": "7.12.13", "@babel/parser": "7.12.11", "@glimmer/syntax": "0.74.2", "@iarna/toml": "2.2.5", diff --git a/tests/css/range/__snapshots__/jsfmt.spec.js.snap b/tests/css/range/__snapshots__/jsfmt.spec.js.snap index 090dfdf59..887c9437f 100644 --- a/tests/css/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css/range/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ rangeEnd: 4 =====================================input====================================== > 1 | .x{} | ^^^^ - 2 | + 2 | =====================================output===================================== .x{} diff --git a/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap index 676102b83..6c97fb86a 100644 --- a/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap @@ -57,12 +57,12 @@ function baz(this: number, ...a) {} exports[`function_type.js - {"trailingComma":"all"} [babel-flow] format 1`] = ` "Unexpected token, expected \\")\\" (3:16) 1 | // @flow - 2 | + 2 | > 3 | type T = (this : number, a : string, b : number) => void | ^ - 4 | + 4 | 5 | type U = (this : number, ...c : any) => void - 6 | " + 6 |" `; exports[`function_type.js - {"trailingComma":"all"} format 1`] = ` @@ -95,11 +95,11 @@ type V = (this: number) => void; exports[`line_break.js - {"trailingComma":"all"} [babel-flow] format 1`] = ` "Unexpected token, expected \\")\\" (3:15) 1 | // @flow - 2 | + 2 | > 3 | type T = (this: boolean, | ^ 4 | a: number, - 5 | + 5 | 6 | b: number," `; @@ -197,13 +197,13 @@ class A { exports[`union_type.js - {"trailingComma":"all"} [babel-flow] format 1`] = ` "Unexpected token, expected \\")\\" (4:7) - 2 | + 2 | 3 | type A = ( > 4 | this: | SupperLongLongLongLongLongLongLongLongLongLongLongType | FooBarBazLorem12345, | ^ 5 | b: number, 6 | ) => boolean; - 7 | " + 7 |" `; exports[`union_type.js - {"trailingComma":"all"} format 1`] = ` diff --git a/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap b/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap index 648665abd..7a5bd1d3d 100644 --- a/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ rangeEnd: 3 =====================================input====================================== > 1 | {NPC{life}} | ^^^ - 2 | + 2 | =====================================output===================================== { NPC { diff --git a/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap index c11bf4473..c7d0ae146 100644 --- a/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap @@ -309,7 +309,7 @@ exports[`class-property.js [espree] format 1`] = ` > 3 | static propTypes = {}; | ^ 4 | }; - 5 | " + 5 |" `; exports[`class-property.js - {"arrowParens":"always"} [espree] format 1`] = ` @@ -319,7 +319,7 @@ exports[`class-property.js - {"arrowParens":"always"} [espree] format 1`] = ` > 3 | static propTypes = {}; | ^ 4 | }; - 5 | " + 5 |" `; exports[`class-property.js - {"arrowParens":"always"} format 1`] = ` @@ -350,7 +350,7 @@ exports[`class-property.js - {"trailingComma":"all"} [espree] format 1`] = ` > 3 | static propTypes = {}; | ^ 4 | }; - 5 | " + 5 |" `; exports[`class-property.js - {"trailingComma":"all"} format 1`] = ` diff --git a/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap index a6820e80c..6e78ef4d3 100644 --- a/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ exports[`arrows-bind.js [espree] format 1`] = ` | ^ 2 | (a => b)::c; 3 | a::(b => c); - 4 | " + 4 |" `; exports[`arrows-bind.js [meriyah] format 1`] = ` @@ -15,7 +15,7 @@ exports[`arrows-bind.js [meriyah] format 1`] = ` | ^ 2 | (a => b)::c; 3 | a::(b => c); - 4 | " + 4 |" `; exports[`arrows-bind.js format 1`] = ` diff --git a/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap index 6618920b1..cb22f4f14 100644 --- a/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`newline-before-arrow.js [espree] format 1`] = ` 1 | async x > 2 | => x | ^ - 3 | " + 3 |" `; exports[`newline-before-arrow.js [meriyah] format 1`] = ` @@ -13,7 +13,7 @@ exports[`newline-before-arrow.js [meriyah] format 1`] = ` 1 | async x > 2 | => x | ^ - 3 | " + 3 |" `; exports[`newline-before-arrow.js format 1`] = ` diff --git a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap index ac88339fa..4adcb644e 100644 --- a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap @@ -425,7 +425,7 @@ class C { exports[`decimal.js [espree] format 1`] = ` "Identifier directly after number (3:4) 1 | // https://github.com/babel/babel/pull/11640 - 2 | + 2 | > 3 | 100m; | ^ 4 | 9223372036854775807m; @@ -436,7 +436,7 @@ exports[`decimal.js [espree] format 1`] = ` exports[`decimal.js [meriyah] format 1`] = ` "[3:3]: No identifiers allowed directly after numeric literal (3:3) 1 | // https://github.com/babel/babel/pull/11640 - 2 | + 2 | > 3 | 100m; | ^ 4 | 9223372036854775807m; @@ -510,11 +510,11 @@ typeof 1m === "decimal128"; exports[`decorators.js [espree] format 1`] = ` "Unexpected character '@' (3:1) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-decorators - 2 | + 2 | > 3 | @annotation | ^ 4 | class MyClass { } - 5 | + 5 | 6 | function annotation(target) {" `; @@ -591,7 +591,7 @@ function enumerable(value) { exports[`do-expressions.js [espree] format 1`] = ` "Unexpected token do (3:9) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions - 2 | + 2 | > 3 | let a = do { | ^ 4 | if(x > 10) { @@ -602,7 +602,7 @@ exports[`do-expressions.js [espree] format 1`] = ` exports[`do-expressions.js [meriyah] format 1`] = ` "[3:10]: Unexpected token: 'do' (3:10) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions - 2 | + 2 | > 3 | let a = do { | ^ 4 | if(x > 10) { @@ -674,20 +674,20 @@ import(prettier).then((module) => console.log(module)); exports[`export-default-from.js [espree] format 1`] = ` "Unexpected token v (4:8) - 2 | - 3 | + 2 | + 3 | > 4 | export v from 'mod'; | ^ - 5 | " + 5 |" `; exports[`export-default-from.js [meriyah] format 1`] = ` "[4:8]: Unexpected token: 'identifier' (4:8) - 2 | - 3 | + 2 | + 3 | > 4 | export v from 'mod'; | ^ - 5 | " + 5 |" `; exports[`export-default-from.js format 1`] = ` @@ -730,19 +730,19 @@ export * as ns from "mod"; exports[`flow.js [espree] format 1`] = ` "Unexpected token : (3:17) 1 | // https://babeljs.io/docs/en/babel-preset-flow - 2 | + 2 | > 3 | function foo(one: any, two: number, three?): string {} | ^ - 4 | " + 4 |" `; exports[`flow.js [meriyah] format 1`] = ` "[3:17]: Expected ')' (3:17) 1 | // https://babeljs.io/docs/en/babel-preset-flow - 2 | + 2 | > 3 | function foo(one: any, two: number, three?): string {} | ^ - 4 | " + 4 |" `; exports[`flow.js format 1`] = ` @@ -766,23 +766,23 @@ function foo(one: any, two: number, three?): string {} exports[`function-bind.js [espree] format 1`] = ` "Unexpected token : (3:5) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind - 2 | + 2 | > 3 | obj::func | ^ 4 | // is equivalent to: 5 | func.bind(obj) - 6 | " + 6 |" `; exports[`function-bind.js [meriyah] format 1`] = ` "[3:5]: Unexpected token: ':' (3:5) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind - 2 | + 2 | > 3 | obj::func | ^ 4 | // is equivalent to: 5 | func.bind(obj) - 6 | " + 6 |" `; exports[`function-bind.js format 1`] = ` @@ -832,24 +832,24 @@ obj.func.call(obj, val); exports[`function-sent.js [espree] format 1`] = ` "Unexpected token . (4:33) - 2 | + 2 | 3 | function* generator() { > 4 | console.log(\\"Sent\\", function.sent); | ^ 5 | console.log(\\"Yield\\", yield); 6 | } - 7 | " + 7 |" `; exports[`function-sent.js [meriyah] format 1`] = ` "[4:33]: Expected '(' (4:33) - 2 | + 2 | 3 | function* generator() { > 4 | console.log(\\"Sent\\", function.sent); | ^ 5 | console.log(\\"Yield\\", yield); 6 | } - 7 | " + 7 |" `; exports[`function-sent.js format 1`] = ` @@ -888,14 +888,14 @@ exports[`import-assertions-dynamic.js [espree] format 1`] = ` "Unexpected token , (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`import-assertions-dynamic.js [meriyah] format 1`] = ` "[1:20]: Expected ')' (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`import-assertions-dynamic.js format 1`] = ` @@ -916,14 +916,14 @@ exports[`import-assertions-static.js [espree] format 1`] = ` "Unexpected token assert (1:31) > 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`import-assertions-static.js [meriyah] format 1`] = ` "[1:36]: Unexpected token: 'identifier' (1:36) > 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`import-assertions-static.js format 1`] = ` @@ -1017,11 +1017,11 @@ var profile = ( exports[`logical-assignment-operators.js [meriyah] format 1`] = ` "[3:5]: Unexpected token: '=' (3:5) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-logical-assignment-operators - 2 | + 2 | > 3 | a ||= b; | ^ 4 | obj.a.b ||= c; - 5 | + 5 | 6 | a &&= b;" `; @@ -1056,7 +1056,7 @@ exports[`module-string-names.js [espree] format 1`] = ` > 1 | import { \\"😄\\" as smile } from \\"./emojis.js\\"; | ^ 2 | export { smile as \\"😄\\" } from \\"./emojis.js\\"; - 3 | " + 3 |" `; exports[`module-string-names.js [meriyah] format 1`] = ` @@ -1064,7 +1064,7 @@ exports[`module-string-names.js [meriyah] format 1`] = ` > 1 | import { \\"😄\\" as smile } from \\"./emojis.js\\"; | ^ 2 | export { smile as \\"😄\\" } from \\"./emojis.js\\"; - 3 | " + 3 |" `; exports[`module-string-names.js format 1`] = ` @@ -1260,10 +1260,10 @@ try { exports[`optional-chaining.js [espree] format 1`] = ` "Optional chaining cannot appear in the callee of new expressions (56:21) 54 | }; - 55 | + 55 | > 56 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance | ^ - 57 | + 57 | 58 | const safe5 = new obj?.qux?.baz(); // undefined 59 | const safe6 = new obj?.foo.bar.qux?.(); // undefined" `; @@ -1271,10 +1271,10 @@ exports[`optional-chaining.js [espree] format 1`] = ` exports[`optional-chaining.js [meriyah] format 1`] = ` "[56:22]: Invalid optional chain from new expression (56:22) 54 | }; - 55 | + 55 | > 56 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance | ^ - 57 | + 57 | 58 | const safe5 = new obj?.qux?.baz(); // undefined 59 | const safe6 = new obj?.foo.bar.qux?.(); // undefined" `; @@ -1444,22 +1444,22 @@ const ret = delete obj?.foo?.bar?.baz; // true exports[`partial-application.js [espree] format 1`] = ` "Unexpected token ? (5:23) 3 | function add(x, y) { return x + y; } - 4 | + 4 | > 5 | const addOne = add(1, ?); // apply from the left | ^ 6 | addOne(2); // 3 - 7 | + 7 | 8 | const addTen = add(?, 10); // apply from the right" `; exports[`partial-application.js [meriyah] format 1`] = ` "[5:23]: Unexpected token: '?' (5:23) 3 | function add(x, y) { return x + y; } - 4 | + 4 | > 5 | const addOne = add(1, ?); // apply from the left | ^ 6 | addOne(2); // 3 - 7 | + 7 | 8 | const addTen = add(?, 10); // apply from the right" `; @@ -1519,7 +1519,7 @@ super.f(?); // partial application allowed for call on |SuperProperty| exports[`pipeline-operator-fsharp.js [espree] format 1`] = ` "Unexpected token > (5:4) - 3 | + 3 | 4 | promise > 5 | |> await | ^ @@ -1530,7 +1530,7 @@ exports[`pipeline-operator-fsharp.js [espree] format 1`] = ` exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = ` "[5:4]: Unexpected token: '>' (5:4) - 3 | + 3 | 4 | promise > 5 | |> await | ^ @@ -1617,7 +1617,7 @@ let newScore = boundScore(0, 100, add(7, double(person.score))); exports[`pipeline-operator-minimal.js [espree] format 1`] = ` "Identifier 'result' has already been declared (7:5) 5 | result //=> \\"Hello, hello!\\" - 6 | + 6 | > 7 | let result = \\"hello\\" | ^ 8 | |> doubleSay @@ -1627,13 +1627,13 @@ exports[`pipeline-operator-minimal.js [espree] format 1`] = ` exports[`pipeline-operator-minimal.js [meriyah] format 1`] = ` "[8:4]: Unexpected token: '>' (8:4) - 6 | + 6 | 7 | let result = \\"hello\\" > 8 | |> doubleSay | ^ 9 | |> capitalize 10 | |> exclaim; - 11 | " + 11 |" `; exports[`pipeline-operator-minimal.js format 1`] = ` @@ -1671,7 +1671,7 @@ result; //=> "Hello, hello!" exports[`pipeline-operator-smart.js [espree] format 1`] = ` "Unexpected token > (5:2) - 3 | + 3 | 4 | value > 5 | |> await # | ^ @@ -1682,7 +1682,7 @@ exports[`pipeline-operator-smart.js [espree] format 1`] = ` exports[`pipeline-operator-smart.js [meriyah] format 1`] = ` "[5:2]: Unexpected token: '>' (5:2) - 3 | + 3 | 4 | value > 5 | |> await # | ^ @@ -1731,11 +1731,11 @@ value exports[`private-fields-in-in.js [espree] format 1`] = ` "Unexpected character '#' (4:3) - 2 | + 2 | 3 | class C { > 4 | #brand; | ^ - 5 | + 5 | 6 | static isC(obj) { 7 | try {" `; @@ -1864,11 +1864,11 @@ class C { exports[`private-methods.js [espree] format 1`] = ` "Unexpected character '#' (6:3) - 4 | + 4 | 5 | class Counter extends HTMLElement { > 6 | #xValue = 0; | ^ - 7 | + 7 | 8 | get #x() { return this.#xValue; } 9 | set #x(value) {" `; @@ -1970,14 +1970,14 @@ exports[`record-tuple-tuple.js [espree] format 1`] = ` "Unexpected character '#' (1:16) > 1 | const tuple1 = #[1, 2, 3]; | ^ - 2 | " + 2 |" `; exports[`record-tuple-tuple.js [meriyah] format 1`] = ` "[1:16]: '#' not followed by identifier (1:16) > 1 | const tuple1 = #[1, 2, 3]; | ^ - 2 | " + 2 |" `; exports[`record-tuple-tuple.js format 1`] = ` @@ -1997,23 +1997,23 @@ const tuple1 = #[1, 2, 3]; exports[`throw-expressions.js [espree] format 1`] = ` "Unexpected token throw (3:23) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions - 2 | + 2 | > 3 | function test(param = throw new Error('required!')) { | ^ 4 | const test = param === true || throw new Error('Falsy!'); 5 | } - 6 | " + 6 |" `; exports[`throw-expressions.js [meriyah] format 1`] = ` "[3:27]: Unexpected token: 'throw' (3:27) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions - 2 | + 2 | > 3 | function test(param = throw new Error('required!')) { | ^ 4 | const test = param === true || throw new Error('Falsy!'); 5 | } - 6 | " + 6 |" `; exports[`throw-expressions.js format 1`] = ` @@ -2041,19 +2041,19 @@ function test(param = throw new Error("required!")) { exports[`typescript.js [espree] format 1`] = ` "Unexpected token : (3:8) 1 | // https://babeljs.io/docs/en/babel-preset-typescript - 2 | + 2 | > 3 | const x: number = 0; | ^ - 4 | " + 4 |" `; exports[`typescript.js [meriyah] format 1`] = ` "[3:8]: Missing initializer in const declaration (3:8) 1 | // https://babeljs.io/docs/en/babel-preset-typescript - 2 | + 2 | > 3 | const x: number = 0; | ^ - 4 | " + 4 |" `; exports[`typescript.js format 1`] = ` @@ -2077,22 +2077,22 @@ const x: number = 0; exports[`v8intrinsic.js [espree] format 1`] = ` "Unexpected token % (3:1) 1 | // https://github.com/babel/babel/pull/10148 - 2 | + 2 | > 3 | %DebugPrint(foo); | ^ - 4 | - 5 | + 4 | + 5 | 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json" `; exports[`v8intrinsic.js [meriyah] format 1`] = ` "[3:1]: Unexpected token: '%' (3:1) 1 | // https://github.com/babel/babel/pull/10148 - 2 | + 2 | > 3 | %DebugPrint(foo); | ^ - 4 | - 5 | + 4 | + 5 | 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json" `; diff --git a/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap index 912e5c4eb..5effef05e 100644 --- a/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap @@ -744,7 +744,7 @@ exports[`like-regexp.js [espree] format 1`] = ` "Unterminated regular expression (1:19) > 1 | 0 ? a : { b : 1 }/2; | ^ - 2 | " + 2 |" `; exports[`like-regexp.js format 1`] = ` diff --git a/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap index 1de03edb8..c5580b524 100644 --- a/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap @@ -7,7 +7,7 @@ exports[`await.js [espree] format 1`] = ` > 3 | return (await request)::doSyncThing(); | ^ 4 | }; - 5 | " + 5 |" `; exports[`await.js [meriyah] format 1`] = ` @@ -17,7 +17,7 @@ exports[`await.js [meriyah] format 1`] = ` > 3 | return (await request)::doSyncThing(); | ^ 4 | }; - 5 | " + 5 |" `; exports[`await.js - {"semi":false} [espree] format 1`] = ` @@ -27,7 +27,7 @@ exports[`await.js - {"semi":false} [espree] format 1`] = ` > 3 | return (await request)::doSyncThing(); | ^ 4 | }; - 5 | " + 5 |" `; exports[`await.js - {"semi":false} [meriyah] format 1`] = ` @@ -37,7 +37,7 @@ exports[`await.js - {"semi":false} [meriyah] format 1`] = ` > 3 | return (await request)::doSyncThing(); | ^ 4 | }; - 5 | " + 5 |" `; exports[`await.js - {"semi":false} format 1`] = ` diff --git a/tests/js/bom/__snapshots__/jsfmt.spec.js.snap b/tests/js/bom/__snapshots__/jsfmt.spec.js.snap index ea19003f7..b14dd255e 100644 --- a/tests/js/bom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/bom/__snapshots__/jsfmt.spec.js.snap @@ -27,13 +27,13 @@ rangeStart: 11 | | printWidth =====================================input====================================== 1 |  - 2 | + 2 | > 3 | class a { | ^^^^ > 4 | b( <|> ) {} | ^^^^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x =====================================output=====================================  @@ -55,15 +55,15 @@ rangeStart: 11 | | printWidth =====================================input====================================== 1 |  - 2 | + 2 | > 3 | class a { | ^^^^ > 4 | b( ) {} | ^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x - 8 | + 8 | =====================================output=====================================  @@ -86,16 +86,16 @@ rangeStart: 12 | | printWidth =====================================input====================================== 1 |  - 2 | - 3 | + 2 | + 3 | > 4 | class a { | ^^^^ > 5 | b( <|> ) {} | ^^^^^^^^^^^^^^ 6 | } - 7 | + 7 | 8 | let x - 9 | + 9 | =====================================output=====================================  diff --git a/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap b/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap index d211bc9a1..439b8891e 100644 --- a/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/call/no-argument/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`import.js [espree] format 1`] = ` > 1 | import(/* comment */) | ^ 2 | new import(/* comment */) - 3 | " + 3 |" `; exports[`import.js [flow] format 1`] = ` @@ -13,7 +13,7 @@ exports[`import.js [flow] format 1`] = ` > 1 | import(/* comment */) | ^ 2 | new import(/* comment */) - 3 | " + 3 |" `; exports[`import.js [meriyah] format 1`] = ` @@ -21,7 +21,7 @@ exports[`import.js [meriyah] format 1`] = ` > 1 | import(/* comment */) | ^ 2 | new import(/* comment */) - 3 | " + 3 |" `; exports[`import.js [typescript] format 1`] = ` @@ -29,7 +29,7 @@ exports[`import.js [typescript] format 1`] = ` 1 | import(/* comment */) > 2 | new import(/* comment */) | ^ - 3 | " + 3 |" `; exports[`import.js format 1`] = ` diff --git a/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap index ac500b314..67fe4bafd 100644 --- a/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap @@ -3,37 +3,37 @@ exports[`optional-chaining.js [espree] format 1`] = ` "Unexpected character '#' (3:13) 1 | // https://github.com/babel/babel/pull/11669 - 2 | + 2 | > 3 | delete obj?.#x.a | ^ - 4 | " + 4 |" `; exports[`optional-chaining.js [meriyah] format 1`] = ` "[3:13]: Dot property must be an identifier (3:13) 1 | // https://github.com/babel/babel/pull/11669 - 2 | + 2 | > 3 | delete obj?.#x.a | ^ - 4 | " + 4 |" `; exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = ` "Unexpected character '#' (3:13) 1 | // https://github.com/babel/babel/pull/11669 - 2 | + 2 | > 3 | delete obj?.#x.a | ^ - 4 | " + 4 |" `; exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = ` "[3:13]: Dot property must be an identifier (3:13) 1 | // https://github.com/babel/babel/pull/11669 - 2 | + 2 | > 3 | delete obj?.#x.a | ^ - 4 | " + 4 |" `; exports[`optional-chaining.js - {"semi":false} format 1`] = ` @@ -78,7 +78,7 @@ exports[`private_fields.js [espree] format 1`] = ` > 1 | class A { #x; #y; } | ^ 2 | class B { #x = 0; #y = 1; } - 3 | + 3 | 4 | class C {" `; @@ -87,7 +87,7 @@ exports[`private_fields.js - {"semi":false} [espree] format 1`] = ` > 1 | class A { #x; #y; } | ^ 2 | class B { #x = 0; #y = 1; } - 3 | + 3 | 4 | class C {" `; diff --git a/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap index 97ffe2ef4..b0ab6e9d7 100644 --- a/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`example.js [espree] format 1`] = ` "'super' keyword outside a method (1:1) > 1 | super(); | ^ - 2 | " + 2 |" `; exports[`example.js [meriyah] format 1`] = ` "[1:6]: 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 |" `; exports[`example.js format 1`] = ` diff --git a/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap b/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap index 3df1a940d..ab3787427 100644 --- a/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap @@ -7,7 +7,7 @@ exports[`pipeline_own_line.js [espree] format 1`] = ` > 4 | |> x | ^ 5 | } - 6 | + 6 | 7 | bifornCringerMoshedPerplexSawder(" `; @@ -18,7 +18,7 @@ exports[`pipeline_own_line.js [meriyah] format 1`] = ` > 4 | |> x | ^ 5 | } - 6 | + 6 | 7 | bifornCringerMoshedPerplexSawder(" `; diff --git a/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap b/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap index 09262351b..459e006ec 100644 --- a/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap @@ -315,10 +315,10 @@ rangeStart: 31 | | printWidth =====================================input====================================== 1 | thisWontBeFormatted ( 1 ,3) - 2 | + 2 | > 3 | thisWillBeFormatted <|> (2 ,3, ) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 4 | +> 4 | | ^ > 5 | thisWontBeFormatted (2, 90 ,) | ^ @@ -343,10 +343,10 @@ rangeStart: 31 | | printWidth =====================================input====================================== 1 | thisWontBeFormatted ( 1 ,3) - 2 | + 2 | > 3 | thisWillBeFormatted (2 ,3<|>, ) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 4 | +> 4 | | ^ > 5 | thisWontBeFormatted (2, 90 ,) | ^ @@ -371,10 +371,10 @@ rangeStart: 31 | | printWidth =====================================input====================================== 1 | thisWontBeFormatted ( 1 ,3) - 2 | + 2 | > 3 | thisWillBeFormatted (2 ,3, <|> ) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 4 | +> 4 | | ^ > 5 | thisWontBeFormatted (2, 90 ,) | ^ @@ -399,11 +399,11 @@ rangeStart: 30 | | printWidth =====================================input====================================== 1 | thisWontBeFormatted <|> ( 1 ,3) -> 2 | +> 2 | | ^ > 3 | thisWillBeFormatted (2 ,3, ) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 4 | +> 4 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 5 | thisWontBeFormatted (2, 90 ,) | ^ @@ -428,10 +428,10 @@ rangeStart: 31 | | printWidth =====================================input====================================== 1 | thisWontBeFormatted ( 1 ,3) - 2 | + 2 | > 3 | thisWillBeFormatted (2 ,3, ) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 4 | +> 4 | | ^ > 5 | thisWontBeFormatted (2, 9<|>0 ,) | ^^^^ diff --git a/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap index c1fda3302..d28627f51 100644 --- a/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap @@ -17,7 +17,7 @@ exports[`comments.js [meriyah] format 1`] = ` > 4 | static property: Array; | ^ 5 | } - 6 | " + 6 |" `; exports[`comments.js format 1`] = ` diff --git a/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap index 403bcc68d..eabe686e0 100644 --- a/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap @@ -4,18 +4,18 @@ exports[`after_export.js [espree] format 1`] = ` "Unexpected character '@' (1:8) > 1 | export @decorator class Foo {} | ^ - 2 | + 2 | 3 | export default @decorator class {} - 4 | " + 4 |" `; exports[`after_export.js [meriyah] format 1`] = ` "[1:8]: Unexpected token: '@' (1:8) > 1 | export @decorator class Foo {} | ^ - 2 | + 2 | 3 | export default @decorator class {} - 4 | " + 4 |" `; exports[`after_export.js format 1`] = ` @@ -45,7 +45,7 @@ exports[`before_export.js [espree] format 1`] = ` > 1 | @decorator | ^ 2 | export class Foo {} - 3 | + 3 | 4 | @decorator" `; diff --git a/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap index 085fb5091..c63ccd585 100644 --- a/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap @@ -4,9 +4,9 @@ exports[`classes.js [espree] format 1`] = ` "Unexpected character '@' (1:1) > 1 | @deco class Foo {} | ^ - 2 | + 2 | 3 | @deco export class Bar {} - 4 | " + 4 |" `; exports[`classes.js format 1`] = ` @@ -59,7 +59,7 @@ const bar = exports[`comments.js [espree] format 1`] = ` "Unexpected character '@' (3:1) 1 | var x = 100 - 2 | + 2 | > 3 | @Hello({ | ^ 4 | a: 'a', // Comment is in the wrong place @@ -140,12 +140,12 @@ export class Bar {} exports[`methods.js [espree] format 1`] = ` "Unexpected character '@' (3:3) - 1 | + 1 | 2 | class Yo { > 3 | @foo(\\"hello\\") | ^ 4 | async plop() {} - 5 | + 5 | 6 | @anotherDecoratorWithALongName(\\"and a very long string as a first argument\\")" `; @@ -184,7 +184,7 @@ class Yo { exports[`mixed.js [espree] format 1`] = ` "Unexpected character '@' (3:1) 1 | // https://github.com/prettier/prettier/issues/6747 - 2 | + 2 | > 3 | @foo | ^ 4 | export default class MyComponent { @@ -221,22 +221,22 @@ export default class MyComponent { exports[`mobx.js [espree] format 1`] = ` "Unexpected character '@' (3:1) 1 | import {observable} from \\"mobx\\"; - 2 | + 2 | > 3 | @observer class OrderLine { | ^ 4 | @observable price:number = 0; 5 | @observable amount:number = 1; - 6 | " + 6 |" `; exports[`mobx.js [meriyah] format 1`] = ` "[4:20]: Unexpected token: ':' (4:20) - 2 | + 2 | 3 | @observer class OrderLine { > 4 | @observable price:number = 0; | ^ 5 | @observable amount:number = 1; - 6 | + 6 | 7 | constructor(price) {" `; @@ -438,7 +438,7 @@ exports[`parens.js [espree] format 1`] = ` | ^ 3 | x 4 | } - 5 | " + 5 |" `; exports[`parens.js format 1`] = ` @@ -466,7 +466,7 @@ exports[`redux.js [espree] format 1`] = ` > 1 | @connect(mapStateToProps, mapDispatchToProps) | ^ 2 | export class MyApp extends React.Component {} - 3 | + 3 | 4 | @connect(state => ({ todos: state.todos }))" `; diff --git a/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap b/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap index 66f06ab32..e35226160 100644 --- a/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap @@ -4,28 +4,28 @@ exports[`assertions.js [espree] format 1`] = ` "Unexpected token , (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`assertions.js [flow] format 1`] = ` "Unexpected token \`,\`, expected the token \`)\` (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`assertions.js [meriyah] format 1`] = ` "[1:20]: Expected ')' (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`assertions.js [typescript] format 1`] = ` "Dynamic import must have one specifier as an argument. (1:8) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`assertions.js format 1`] = ` diff --git a/tests/js/eol/__snapshots__/jsfmt.spec.js.snap b/tests/js/eol/__snapshots__/jsfmt.spec.js.snap index 527b3d550..07f517f29 100644 --- a/tests/js/eol/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/eol/__snapshots__/jsfmt.spec.js.snap @@ -82,14 +82,14 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( <|> ) {} | ^^^^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x =====================================output===================================== @@ -112,14 +112,14 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( <|> ) {} | ^^^^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x =====================================output===================================== @@ -142,14 +142,14 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( <|> ) {} | ^^^^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x =====================================output===================================== @@ -172,14 +172,14 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( <|> ) {} | ^^^^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x =====================================output===================================== @@ -201,16 +201,16 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( ) {} | ^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x - 8 | + 8 | =====================================output===================================== @@ -232,16 +232,16 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( ) {} | ^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x - 8 | + 8 | =====================================output===================================== @@ -263,16 +263,16 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( ) {} | ^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x - 8 | + 8 | =====================================output===================================== @@ -294,16 +294,16 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( ) {} | ^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x - 8 | + 8 | =====================================output===================================== @@ -326,17 +326,17 @@ rangeEnd: 27 rangeStart: 11 | | printWidth =====================================input====================================== - 1 | - 2 | - 3 | + 1 | + 2 | + 3 | > 4 | class a { | ^^^^ > 5 | b( <|> ) {} | ^^^^^^^^^^^^^^ 6 | } - 7 | + 7 | 8 | let x - 9 | + 9 | =====================================output===================================== @@ -360,17 +360,17 @@ rangeEnd: 27 rangeStart: 11 | | printWidth =====================================input====================================== - 1 | - 2 | - 3 | + 1 | + 2 | + 3 | > 4 | class a { | ^^^^ > 5 | b( <|> ) {} | ^^^^^^^^^^^^^^ 6 | } - 7 | + 7 | 8 | let x - 9 | + 9 | =====================================output===================================== @@ -394,17 +394,17 @@ rangeEnd: 27 rangeStart: 11 | | printWidth =====================================input====================================== - 1 | - 2 | - 3 | + 1 | + 2 | + 3 | > 4 | class a { | ^^^^ > 5 | b( <|> ) {} | ^^^^^^^^^^^^^^ 6 | } - 7 | + 7 | 8 | let x - 9 | + 9 | =====================================output===================================== @@ -428,17 +428,17 @@ rangeEnd: 27 rangeStart: 11 | | printWidth =====================================input====================================== - 1 | - 2 | - 3 | + 1 | + 2 | + 3 | > 4 | class a { | ^^^^ > 5 | b( <|> ) {} | ^^^^^^^^^^^^^^ 6 | } - 7 | + 7 | 8 | let x - 9 | + 9 | =====================================output===================================== diff --git a/tests/js/exports/__snapshots__/jsfmt.spec.js.snap b/tests/js/exports/__snapshots__/jsfmt.spec.js.snap index 0d9be4fbf..9366302a9 100644 --- a/tests/js/exports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/exports/__snapshots__/jsfmt.spec.js.snap @@ -3,23 +3,23 @@ exports[`test.js [espree] format 1`] = ` "Unexpected token a (3:8) 1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\"; - 2 | + 2 | > 3 | export a,{b} from \\"./baz\\"; | ^ - 4 | + 4 | 5 | export * as ns from \\"mod\\"; - 6 | " + 6 |" `; exports[`test.js [meriyah] format 1`] = ` "[3:8]: Unexpected token: 'identifier' (3:8) 1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\"; - 2 | + 2 | > 3 | export a,{b} from \\"./baz\\"; | ^ - 4 | + 4 | 5 | export * as ns from \\"mod\\"; - 6 | " + 6 |" `; exports[`test.js format 1`] = ` diff --git a/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap b/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap index 1dfb06751..bd4aa50ec 100644 --- a/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`dynamic-import.js [espree] format 1`] = ` "Unexpected token , (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`dynamic-import.js [meriyah] format 1`] = ` "[1:20]: Expected ')' (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`dynamic-import.js format 1`] = ` @@ -34,7 +34,7 @@ exports[`empty.js [espree] format 1`] = ` > 2 | export * as bar from \\"bar.json\\" assert { } | ^ 3 | export * as baz from \\"baz.json\\" assert { /* comment */ } - 4 | + 4 | 5 | import * as foo from \\"foo.json\\"" `; @@ -44,7 +44,7 @@ exports[`empty.js [meriyah] format 1`] = ` > 2 | export * as bar from \\"bar.json\\" assert { } | ^ 3 | export * as baz from \\"baz.json\\" assert { /* comment */ } - 4 | + 4 | 5 | import * as foo from \\"foo.json\\"" `; @@ -77,14 +77,14 @@ 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 |" `; exports[`multi-types.js [meriyah] format 1`] = ` "[1:36]: Unexpected token: 'identifier' (1:36) > 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" }; | ^ - 2 | " + 2 |" `; exports[`multi-types.js format 1`] = ` @@ -123,7 +123,7 @@ 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 |" `; exports[`re-export.js [meriyah] format 1`] = ` @@ -132,7 +132,7 @@ 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 |" `; exports[`re-export.js format 1`] = ` @@ -157,14 +157,14 @@ exports[`static-import.js [espree] format 1`] = ` "Unexpected token assert (1:31) > 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`static-import.js [meriyah] format 1`] = ` "[1:36]: Unexpected token: 'identifier' (1:36) > 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`static-import.js format 1`] = ` @@ -185,14 +185,14 @@ exports[`without-from.js [espree] format 1`] = ` "Unexpected token assert (1:14) > 1 | import \\"foo\\" assert { type: \\"json\\" } | ^ - 2 | " + 2 |" `; exports[`without-from.js [meriyah] format 1`] = ` "[1:19]: Unexpected token: 'identifier' (1:19) > 1 | import \\"foo\\" assert { type: \\"json\\" } | ^ - 2 | " + 2 |" `; exports[`without-from.js format 1`] = ` diff --git a/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap b/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap index 3e06a9d9e..96bf68213 100644 --- a/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = ` "Unexpected token , (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = ` "[1:20]: Expected ')' (1:20) > 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); | ^ - 2 | " + 2 |" `; exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = ` @@ -59,14 +59,14 @@ exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = ` "Unexpected token assert (1:33) > 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = ` "[1:38]: Unexpected token: 'identifier' (1:38) > 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`re-export.js - {"bracketSpacing":false} format 1`] = ` @@ -88,14 +88,14 @@ 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 |" `; exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = ` "[1:36]: Unexpected token: 'identifier' (1:36) > 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`static-import.js - {"bracketSpacing":false} format 1`] = ` diff --git a/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap b/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap index 5b5a129e1..dce8de945 100644 --- a/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`duplicate_bindings.js [espree] format 1`] = ` "Identifier 'A' has already been declared (1:19) > 1 | class A{} class A{} | ^ - 2 | " + 2 |" `; exports[`duplicate_bindings.js format 1`] = ` diff --git a/tests/js/literal/__snapshots__/jsfmt.spec.js.snap b/tests/js/literal/__snapshots__/jsfmt.spec.js.snap index c57ee6471..5f5daa18c 100644 --- a/tests/js/literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/literal/__snapshots__/jsfmt.spec.js.snap @@ -4,21 +4,21 @@ exports[`invalid-exponent.js [espree] format 1`] = ` "Invalid number (1:1) > 1 | 12.3e | ^ - 2 | " + 2 |" `; exports[`invalid-exponent.js [meriyah] format 1`] = ` "[1:5]: Non-number found after exponent indicator (1:5) > 1 | 12.3e | ^ - 2 | " + 2 |" `; exports[`invalid-exponent.js [typescript] format 1`] = ` "Digit expected. (1:6) > 1 | 12.3e | ^ - 2 | " + 2 |" `; exports[`invalid-exponent.js format 1`] = ` @@ -42,7 +42,7 @@ exports[`number.js [espree] format 1`] = ` | ^ 3 | return (100).toString(); 4 | } - 5 | " + 5 |" `; exports[`number.js [meriyah] format 1`] = ` @@ -52,7 +52,7 @@ exports[`number.js [meriyah] format 1`] = ` | ^ 3 | return (100).toString(); 4 | } - 5 | " + 5 |" `; exports[`number.js format 1`] = ` diff --git a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap index 20ffcc223..4ea6b04c8 100644 --- a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`invalid.js [espree] format 1`] = ` "Assigning to rvalue (1:21) > 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz; | ^ - 2 | " + 2 |" `; exports[`invalid.js [meriyah] format 1`] = ` "[1:19]: Unexpected token: '=' (1:19) > 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz; | ^ - 2 | " + 2 |" `; exports[`invalid.js format 1`] = ` @@ -32,7 +32,7 @@ exports[`logical-assignment.js [meriyah] format 1`] = ` "[1:5]: Unexpected token: '=' (1:5) > 1 | a ||= b; | ^ - 2 | + 2 | 3 | a &&= \\"foo\\"; 4 | b ||= \\"foo\\";" `; diff --git a/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap b/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap index 2dab89f0b..d1334de2d 100644 --- a/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap @@ -55,7 +55,7 @@ exports[`module-string-names-import.js [espree] format 1`] = ` | ^ 2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\"; 3 | import { \\"學而時習之,不亦說乎?\\" as quotation } from \\"Confucius\\"; - 4 | " + 4 |" `; exports[`module-string-names-import.js [meriyah] format 1`] = ` @@ -64,7 +64,7 @@ exports[`module-string-names-import.js [meriyah] format 1`] = ` | ^ 2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\"; 3 | import { \\"學而時習之,不亦說乎?\\" as quotation } from \\"Confucius\\"; - 4 | " + 4 |" `; exports[`module-string-names-import.js format 1`] = ` diff --git a/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap b/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap index c5f782e1e..45c5ec714 100644 --- a/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap @@ -7,7 +7,7 @@ exports[`text.js [espree] format 1`] = ` > 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`; | ^ 7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`; - 8 | + 8 | 9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;" `; @@ -27,7 +27,7 @@ exports[`text.js [meriyah] format 1`] = ` > 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`; | ^ 7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`; - 8 | + 8 | 9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;" `; diff --git a/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap index 1419ffdcc..874fb43cd 100644 --- a/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`no-semi.js [espree] format 1`] = ` 1 | a > 2 | ;::b.c | ^ - 3 | + 3 | 4 | class A { 5 | a = b;" `; @@ -15,7 +15,7 @@ exports[`no-semi.js [meriyah] format 1`] = ` 1 | a > 2 | ;::b.c | ^ - 3 | + 3 | 4 | class A { 5 | a = b;" `; @@ -25,7 +25,7 @@ exports[`no-semi.js - {"semi":false} [espree] format 1`] = ` 1 | a > 2 | ;::b.c | ^ - 3 | + 3 | 4 | class A { 5 | a = b;" `; @@ -35,7 +35,7 @@ exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = ` 1 | a > 2 | ;::b.c | ^ - 3 | + 3 | 4 | class A { 5 | a = b;" `; diff --git a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap index ec3792c20..609486589 100644 --- a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`class.js [espree] format 1`] = ` "Unexpected token ; (12:6) - 10 | + 10 | 11 | class C1 { > 12 | get; // The semicolon *is* necessary | ^ @@ -13,7 +13,7 @@ exports[`class.js [espree] format 1`] = ` exports[`class.js - {"semi":false} [espree] format 1`] = ` "Unexpected token ; (12:6) - 10 | + 10 | 11 | class C1 { > 12 | get; // The semicolon *is* necessary | ^ diff --git a/tests/js/objects/__snapshots__/jsfmt.spec.js.snap b/tests/js/objects/__snapshots__/jsfmt.spec.js.snap index 83bc1d99c..a1cdce27f 100644 --- a/tests/js/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/objects/__snapshots__/jsfmt.spec.js.snap @@ -153,7 +153,7 @@ exports[`getter-setter.js [espree] format 1`] = ` > 3 | ({ set x() {} }); | ^ 4 | ({ get x(x) {} }); - 5 | " + 5 |" `; exports[`getter-setter.js [meriyah] format 1`] = ` @@ -163,7 +163,7 @@ exports[`getter-setter.js [meriyah] format 1`] = ` > 3 | ({ set x() {} }); | ^ 4 | ({ get x(x) {} }); - 5 | " + 5 |" `; exports[`getter-setter.js format 1`] = ` @@ -192,7 +192,7 @@ printWidth: 80 exports[`invalid-accessor-generator.js [espree] format 1`] = ` "Unexpected token * (5:9) - 3 | + 3 | 4 | ({ > 5 | get *iterator() { }, | ^ @@ -203,7 +203,7 @@ exports[`invalid-accessor-generator.js [espree] format 1`] = ` exports[`invalid-accessor-generator.js [meriyah] format 1`] = ` "[5:9]: A getter cannot be a generator (5:9) - 3 | + 3 | 4 | ({ > 5 | get *iterator() { }, | ^ @@ -214,7 +214,7 @@ exports[`invalid-accessor-generator.js [meriyah] format 1`] = ` exports[`invalid-accessor-generator.js [typescript] format 1`] = ` "Identifier expected. (5:9) - 3 | + 3 | 4 | ({ > 5 | get *iterator() { }, | ^ @@ -257,14 +257,14 @@ exports[`invalid-setter.js [espree] format 1`] = ` "setter should have exactly one param (1:9) > 1 | ({ set x(){} }); | ^ - 2 | " + 2 |" `; exports[`invalid-setter.js [meriyah] format 1`] = ` "[1:10]: Setter functions must have exactly one argument (1:10) > 1 | ({ set x(){} }); | ^ - 2 | " + 2 |" `; exports[`invalid-setter.js format 1`] = ` diff --git a/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap b/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap index 4d92092e5..6ce064d39 100644 --- a/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`test.js [espree] format 1`] = ` > 1 | const addOne = add(1, ?); // apply from the left | ^ 2 | addOne(2); // 3 - 3 | + 3 | 4 | const addTen = add(?, 10); // apply from the right" `; @@ -14,7 +14,7 @@ exports[`test.js [meriyah] format 1`] = ` > 1 | const addOne = add(1, ?); // apply from the left | ^ 2 | addOne(2); // 3 - 3 | + 3 | 4 | const addTen = add(?, 10); // apply from the right" `; diff --git a/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap b/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap index a25032b01..7dcac40c0 100644 --- a/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap @@ -163,18 +163,18 @@ exports[`minimal_pipeline_operator.js [espree] format 1`] = ` "Unexpected token > (1:4) > 1 | a |> b |> c; | ^ - 2 | + 2 | 3 | a |> (b |> c); - 4 | " + 4 |" `; exports[`minimal_pipeline_operator.js [meriyah] format 1`] = ` "[1:4]: Unexpected token: '>' (1:4) > 1 | a |> b |> c; | ^ - 2 | + 2 | 3 | a |> (b |> c); - 4 | " + 4 |" `; exports[`minimal_pipeline_operator.js format 1`] = ` @@ -292,7 +292,7 @@ exports[`smart_pipeline_operator.js [espree] format 1`] = ` "Unexpected token > (1:4) > 1 | a |> await # |> # * 3; | ^ - 2 | + 2 | 3 | foo 4 | |> await #" `; @@ -301,7 +301,7 @@ exports[`smart_pipeline_operator.js [meriyah] format 1`] = ` "[1:4]: Unexpected token: '>' (1:4) > 1 | a |> await # |> # * 3; | ^ - 2 | + 2 | 3 | foo 4 | |> await #" `; diff --git a/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap b/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap index d2d8b4cf8..c4a9c07ae 100644 --- a/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`private-in.js [espree] format 1`] = ` > 1 | if (#prop in obj) { | ^ 2 | } - 3 | + 3 | 4 | #prop in obj;" `; diff --git a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap index 83682b792..23a2343d8 100644 --- a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ exports[`classes.js - {"quoteProps":"as-needed"} [espree] format 1`] = ` > 2 | a = \\"a\\" | ^ 3 | }; - 4 | + 4 | 5 | class B {" `; @@ -63,7 +63,7 @@ exports[`classes.js - {"quoteProps":"consistent","singleQuote":true} [espree] fo > 2 | a = \\"a\\" | ^ 3 | }; - 4 | + 4 | 5 | class B {" `; @@ -121,7 +121,7 @@ exports[`classes.js - {"quoteProps":"consistent"} [espree] format 1`] = ` > 2 | a = \\"a\\" | ^ 3 | }; - 4 | + 4 | 5 | class B {" `; @@ -178,7 +178,7 @@ exports[`classes.js - {"quoteProps":"preserve"} [espree] format 1`] = ` > 2 | a = \\"a\\" | ^ 3 | }; - 4 | + 4 | 5 | class B {" `; diff --git a/tests/js/range/__snapshots__/jsfmt.spec.js.snap b/tests/js/range/__snapshots__/jsfmt.spec.js.snap index 4378d8da2..6daa8552c 100644 --- a/tests/js/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/range/__snapshots__/jsfmt.spec.js.snap @@ -12,11 +12,11 @@ rangeStart: 8 2 | , > 3 | ,,,, | ^^^^ -> 4 | +> 4 | | ^ > 5 | , | ^ -> 6 | +> 6 | | ^ 7 | , 8 | a, @@ -39,7 +39,7 @@ rangeStart: 13 2 | // The range will be 13~26 3 | // \`foo\` ends at 13, should not format 4 | // \`bar\` ends at 26, should format - 5 | + 5 | =====================================output===================================== foo = 1.0000;bar = 1.0;baz=1.0000; // The range will be 13~26 @@ -66,9 +66,9 @@ rangeStart: 28 | ^^^^^^^^^^^^^^^^^ 7 | ); d( 8 | ); - 9 | + 9 | 10 | } - 11 | + 11 | =====================================output===================================== function a( ){ @@ -96,7 +96,7 @@ rangeStart: 13 | ^^^^^^^^^^^^^^^^^ 5 | ); d( 6 | ); - 7 | + 7 | =====================================output===================================== a ( ); @@ -116,14 +116,14 @@ rangeEnd: 26 rangeStart: 10 | | printWidth =====================================input====================================== - 1 | - 2 | + 1 | + 2 | > 3 | class a { | ^^^^ > 4 | b( ) {} | ^^^^^^^^^^^ 5 | } - 6 | + 6 | 7 | let x =====================================output===================================== @@ -152,7 +152,7 @@ rangeStart: 19 > 4 | call(1,2,3) | ^^^^^^^^^ 5 | } - 6 | + 6 | =====================================output===================================== call(1,2,3) call(1, 2, 3); @@ -174,7 +174,7 @@ rangeStart: 0 > 1 | 'aaa'; | ^ 2 | 'bbb'; - 3 | + 3 | =====================================output===================================== "aaa"; 'bbb'; @@ -192,7 +192,7 @@ rangeStart: 16 =====================================input====================================== > 1 | function ugly ( {a=1, b = 2 } ) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 2 | + 2 | =====================================output===================================== function ugly({ a = 1, b = 2 }) {} @@ -216,7 +216,7 @@ rangeStart: 222 6 | } 7 | } 8 | } - 9 | + 9 | =====================================output===================================== function ugly ( {a=1, b = 2 } ) { function ugly ( {a=1, b = 2 } ) { @@ -243,12 +243,12 @@ rangeStart: 17 | ^^^^^^^^^^^^^^ 3 | return 1; 4 | } - 5 | + 5 | 6 | dontTouchThis(){ 7 | return 2 ; 8 | } 9 | } - 10 | + 10 | =====================================output===================================== export class F { reformatThis() { @@ -276,12 +276,12 @@ rangeStart: 17 | ^ 3 | return 1; 4 | } - 5 | + 5 | 6 | dontTouchThis(){ 7 | return 2 ; 8 | } 9 | } - 10 | + 10 | =====================================output===================================== export class F { reformatThis() { @@ -309,7 +309,7 @@ rangeStart: 16 > 2 | /**/ | ^^^^ 3 | } - 4 | + 4 | =====================================output===================================== export default class Foo { /**/ @@ -330,7 +330,7 @@ rangeStart: 16 | ^^^^^^^^^^^^^^ 2 | /**/ 3 | } - 4 | + 4 | =====================================output===================================== export default function Foo() { /**/ @@ -353,7 +353,7 @@ rangeStart: 16 | ^^^^ > 3 | } | ^ - 4 | + 4 | =====================================output===================================== /* */ function Foo() { /**/ @@ -375,7 +375,7 @@ rangeStart: 17 | ^^^^ > 3 | } | ^ - 4 | + 4 | =====================================output===================================== /* */ class Foo { /**/ @@ -397,7 +397,7 @@ rangeStart: 29 > 2 | color: blue; | ^^^^^ 3 | \`; - 4 | + 4 | =====================================output===================================== export const Button = styled.button\` color: blue; @@ -425,7 +425,7 @@ rangeStart: 80 | ^^^^^^^^^^^^^^^^^^^ 7 | }; 8 | } - 9 | + 9 | =====================================output===================================== function ugly() { const dictWithSeveralEntries = { @@ -448,16 +448,16 @@ rangeStart: 45 | | printWidth =====================================input====================================== 1 | import def , {named} from 'x' - 2 | + 2 | > 3 | export * from 'd' | ^^^^^^^^^^^ - 4 | + 4 | 5 | export const x 6 | = 42 - 7 | + 7 | 8 | export default 42 - 9 | - 10 | + 9 | + 10 | =====================================output===================================== import def , {named} from 'x' @@ -481,18 +481,18 @@ rangeStart: 57 | | printWidth =====================================input====================================== 1 | import def , {named} from 'x' - 2 | + 2 | 3 | export * from 'd' -> 4 | +> 4 | | ^ > 5 | export const x | ^^^^^^^^^^^^^^^^^^ > 6 | = 42 | ^^ - 7 | + 7 | 8 | export default 42 - 9 | - 10 | + 9 | + 10 | =====================================output===================================== import def , {named} from 'x' @@ -515,16 +515,16 @@ rangeStart: 104 | | printWidth =====================================input====================================== 1 | import def , {named} from 'x' - 2 | + 2 | 3 | export * from 'd' - 4 | + 4 | 5 | export const x 6 | = 42 - 7 | + 7 | > 8 | export default 42 | ^^^^ - 9 | - 10 | + 9 | + 10 | =====================================output===================================== import def , {named} from 'x' @@ -549,15 +549,15 @@ rangeStart: 7 =====================================input====================================== > 1 | import def , {named} from 'x' | ^^^^^^^^^^^^^^^ - 2 | + 2 | 3 | export * from 'd' - 4 | + 4 | 5 | export const x 6 | = 42 - 7 | + 7 | 8 | export default 42 - 9 | - 10 | + 9 | + 10 | =====================================output===================================== import def, { named } from "x"; @@ -583,24 +583,24 @@ rangeStart: 30 1 | call( 2 | 1, 2,3 3 | ); - 4 | + 4 | 5 | call( > 6 | 1, 2,3 | ^^^ > 7 | ); | ^^ -> 8 | +> 8 | | ^^ > 9 | call( | ^^ > 10 | 1, 2,3 | ^^^^^ 11 | ); - 12 | + 12 | 13 | call( 14 | 1, 2,3 15 | ); - 16 | + 16 | =====================================output===================================== call( 1, 2,3 @@ -628,7 +628,7 @@ rangeStart: 18 1 | call( 2 | 1, 2,3 3 | ); -> 4 | +> 4 | | ^ > 5 | call( | ^^^^^ @@ -636,7 +636,7 @@ rangeStart: 18 | ^^^^^ > 7 | ); | ^^^^^ -> 8 | +> 8 | | ^^^^^ > 9 | call( | ^^^^^ @@ -644,12 +644,12 @@ rangeStart: 18 | ^^^^^ > 11 | ); | ^^^^^ -> 12 | +> 12 | | ^ 13 | call( 14 | 1, 2,3 15 | ); - 16 | + 16 | =====================================output===================================== call( 1, 2,3 @@ -684,7 +684,7 @@ rangeStart: 0 | ^^^ 5 | } 6 | catch (err) {} - 7 | + 7 | =====================================output===================================== try { if (condition) { @@ -711,7 +711,7 @@ rangeStart: 28 > 4 | } | ^^ 5 | } - 6 | + 6 | =====================================output===================================== function f() { if (true) { @@ -739,7 +739,7 @@ rangeStart: 9 | ^^^ 5 | } 6 | catch (err) {} - 7 | + 7 | =====================================output===================================== try { if (condition) { @@ -768,7 +768,7 @@ rangeStart: 9 | ^^^ 5 | } 6 | catch (err) {} - 7 | + 7 | =====================================output===================================== try { 1;if (condition) { @@ -790,7 +790,7 @@ rangeStart: 11 =====================================input====================================== > 1 | const y = {a:1, b:2} | ^^^ - 2 | + 2 | =====================================output===================================== const y = { a: 1, b: 2 }; @@ -805,7 +805,7 @@ rangeEnd: 104 rangeStart: 53 | | printWidth =====================================input====================================== - 1 | + 1 | 2 | const y = [ 3 | { 4 | a: 1, @@ -820,7 +820,7 @@ rangeStart: 53 > 9 | }, | ^^^^^^ 10 | ] - 11 | + 11 | =====================================output===================================== const y = [ @@ -853,7 +853,7 @@ rangeStart: 224 6 | } 7 | } 8 | } - 9 | + 9 | =====================================output===================================== function ugly ( {a=1, b = 2 } ) { function ugly ( {a=1, b = 2 } ) { @@ -879,8 +879,8 @@ rangeStart: 32 2 | call( 3 | 1, 2,3 4 | ); - 5 | -> 6 | + 5 | +> 6 | | ^ > 7 | call( | ^^^^^ @@ -913,14 +913,14 @@ rangeStart: 0 | ^^^^^^^^ > 3 | ); | ^^^^^^^^ -> 4 | +> 4 | | ^ - 5 | + 5 | 6 | // Unchanged 7 | call( 8 | 1, 2,3 9 | ); - 10 | + 10 | =====================================output===================================== call(1, 2, 3); @@ -944,7 +944,7 @@ rangeStart: 26 > 1 | foo = 1.0000;bar = 1.0000;baz=1.0000; | ^^^^^^^^^^^^^ [Reversed range] 2 | // The range will be 26~13, should not format anything - 3 | + 3 | =====================================output===================================== foo = 1.0000;bar = 1.0000;baz=1.0000; // The range will be 26~13, should not format anything @@ -963,7 +963,7 @@ rangeStart: 13 > 1 | foo = 1.0000;bar = 1.0000;baz=1.0000; | ^ 2 | // The range will be 13~13, should not format anything - 3 | + 3 | =====================================output===================================== foo = 1.0000;bar = 1.0000;baz=1.0000; // The range will be 13~13, should not format anything @@ -982,7 +982,7 @@ rangeStart: 7 1 | try {} > 2 | catch (err) {} | ^ - 3 | + 3 | =====================================output===================================== try { } catch (err) {} @@ -1000,7 +1000,7 @@ rangeStart: 0 =====================================input====================================== > 1 | | ^ - 2 | + 2 | =====================================output===================================== diff --git a/tests/js/record/__snapshots__/jsfmt.spec.js.snap b/tests/js/record/__snapshots__/jsfmt.spec.js.snap index 71e89b736..76ae79cde 100644 --- a/tests/js/record/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/record/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ exports[`computed.js [espree] format 1`] = ` > 2 | assert(#{ [key]: 1 } === #{ a: 1 }) | ^ 3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - 4 | + 4 | 5 | assert(#{ [true]: 1 } === #{ true: 1 })" `; @@ -16,7 +16,7 @@ exports[`computed.js [meriyah] format 1`] = ` > 2 | assert(#{ [key]: 1 } === #{ a: 1 }) | ^ 3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - 4 | + 4 | 5 | assert(#{ [true]: 1 } === #{ true: 1 })" `; @@ -56,7 +56,7 @@ exports[`destructuring.js [espree] format 1`] = ` | ^ 2 | assert(a === 1); 3 | assert(b === 2); - 4 | " + 4 |" `; exports[`destructuring.js [meriyah] format 1`] = ` @@ -65,7 +65,7 @@ exports[`destructuring.js [meriyah] format 1`] = ` | ^ 2 | assert(a === 1); 3 | assert(b === 2); - 4 | " + 4 |" `; exports[`destructuring.js format 1`] = ` @@ -101,7 +101,7 @@ assert(rest.c === 3); exports[`invalid-record-method.js [espree] format 1`] = ` "Unexpected character '#' (3:1) 1 | // Invalid, https://github.com/babel/babel/pull/11652/ - 2 | + 2 | > 3 | #{ | ^ 4 | a() {}, @@ -112,7 +112,7 @@ exports[`invalid-record-method.js [espree] format 1`] = ` exports[`invalid-record-method.js [meriyah] format 1`] = ` "[3:1]: '#' not followed by identifier (3:1) 1 | // Invalid, https://github.com/babel/babel/pull/11652/ - 2 | + 2 | > 3 | #{ | ^ 4 | a() {}, @@ -218,7 +218,7 @@ exports[`shorthand.js [espree] format 1`] = ` > 2 | const record = #{ url } | ^ 3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple - 4 | " + 4 |" `; exports[`shorthand.js [meriyah] format 1`] = ` @@ -227,7 +227,7 @@ exports[`shorthand.js [meriyah] format 1`] = ` > 2 | const record = #{ url } | ^ 3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple - 4 | " + 4 |" `; exports[`shorthand.js format 1`] = ` @@ -254,7 +254,7 @@ exports[`spread.js [espree] format 1`] = ` | ^ 2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData } 3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" } - 4 | " + 4 |" `; exports[`spread.js [meriyah] format 1`] = ` @@ -263,7 +263,7 @@ exports[`spread.js [meriyah] format 1`] = ` | ^ 2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData } 3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" } - 4 | " + 4 |" `; exports[`spread.js format 1`] = ` @@ -296,7 +296,7 @@ exports[`syntax.js [espree] format 1`] = ` | ^ 2 | #{ a: 1, b: 2 } 3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] } - 4 | " + 4 |" `; exports[`syntax.js [meriyah] format 1`] = ` @@ -305,7 +305,7 @@ exports[`syntax.js [meriyah] format 1`] = ` | ^ 2 | #{ a: 1, b: 2 } 3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] } - 4 | " + 4 |" `; exports[`syntax.js format 1`] = ` diff --git a/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap index 4d2513a7d..755a9af74 100644 --- a/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`throw_expression.js [espree] format 1`] = ` "Unexpected token throw (1:26) > 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {} | ^ - 2 | + 2 | 3 | lint(ast, { 4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")" `; @@ -13,7 +13,7 @@ exports[`throw_expression.js [meriyah] format 1`] = ` "[1:30]: Unexpected token: 'throw' (1:30) > 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {} | ^ - 2 | + 2 | 3 | lint(ast, { 4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")" `; diff --git a/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap b/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap index 937de6b84..1ab9ae795 100644 --- a/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`example.js [espree] format 1`] = ` "Cannot use keyword 'await' outside an async function (1:1) > 1 | await something(); | ^ - 2 | " + 2 |" `; exports[`example.js [meriyah] format 1`] = ` "[1:5]: 'Await' may not be used as an identifier in this context (1:5) > 1 | await something(); | ^ - 2 | " + 2 |" `; exports[`example.js format 1`] = ` diff --git a/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap index f4f990be5..4f337ad8f 100644 --- a/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`trailing.js [espree] format 1`] = ` "Unexpected token type (1:8) > 1 | export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" }; | ^ - 2 | + 2 | 3 | // Note: there are trailing whitespace in this file 4 | \`" `; @@ -13,7 +13,7 @@ exports[`trailing.js [meriyah] format 1`] = ` "[1:11]: Unexpected token: 'identifier' (1:11) > 1 | export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" }; | ^ - 2 | + 2 | 3 | // Note: there are trailing whitespace in this file 4 | \`" `; diff --git a/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap b/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap index 0f922022f..8edda8574 100644 --- a/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ exports[`destructuring.js [espree] format 1`] = ` | ^ 2 | assert(a === 1); 3 | assert(b === 2); - 4 | " + 4 |" `; exports[`destructuring.js [meriyah] format 1`] = ` @@ -15,7 +15,7 @@ exports[`destructuring.js [meriyah] format 1`] = ` | ^ 2 | assert(a === 1); 3 | assert(b === 2); - 4 | " + 4 |" `; exports[`destructuring.js format 1`] = ` @@ -52,21 +52,21 @@ exports[`invalid-tuple-holes.js [babel] format 1`] = ` "Unexpected token ',' (1:4) > 1 | #[,] | ^ - 2 | " + 2 |" `; exports[`invalid-tuple-holes.js [espree] format 1`] = ` "Unexpected character '#' (1:1) > 1 | #[,] | ^ - 2 | " + 2 |" `; exports[`invalid-tuple-holes.js [meriyah] format 1`] = ` "[1:1]: '#' not followed by identifier (1:1) > 1 | #[,] | ^ - 2 | " + 2 |" `; exports[`syntax.js [espree] format 1`] = ` @@ -75,7 +75,7 @@ exports[`syntax.js [espree] format 1`] = ` | ^ 2 | #[1, 2] 3 | #[1, 2, #{ a: 3 }] - 4 | " + 4 |" `; exports[`syntax.js [meriyah] format 1`] = ` @@ -84,7 +84,7 @@ exports[`syntax.js [meriyah] format 1`] = ` | ^ 2 | #[1, 2] 3 | #[1, 2, #{ a: 3 }] - 4 | " + 4 |" `; exports[`syntax.js format 1`] = ` @@ -109,18 +109,18 @@ exports[`tuple.js [espree] format 1`] = ` "Unexpected character '#' (1:16) > 1 | const tuple1 = #[1, 2, 3]; | ^ - 2 | + 2 | 3 | assert(tuple1[0] === 1); - 4 | " + 4 |" `; exports[`tuple.js [meriyah] format 1`] = ` "[1:16]: '#' not followed by identifier (1:16) > 1 | const tuple1 = #[1, 2, 3]; | ^ - 2 | + 2 | 3 | assert(tuple1[0] === 1); - 4 | " + 4 |" `; exports[`tuple.js format 1`] = ` @@ -173,14 +173,14 @@ exports[`tuple-trailing-comma.js [espree] format 1`] = ` "Unexpected character '#' (1:1) > 1 | #[1,] | ^ - 2 | " + 2 |" `; exports[`tuple-trailing-comma.js [meriyah] format 1`] = ` "[1:1]: '#' not followed by identifier (1:1) > 1 | #[1,] | ^ - 2 | " + 2 |" `; exports[`tuple-trailing-comma.js format 1`] = ` diff --git a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap index 12ff04f0f..cdac36197 100644 --- a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap @@ -4,21 +4,21 @@ exports[`invalid-const.js [espree] format 1`] = ` "Unexpected token ; (1:10) > 1 | const foo; | ^ - 2 | " + 2 |" `; exports[`invalid-const.js [flow] format 1`] = ` "Const must be initialized (1:7) > 1 | const foo; | ^^^ - 2 | " + 2 |" `; exports[`invalid-const.js [meriyah] format 1`] = ` "[1:10]: Missing initializer in const declaration (1:10) > 1 | const foo; | ^ - 2 | " + 2 |" `; exports[`invalid-const.js format 1`] = ` diff --git a/tests/json/range/__snapshots__/jsfmt.spec.js.snap b/tests/json/range/__snapshots__/jsfmt.spec.js.snap index 53f26719a..dcdef5f99 100644 --- a/tests/json/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/json/range/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ rangeStart: 1 =====================================input====================================== > 1 | {"a":1, "b":2} | ^^^ - 2 | + 2 | =====================================output===================================== {"a":1, "b":2} @@ -27,7 +27,7 @@ rangeStart: 5 =====================================input====================================== > 1 | {"a":1, "b":2} | ^ - 2 | + 2 | =====================================output===================================== {"a":1, "b":2} diff --git a/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap index dbf1f0a6c..770a98581 100644 --- a/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/babel-flow/__snapshots__/jsfmt.spec.js.snap @@ -3,17 +3,17 @@ exports[`async-arrow-invalid.js [babel] format 1`] = ` "Type parameters must come after the async keyword, e.g. instead of \` async (3:1) 1 | // https://github.com/babel/babel/pull/11979 - 2 | + 2 | > 3 | async () => {} | ^ - 4 | " + 4 |" `; exports[`async-arrow-invalid.js [babel-flow] format 1`] = ` "Type parameters must come after the async keyword, e.g. instead of \` async (3:1) 1 | // https://github.com/babel/babel/pull/11979 - 2 | + 2 | > 3 | async () => {} | ^ - 4 | " + 4 |" `; diff --git a/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap index f700fa83d..1c74c1a0d 100644 --- a/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`type-annotation-expr-statement.ts [babel-ts] format 1`] = ` "Did not expect a type annotation here. (1:3) > 1 | (a: T); | ^ - 2 | " + 2 |" `; exports[`type-annotation-func.ts [babel-ts] format 1`] = ` "Did not expect a type annotation here. (1:10) > 1 | func(a: T); | ^ - 2 | " + 2 |" `; exports[`type-annotation-in-jsx.tsx [babel-ts] format 1`] = ` @@ -22,5 +22,5 @@ exports[`type-annotation-in-jsx.tsx [babel-ts] format 1`] = ` | ^ 4 | ); 5 | } - 6 | " + 6 |" `; diff --git a/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap index dc8b03d92..c781f4850 100644 --- a/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap @@ -2,9 +2,9 @@ exports[`async-arrow-invalid.js [flow] format 1`] = ` "Unexpected token ILLEGAL (4:1) - 2 | + 2 | 3 | async () => {} -> 4 | +> 4 | | ^" `; @@ -12,14 +12,14 @@ exports[`default-escaped.js [flow] format 1`] = ` "Unexpected identifier, expected the token \`{\` (1:8) > 1 | export asyn\\\\u{63} from \\"async\\"; | ^^^^^^^^^^ - 2 | " + 2 |" `; exports[`dynamic-import.js [flow] format 1`] = ` "Unexpected token \`,\`, expected the token \`)\` (1:24) > 1 | import('./prettier.mjs', {}) | ^ - 2 | " + 2 |" `; exports[`function-async.js [flow] format 1`] = ` @@ -33,14 +33,14 @@ exports[`module-attributes-dynamic.js [flow] format 1`] = ` "Unexpected token \`,\`, expected the token \`)\` (1:18) > 1 | import(\\"foo.json\\", { with: { type: \\"json\\" } }) | ^ - 2 | " + 2 |" `; exports[`module-attributes-static.js [flow] format 1`] = ` "Unexpected token \`with\`, expected the token \`;\` (1:28) > 1 | import foo from \\"foo.json\\" with type: \\"json\\"; | ^^^^ - 2 | " + 2 |" `; exports[`newline-before-arrow.js [flow] format 1`] = ` @@ -48,14 +48,14 @@ exports[`newline-before-arrow.js [flow] format 1`] = ` 1 | async x > 2 | => x | ^^ - 3 | " + 3 |" `; exports[`number.js [flow] format 1`] = ` "Unexpected token ILLEGAL (3:5) 1 | // https://github.com/babel/babel/pull/11854 - 2 | + 2 | > 3 | a = 09e1_1; | ^^^^ - 4 | " + 4 |" `; diff --git a/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap index 0db971b0a..0e7fd398c 100644 --- a/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/graphql/__snapshots__/jsfmt.spec.js.snap @@ -3,10 +3,10 @@ exports[`type-interfaces.graphql [graphql] format 1`] = ` "Syntax Error: Unexpected \\"|\\". (5:21) 3 | # which will break seperator detection added in #7305 - 4 | + 4 | > 5 | type A implements A | B { | ^ 6 | a: a 7 | } - 8 | " + 8 |" `; diff --git a/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap index 5327f3acb..7d7866680 100644 --- a/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/handlebars/__snapshots__/jsfmt.spec.js.snap @@ -8,7 +8,7 @@ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SE 1 | > 2 | x, {{@name} | ^ - 3 | " + 3 |" `; exports[`invalid-2.hbs [glimmer] format 1`] = ` @@ -20,10 +20,10 @@ exports[`invalid-2.hbs [glimmer] format 1`] = ` (error occurred in 'an unknown module' @ line 3 : column 0) (3:0) 1 | - 2 | + 2 | > 3 | <{@name> | ^^^^^^^^ - 4 | " + 4 |" `; exports[`invalid-3.hbs [glimmer] format 1`] = ` @@ -32,10 +32,10 @@ exports[`invalid-3.hbs [glimmer] format 1`] = ` -----^ Expecting 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (3:3) 1 | - 2 | + 2 | > 3 | {{}} | ^ - 4 | " + 4 |" `; exports[`tilde-comments-1.hbs [glimmer] format 1`] = ` @@ -45,7 +45,7 @@ exports[`tilde-comments-1.hbs [glimmer] format 1`] = ` Expecting 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (1:4) > 1 | {{~}} | ^ - 2 | " + 2 |" `; exports[`tilde-comments-2.hbs [glimmer] format 1`] = ` @@ -55,5 +55,5 @@ exports[`tilde-comments-2.hbs [glimmer] format 1`] = ` Expecting 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (1:4) > 1 | {{~~}} | ^ - 2 | " + 2 |" `; diff --git a/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap index 7a3f227b9..bc249a442 100644 --- a/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap @@ -2,27 +2,27 @@ exports[`decorator.ts [babel-ts] format 1`] = ` "Leading decorators must be attached to a class declaration (4:1) - 2 | + 2 | 3 | @dec > 4 | enum E {} | ^ - 5 | " + 5 |" `; exports[`decorator.ts [typescript] format 1`] = ` "Leading decorators must be attached to a class declaration (3:1) 1 | declare function dec(target: T): T; - 2 | + 2 | > 3 | @dec | ^^^^ > 4 | enum E {} | ^^^^^^^^^^ - 5 | " + 5 |" `; exports[`enums.ts [babel-ts] format 1`] = ` "Leading decorators must be attached to a class declaration (4:1) - 2 | + 2 | 3 | @decorator() > 4 | enum Direction { | ^ @@ -34,7 +34,7 @@ exports[`enums.ts [babel-ts] format 1`] = ` exports[`enums.ts [typescript] format 1`] = ` "Leading decorators must be attached to a class declaration (3:1) 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - 2 | + 2 | > 3 | @decorator() | ^^^^^^^^^^^^ > 4 | enum Direction { @@ -49,50 +49,50 @@ exports[`enums.ts [typescript] format 1`] = ` | ^^^^^^^^^^^^^^^^ > 9 | } | ^^ - 10 | " + 10 |" `; exports[`function.ts [babel-ts] format 1`] = ` "Leading decorators must be attached to a class declaration (4:1) - 2 | + 2 | 3 | @decorator() > 4 | function foo( ){} | ^ - 5 | " + 5 |" `; exports[`function.ts [typescript] format 1`] = ` "Leading decorators must be attached to a class declaration (3:1) 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - 2 | + 2 | > 3 | @decorator() | ^^^^^^^^^^^^ > 4 | function foo( ){} | ^^^^^^^^^^^^^^^^^^^^^^^ - 5 | " + 5 |" `; exports[`interface.ts [babel-ts] format 1`] = ` "Leading decorators must be attached to a class declaration (5:1) - 3 | + 3 | 4 | @hello() > 5 | interface MyInterface {id: string; | ^ 6 | } - 7 | " + 7 |" `; exports[`interface.ts [typescript] format 1`] = ` "Leading decorators must be attached to a class declaration (4:1) 2 | // #4632 - 3 | + 3 | > 4 | @hello() | ^^^^^^^^ > 5 | interface MyInterface {id: string; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 6 | } | ^^ - 7 | " + 7 |" `; exports[`issue-9102.ts [babel-ts] format 1`] = ` @@ -101,7 +101,7 @@ exports[`issue-9102.ts [babel-ts] format 1`] = ` > 2 | type T = 1; | ^ 3 | class C {} - 4 | " + 4 |" `; exports[`issue-9102.ts [typescript] format 1`] = ` @@ -111,5 +111,5 @@ exports[`issue-9102.ts [typescript] format 1`] = ` > 2 | type T = 1; | ^^^^^^^^^^^^ 3 | class C {} - 4 | " + 4 |" `; diff --git a/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap index 783e27cbf..55a3db305 100644 --- a/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap @@ -8,42 +8,42 @@ exports[`html-like-comments.js [babel] format 1`] = ` | ^ 4 | 'hello world' 5 | ) - 6 | " + 6 |" `; exports[`import-assertions-for-export-without-from.js [babel] format 1`] = ` "Unexpected token, expected \\";\\" (1:16) > 1 | export { foo } assert { type: \\"json\\" }; | ^ - 2 | " + 2 |" `; exports[`import-assertions-with-parens.js [babel] format 1`] = ` "Unexpected token (1:19) > 1 | import \\"x\\" assert ({type: 'json'}); | ^ - 2 | " + 2 |" `; exports[`module-attributes.js [babel] format 1`] = ` "Unexpected token, expected \\";\\" (1:28) > 1 | import foo from \\"foo.json\\" with type: \\"json\\"; | ^ - 2 | " + 2 |" `; exports[`no-for-in-init-concise-binary-in.js [babel] format 1`] = ` "Unexpected token, expected \\")\\" (3:18) 1 | // https://github.com/babel/babel/pull/11931 - 2 | + 2 | > 3 | for (() => x in y;;); | ^ - 4 | " + 4 |" `; exports[`partial-template-strings.js [babel] format 1`] = ` "Unexpected token (6:42) - 4 | + 4 | 5 | const Diagnostics = { > 6 | unexpected_token: \`Unexpected token: \${?}\`, | ^ @@ -90,7 +90,7 @@ exports[`snippet: #5 [babel] format 1`] = ` exports[`snippet: #6 [babel] format 1`] = ` "Unexpected token (5:12) - 3 | + 3 | 4 | static isC(obj) { > 5 | return try obj.#brand; | ^ @@ -137,8 +137,8 @@ exports[`snippet: #12 [babel] format 1`] = ` exports[`static-import-source-should-not-has-extra-token.js [babel] format 1`] = ` "Unexpected token (4:16) 2 | // be parenthesized, that accidentally break #8016 - 3 | + 3 | > 4 | import {} from (('a')); | ^ - 5 | " + 5 |" `; diff --git a/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap index 1d010b2d6..20833d225 100644 --- a/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap @@ -17,7 +17,7 @@ exports[`open-double-quote.less [less] format 1`] = ` > 2 | background: url(\\" | ^ 3 | } - 4 | " + 4 |" `; exports[`open-sigle-quote.less [less] format 1`] = ` @@ -26,5 +26,5 @@ exports[`open-sigle-quote.less [less] format 1`] = ` > 2 | background: url(' | ^ 3 | } - 4 | " + 4 |" `; diff --git a/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap index a5ea5bf94..8c9016456 100644 --- a/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap @@ -4,23 +4,23 @@ exports[`default-escaped.ts [typescript] format 1`] = ` "Declaration or statement expected. (1:1) > 1 | export asyn\\\\u{63} from \\"async\\"; | ^ - 2 | " + 2 |" `; exports[`dynamic-import.ts [typescript] format 1`] = ` "Dynamic import must have one specifier as an argument. (1:8) > 1 | import('./prettier.mjs', {}) | ^ - 2 | " + 2 |" `; exports[`invalid-jsx-1.ts [typescript] format 1`] = ` "Unexpected token. Did you mean \`{'>'}\` or \`>\`? (3:45) 1 | // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-and--are-now-invalid-jsx-text-characters - 2 | + 2 | > 3 | let directions =
Navigate to: Menu Bar > Tools > Options
| ^ - 4 | " + 4 |" `; exports[`issue-8773.ts [typescript] format 1`] = `"Comment \\"comment\\" was not printed. Please report this error!"`; @@ -29,14 +29,14 @@ exports[`module-attributes-dynamic.ts [typescript] format 1`] = ` "Dynamic import must have one specifier as an argument. (1:8) > 1 | import(\\"foo.json\\", { with: { type: \\"json\\" } }) | ^ - 2 | " + 2 |" `; exports[`module-attributes-static.ts [typescript] format 1`] = ` "';' expected. (1:28) > 1 | import foo from \\"foo.json\\" with type: \\"json\\"; | ^ - 2 | " + 2 |" `; exports[`newline-before-arrow.ts [typescript] format 1`] = ` @@ -44,7 +44,7 @@ exports[`newline-before-arrow.ts [typescript] format 1`] = ` > 1 | async x | ^ 2 | => x - 3 | " + 3 |" `; exports[`snippet: #0 [typescript] format 1`] = ` diff --git a/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap index b78064eac..6c157b5db 100644 --- a/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/vue/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`unclosed_tag.vue [vue] format 1`] = ` "Unexpected character \\"EOF\\" (2:1) 1 |
2 | +> 2 | | ^" `; @@ -13,7 +13,7 @@ exports[`unclosed_tag_in_template.vue [vue] format 1`] = ` 3 | 4 | | ^ - 5 | " + 5 |" `; exports[`upper-case.html [vue] format 1`] = ` diff --git a/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap index f33b25c05..12fcb7cae 100644 --- a/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/yaml/__snapshots__/jsfmt.spec.js.snap @@ -12,6 +12,6 @@ exports[`block-scalar-with-spaces-only.yml [yaml] format 1`] = ` | ^ > 5 | # comment | ^ -> 6 | +> 6 | | ^" `; diff --git a/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap b/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap index db7833334..abc995656 100644 --- a/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap @@ -88,7 +88,7 @@ requirePragma: true 3 | */ > 4 | var test = true | ^^^^^^^^^^^^^^^ - 5 | + 5 | =====================================output===================================== /** * @prettier @@ -109,7 +109,7 @@ requirePragma: true =====================================input====================================== > 1 | var test = true | ^^^^^^^^^^^^^^^ - 2 | + 2 | =====================================output===================================== var test = true diff --git a/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap index 4b4f2a713..8179d2653 100644 --- a/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ exports[`constructor.ts [babel-ts] format 1`] = ` > 2 | constructor(static a: number) {} | ^ 3 | } - 4 | + 4 | 5 | class foo {" `; @@ -263,7 +263,7 @@ exports[`generics.ts [babel-ts] format 1`] = ` "A class name is required (1:6) > 1 | class implements Map {} | ^ - 2 | + 2 | 3 | interface AudioBufferList { 4 | mBuffers: interop.Reference;" `; @@ -292,12 +292,12 @@ interface AudioBufferList { exports[`methods.ts [babel-ts] format 1`] = ` "Unexpected token, expected \\";\\" (6:10) - 4 | + 4 | 5 | interface Iterable { > 6 | export [Symbol.iterator](): Iterator; | ^ 7 | } - 8 | + 8 | 9 | export class Check {" `; diff --git a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap index 21aa5587e..12029569c 100644 --- a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap @@ -433,7 +433,7 @@ exports[`errorOnInitializerInInterfaceProperty.ts [babel-ts] format 1`] = ` > 2 | bar: number = 5; | ^ 3 | } - 4 | " + 4 |" `; exports[`errorOnInitializerInInterfaceProperty.ts format 1`] = ` diff --git a/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap index 055cf0afb..823cf5106 100644 --- a/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap @@ -442,12 +442,12 @@ class E extends D { exports[`readonlyInConstructorParameters.ts [babel-ts] format 1`] = ` "Unexpected token, expected \\",\\" (7:33) - 5 | + 5 | 6 | class E { > 7 | constructor(readonly public x: number) {} | ^ 8 | } - 9 | + 9 | 10 | class F {" `; diff --git a/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap index c6c038802..87fd2d2c9 100644 --- a/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ exports[`parserES5ForOfStatement2.ts [babel-ts] format 1`] = ` > 2 | for (var of X) { | ^ 3 | } - 4 | " + 4 |" `; exports[`parserES5ForOfStatement2.ts format 1`] = ` @@ -32,7 +32,7 @@ exports[`parserES5ForOfStatement21.ts [babel-ts] format 1`] = ` 1 | //@target: ES5 > 2 | for (var of of) { } | ^ - 3 | " + 3 |" `; exports[`parserES5ForOfStatement21.ts format 1`] = ` @@ -57,7 +57,7 @@ exports[`parserForInStatement2.ts [babel-ts] format 1`] = ` > 1 | for (var in X) { | ^ 2 | } - 3 | " + 3 |" `; exports[`parserForInStatement2.ts format 1`] = ` diff --git a/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap index 1d1ce60da..1d1d6d225 100644 --- a/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`abstractKeyword.ts [babel-ts] format 1`] = ` "Unexpected token, expected \\";\\" (1:10) > 1 | abstract interface I {} | ^ - 2 | " + 2 |" `; exports[`abstractKeyword.ts format 1`] = ` diff --git a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap index 098a018bd..71b7e0264 100644 --- a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap @@ -594,12 +594,12 @@ function f(x: string): void { exports[`functionOverloadErrorsSyntax.ts [babel-ts] format 1`] = ` "Rest element must be last element (9:36) - 7 | + 7 | 8 | //Function overload signature with rest param followed by non-optional parameter > 9 | function fn5(x: string, ...y: any[], z: string); | ^ 10 | function fn5() { } - 11 | " + 11 |" `; exports[`functionOverloadErrorsSyntax.ts format 1`] = ` diff --git a/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap index b8f660e7a..a7946d8cb 100644 --- a/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap @@ -45,7 +45,7 @@ exports[`abstractProperties.ts [babel-ts] format 1`] = ` | ^ 3 | private abstract b: 2; 4 | static abstract c: 3; - 5 | " + 5 |" `; exports[`abstractProperties.ts format 1`] = ` diff --git a/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap index 48ea1c51c..5ff496cbd 100644 --- a/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap @@ -154,7 +154,7 @@ class f7<> { exports[`index-signature.ts [babel-ts] format 1`] = ` "Unexpected token, expected \\"]\\" (4:13) - 2 | + 2 | 3 | type TwoParams = { > 4 | [a: string, b: string]: string; | ^ @@ -165,7 +165,7 @@ exports[`index-signature.ts [babel-ts] format 1`] = ` exports[`index-signature.ts - {"trailingComma":"all"} [babel-ts] format 1`] = ` "Unexpected token, expected \\"]\\" (4:13) - 2 | + 2 | 3 | type TwoParams = { > 4 | [a: string, b: string]: string; | ^ @@ -239,7 +239,7 @@ type TooLongSingleParam = { exports[`index-signature.ts - {"trailingComma":"es5"} [babel-ts] format 1`] = ` "Unexpected token, expected \\"]\\" (4:13) - 2 | + 2 | 3 | type TwoParams = { > 4 | [a: string, b: string]: string; | ^ diff --git a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap index da391f150..ec8b9168f 100644 --- a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap @@ -4,18 +4,18 @@ exports[`abstract.ts [babel-ts] format 1`] = ` "Unexpected token, expected \\";\\" (1:10) > 1 | abstract interface I { | ^ - 2 | + 2 | 3 | } - 4 | " + 4 |" `; exports[`abstract.ts - {"semi":false} [babel-ts] format 1`] = ` "Unexpected token, expected \\";\\" (1:10) > 1 | abstract interface I { | ^ - 2 | + 2 | 3 | } - 4 | " + 4 |" `; exports[`abstract.ts - {"semi":false} format 1`] = ` diff --git a/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap index caf12a3c3..da283768a 100644 --- a/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap @@ -2,13 +2,13 @@ exports[`keywords.ts [babel-ts] format 1`] = ` "Unexpected token, expected \\";\\" (4:12) - 2 | + 2 | 3 | module Y3 { > 4 | public module Module { | ^ 5 | class A { s: string } 6 | } - 7 | " + 7 |" `; exports[`keywords.ts format 1`] = ` diff --git a/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap index e3f995949..25aab4f2d 100644 --- a/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap @@ -12,7 +12,7 @@ rangeStart: 15 > 2 | export = f; | ^^^ 3 | g( ) - 4 | + 4 | =====================================output===================================== f ( ); export = f; @@ -45,7 +45,7 @@ rangeStart: 102 > 9 | } | ^^^^^ 10 | } - 11 | + 11 | =====================================output===================================== class Foo { /** Does this key match a given MinimalKey extending object? */ @@ -73,7 +73,7 @@ rangeStart: 29 > 2 | private obj = { isTest: true } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | } - 4 | + 4 | =====================================output===================================== export default class Test { private obj = { isTest: true }; diff --git a/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap index 7a227a5e0..642315afd 100644 --- a/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap @@ -75,21 +75,21 @@ exports[`template-literal-types.ts [babel] format 1`] = ` "Unexpected token (1:84) > 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a; | ^ - 2 | " + 2 |" `; exports[`template-literal-types.ts [babel-flow] format 1`] = ` "Unexpected token (1:84) > 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a; | ^ - 2 | " + 2 |" `; exports[`template-literal-types.ts [flow] format 1`] = ` "Unexpected token \`\`\` (1:84) > 1 | const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<\`Hello, \${keyof World}\`> = a; | ^ - 2 | " + 2 |" `; exports[`template-literal-types.ts format 1`] = ` diff --git a/tests/vue/range/__snapshots__/jsfmt.spec.js.snap b/tests/vue/range/__snapshots__/jsfmt.spec.js.snap index 756e01e7b..1606454d4 100644 --- a/tests/vue/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/vue/range/__snapshots__/jsfmt.spec.js.snap @@ -12,18 +12,18 @@ rangeStart: 73 2 |

Templates are formatted as well... 3 |

4 | - 5 | + 5 | > 6 | | ^^^^^^^^^ - 9 | + 9 | 10 | - 13 | + 13 | =====================================output=====================================