diff --git a/tests/css/range/__snapshots__/jsfmt.spec.js.snap b/tests/css/range/__snapshots__/jsfmt.spec.js.snap index 5664f7a6f..079ae7847 100644 --- a/tests/css/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css/range/__snapshots__/jsfmt.spec.js.snap @@ -4,10 +4,11 @@ exports[`issue2267.css format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -.x{} - +> 1 | .x{} + | ^^^^ + 2 | =====================================output===================================== .x{} diff --git a/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap b/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap index 80a96c23f..48554cbc8 100644 --- a/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/graphql/range/__snapshots__/jsfmt.spec.js.snap @@ -4,10 +4,11 @@ exports[`issue2296.graphql format 1`] = ` ====================================options===================================== parsers: ["graphql"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -{NPC{life}} - +> 1 | {NPC{life}} + | ^^^ + 2 | =====================================output===================================== { NPC { diff --git a/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap b/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap index ad0c547bf..fe531c478 100644 --- a/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/cursor/__snapshots__/jsfmt.spec.js.snap @@ -292,14 +292,17 @@ exports[`range-0.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript", "flow"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -thisWontBeFormatted ( 1 ,3) - - thisWillBeFormatted <|> (2 ,3, ) - - thisWontBeFormatted (2, 90 ,) - + 1 | thisWontBeFormatted ( 1 ,3) + 2 | +> 3 | thisWillBeFormatted <|> (2 ,3, ) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 4 | + | ^ +> 5 | thisWontBeFormatted (2, 90 ,) + | ^ + 6 | =====================================output===================================== thisWontBeFormatted ( 1 ,3) @@ -314,14 +317,17 @@ exports[`range-1.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript", "flow"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -thisWontBeFormatted ( 1 ,3) - - thisWillBeFormatted (2 ,3<|>, ) - - thisWontBeFormatted (2, 90 ,) - + 1 | thisWontBeFormatted ( 1 ,3) + 2 | +> 3 | thisWillBeFormatted (2 ,3<|>, ) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 4 | + | ^ +> 5 | thisWontBeFormatted (2, 90 ,) + | ^ + 6 | =====================================output===================================== thisWontBeFormatted ( 1 ,3) @@ -336,14 +342,17 @@ exports[`range-2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript", "flow"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -thisWontBeFormatted ( 1 ,3) - - thisWillBeFormatted (2 ,3, <|> ) - - thisWontBeFormatted (2, 90 ,) - + 1 | thisWontBeFormatted ( 1 ,3) + 2 | +> 3 | thisWillBeFormatted (2 ,3, <|> ) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 4 | + | ^ +> 5 | thisWontBeFormatted (2, 90 ,) + | ^ + 6 | =====================================output===================================== thisWontBeFormatted ( 1 ,3) @@ -358,14 +367,19 @@ exports[`range-3.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript", "flow"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -thisWontBeFormatted <|> ( 1 ,3) - - thisWillBeFormatted (2 ,3, ) - - thisWontBeFormatted (2, 90 ,) - +> 1 | thisWontBeFormatted <|> ( 1 ,3) + | ^ +> 2 | + | ^ +> 3 | thisWillBeFormatted (2 ,3, ) + | ^ +> 4 | + | ^ +> 5 | thisWontBeFormatted (2, 90 ,) + | ^ + 6 | =====================================output===================================== thisWontBeFormatted <|> ( 1 ,3) @@ -380,14 +394,17 @@ exports[`range-4.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript", "flow"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -thisWontBeFormatted ( 1 ,3) - - thisWillBeFormatted (2 ,3, ) - - thisWontBeFormatted (2, 9<|>0 ,) - + 1 | thisWontBeFormatted ( 1 ,3) + 2 | +> 3 | thisWillBeFormatted (2 ,3, ) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 4 | + | ^ +> 5 | thisWontBeFormatted (2, 9<|>0 ,) + | ^^^^ + 6 | =====================================output===================================== thisWontBeFormatted ( 1 ,3) diff --git a/tests/js/range/__snapshots__/jsfmt.spec.js.snap b/tests/js/range/__snapshots__/jsfmt.spec.js.snap index b0de3e896..9bb8f6b79 100644 --- a/tests/js/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/range/__snapshots__/jsfmt.spec.js.snap @@ -4,15 +4,17 @@ exports[`class-declaration.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== - - -class a { - b( ) {} -} - -let x + 1 | + 2 | +> 3 | class a { + | ^^^^ +> 4 | b( ) {} + | ^^^^^^^^^^^ + 5 | } + 6 | + 7 | let x =====================================output===================================== @@ -28,14 +30,17 @@ exports[`different-levels.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -call(1,2,3) -call(1,2,3) -function f() { - call(1,2,3) -} - + 1 | call(1,2,3) +> 2 | call(1,2,3) + | ^^^^ +> 3 | function f() { + | ^^^^^^^^^^^^^^ +> 4 | call(1,2,3) + | ^^^^^^^^^ + 5 | } + 6 | =====================================output===================================== call(1,2,3) call(1, 2, 3); @@ -50,10 +55,11 @@ exports[`function-declaration.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -function ugly ( {a=1, b = 2 } ) {} - +> 1 | function ugly ( {a=1, b = 2 } ) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 | =====================================output===================================== function ugly({ a = 1, b = 2 }) {} @@ -64,17 +70,18 @@ exports[`ignore-indentation.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -function ugly ( {a=1, b = 2 } ) { - function ugly ( {a=1, b = 2 } ) { - function ugly ( {a=1, b = 2 } ) { - \`multiline template string - with too much indentation\` - } - } -} - + 1 | function ugly ( {a=1, b = 2 } ) { + 2 | function ugly ( {a=1, b = 2 } ) { + 3 | function ugly ( {a=1, b = 2 } ) { + 4 | \`multiline template string +> 5 | with too much indentation\` + | ^^^ + 6 | } + 7 | } + 8 | } + 9 | =====================================output===================================== function ugly ( {a=1, b = 2 } ) { function ugly ( {a=1, b = 2 } ) { @@ -92,18 +99,19 @@ exports[`issue-3789-1.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -export class F { - reformatThis() { - return 1; - } - - dontTouchThis(){ - return 2 ; - } -} - + 1 | export class F { +> 2 | reformatThis() { + | ^^^^^^^^^^^^^^ + 3 | return 1; + 4 | } + 5 | + 6 | dontTouchThis(){ + 7 | return 2 ; + 8 | } + 9 | } + 10 | =====================================output===================================== export class F { reformatThis() { @@ -122,18 +130,19 @@ exports[`issue-3789-2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -export class F { - reformatThis() { - return 1; - } - - dontTouchThis(){ - return 2 ; - } -} - + 1 | export class F { +> 2 | reformatThis() { + | ^ + 3 | return 1; + 4 | } + 5 | + 6 | dontTouchThis(){ + 7 | return 2 ; + 8 | } + 9 | } + 10 | =====================================output===================================== export class F { reformatThis() { @@ -152,12 +161,14 @@ exports[`issue-4206-1.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -export default class Foo{ -/**/ -} - +> 1 | export default class Foo{ + | ^^^^^^^^^ +> 2 | /**/ + | ^^^^ + 3 | } + 4 | =====================================output===================================== export default class Foo { /**/ @@ -170,12 +181,13 @@ exports[`issue-4206-2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -export default function Foo(){ -/**/ -} - +> 1 | export default function Foo(){ + | ^^^^^^^^^^^^^^ + 2 | /**/ + 3 | } + 4 | =====================================output===================================== export default function Foo() { /**/ @@ -188,12 +200,15 @@ exports[`issue-4206-3.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -/* */ function Foo(){ -/**/ -} - +> 1 | /* */ function Foo(){ + | ^^^^^ +> 2 | /**/ + | ^^^^ +> 3 | } + | ^ + 4 | =====================================output===================================== /* */ function Foo() { /**/ @@ -206,12 +221,14 @@ exports[`issue-4206-4.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -/* */ class Foo{ -/**/ -} - + 1 | /* */ class Foo{ +> 2 | /**/ + | ^^^^ +> 3 | } + | ^ + 4 | =====================================output===================================== /* */ class Foo { /**/ @@ -224,12 +241,14 @@ exports[`issue-7082.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -export const Button = styled.button\` -color: blue; -\`; - +> 1 | export const Button = styled.button\` + | ^^^^^^^ +> 2 | color: blue; + | ^^^^^ + 3 | \`; + 4 | =====================================output===================================== export const Button = styled.button\` color: blue; @@ -242,17 +261,20 @@ exports[`large-dict.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -function ugly() { - const dictWithSeveralEntries = { - key: "value", - anotherKey: "another value", - firstNumber: 1, - secondNumber: 2 - }; -} - + 1 | function ugly() { + 2 | const dictWithSeveralEntries = { + 3 | key: "value", +> 4 | anotherKey: "another value", + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 5 | firstNumber: 1, + | ^^^^^^^^^^^^^^^^^^^^ +> 6 | secondNumber: 2 + | ^^^^^^^^^^^^^^^^^^^ + 7 | }; + 8 | } + 9 | =====================================output===================================== function ugly() { const dictWithSeveralEntries = { @@ -270,18 +292,19 @@ exports[`module-export1.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -import def , {named} from 'x' - -export * from 'd' - -export const x - = 42 - -export default 42 - - + 1 | import def , {named} from 'x' + 2 | +> 3 | export * from 'd' + | ^^^^^^^^^^^ + 4 | + 5 | export const x + 6 | = 42 + 7 | + 8 | export default 42 + 9 | + 10 | =====================================output===================================== import def , {named} from 'x' @@ -300,18 +323,21 @@ exports[`module-export2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -import def , {named} from 'x' - -export * from 'd' - -export const x - = 42 - -export default 42 - - + 1 | import def , {named} from 'x' + 2 | + 3 | export * from 'd' +> 4 | + | ^ +> 5 | export const x + | ^^^^^^^^^^^^^^^^^^ +> 6 | = 42 + | ^^ + 7 | + 8 | export default 42 + 9 | + 10 | =====================================output===================================== import def , {named} from 'x' @@ -329,18 +355,19 @@ exports[`module-export3.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -import def , {named} from 'x' - -export * from 'd' - -export const x - = 42 - -export default 42 - - + 1 | import def , {named} from 'x' + 2 | + 3 | export * from 'd' + 4 | + 5 | export const x + 6 | = 42 + 7 | +> 8 | export default 42 + | ^^^^ + 9 | + 10 | =====================================output===================================== import def , {named} from 'x' @@ -359,18 +386,19 @@ exports[`module-import.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -import def , {named} from 'x' - -export * from 'd' - -export const x - = 42 - -export default 42 - - +> 1 | import def , {named} from 'x' + | ^^^^^^^^^^^^^^^ + 2 | + 3 | export * from 'd' + 4 | + 5 | export const x + 6 | = 42 + 7 | + 8 | export default 42 + 9 | + 10 | =====================================output===================================== import def, { named } from "x"; @@ -389,24 +417,29 @@ exports[`multiple-statements.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -call( - 1, 2,3 -); - -call( - 1, 2,3 -); - -call( - 1, 2,3 -); - -call( - 1, 2,3 -); - + 1 | call( + 2 | 1, 2,3 + 3 | ); + 4 | + 5 | call( +> 6 | 1, 2,3 + | ^^^ +> 7 | ); + | ^^ +> 8 | + | ^^ +> 9 | call( + | ^^ +> 10 | 1, 2,3 + | ^^^^^ + 11 | ); + 12 | + 13 | call( + 14 | 1, 2,3 + 15 | ); + 16 | =====================================output===================================== call( 1, 2,3 @@ -427,24 +460,33 @@ exports[`multiple-statements2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -call( - 1, 2,3 -); - -call( - 1, 2,3 -); - -call( - 1, 2,3 -); - -call( - 1, 2,3 -); - + 1 | call( + 2 | 1, 2,3 + 3 | ); +> 4 | + | ^ +> 5 | call( + | ^^^^^ +> 6 | 1, 2,3 + | ^^^^^ +> 7 | ); + | ^^^^^ +> 8 | + | ^^^^^ +> 9 | call( + | ^^^^^ +> 10 | 1, 2,3 + | ^^^^^ +> 11 | ); + | ^^^^^ +> 12 | + | ^ + 13 | call( + 14 | 1, 2,3 + 15 | ); + 16 | =====================================output===================================== call( 1, 2,3 @@ -465,15 +507,19 @@ exports[`nested.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -try { - if (condition) { - body - } -} -catch (err) {} - +> 1 | try { + | ^^^^^ +> 2 | if (condition) { + | ^^^^^^^^^^^^^^^^^^ +> 3 | body + | ^^^^^^^^^^^^^^^^^^ +> 4 | } + | ^^^ + 5 | } + 6 | catch (err) {} + 7 | =====================================output===================================== try { if (condition) { @@ -488,14 +534,17 @@ exports[`nested-print-width.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -function f() { - if (true) { - call("this line is 79 chars", "long", "it should", "stay as single line"); - } -} - + 1 | function f() { +> 2 | if (true) { + | ^ +> 3 | call("this line is 79 chars", "long", "it should", "stay as single line"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 4 | } + | ^^ + 5 | } + 6 | =====================================output===================================== function f() { if (true) { @@ -510,15 +559,18 @@ exports[`nested2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -try { - if (condition) { - body - } -} -catch (err) {} - + 1 | try { +> 2 | if (condition) { + | ^^^^^^^^^^^^^^^ +> 3 | body + | ^^^^^^^^ +> 4 | } + | ^^^ + 5 | } + 6 | catch (err) {} + 7 | =====================================output===================================== try { if (condition) { @@ -534,15 +586,18 @@ exports[`nested3.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -try { -1;if (condition) { - body - } -} -catch (err) {} - + 1 | try { +> 2 | 1;if (condition) { + | ^^^^^^^^^^^^^^^ +> 3 | body + | ^^^^^^^^ +> 4 | } + | ^^^ + 5 | } + 6 | catch (err) {} + 7 | =====================================output===================================== try { 1;if (condition) { @@ -558,10 +613,11 @@ exports[`object-expression.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -const y = {a:1, b:2} - +> 1 | const y = {a:1, b:2} + | ^^^ + 2 | =====================================output===================================== const y = { a: 1, b: 2 }; @@ -572,19 +628,24 @@ exports[`object-expression2.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== - -const y = [ - { - a: 1, - }, - { - a: 1, - b:2 - }, -] - + 1 | + 2 | const y = [ + 3 | { + 4 | a: 1, +> 5 | }, + | ^ +> 6 | { + | ^^^^^ +> 7 | a: 1, + | ^^^^^ +> 8 | b:2 + | ^^^^^ +> 9 | }, + | ^^^^^^ + 10 | ] + 11 | =====================================output===================================== const y = [ @@ -604,17 +665,18 @@ exports[`range.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -function ugly ( {a=1, b = 2 } ) { - function ugly ( {a=1, b = 2 } ) { - function ugly ( {a=1, b = 2 } ) { - \`multiline template string - with too much indentation\` - } - } -} - + 1 | function ugly ( {a=1, b = 2 } ) { + 2 | function ugly ( {a=1, b = 2 } ) { + 3 | function ugly ( {a=1, b = 2 } ) { + 4 | \`multiline template string +> 5 | with too much indentation\` + | ^^^ + 6 | } + 7 | } + 8 | } + 9 | =====================================output===================================== function ugly ( {a=1, b = 2 } ) { function ugly ( {a=1, b = 2 } ) { @@ -632,17 +694,21 @@ exports[`range-end.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -// Unchanged -call( - 1, 2,3 -); - - -call( - 1, 2,3 -); + 1 | // Unchanged + 2 | call( + 3 | 1, 2,3 + 4 | ); + 5 | +> 6 | + | ^ +> 7 | call( + | ^^^^^ +> 8 | 1, 2,3 + | ^^^^^ +> 9 | ); + | ^^ =====================================output===================================== // Unchanged call( @@ -658,18 +724,22 @@ exports[`range-start.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -call( - 1, 2,3 -); - - -// Unchanged -call( - 1, 2,3 -); - +> 1 | call( + | ^^^^^ +> 2 | 1, 2,3 + | ^^^^^^^^ +> 3 | ); + | ^^^^^^^^ +> 4 | + | ^ + 5 | + 6 | // Unchanged + 7 | call( + 8 | 1, 2,3 + 9 | ); + 10 | =====================================output===================================== call(1, 2, 3); @@ -686,11 +756,12 @@ exports[`try-catch.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -try {} -catch (err) {} - + 1 | try {} +> 2 | catch (err) {} + | ^ + 3 | =====================================output===================================== try { } catch (err) {} @@ -702,10 +773,11 @@ exports[`whitespace.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== - - +> 1 | + | ^ + 2 | =====================================output===================================== diff --git a/tests/json/range/__snapshots__/jsfmt.spec.js.snap b/tests/json/range/__snapshots__/jsfmt.spec.js.snap index 712684eb9..546596f95 100644 --- a/tests/json/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/json/range/__snapshots__/jsfmt.spec.js.snap @@ -4,10 +4,11 @@ exports[`identifier.json format 1`] = ` ====================================options===================================== parsers: ["json"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -{"a":1, "b":2} - +> 1 | {"a":1, "b":2} + | ^^^ + 2 | =====================================output===================================== {"a":1, "b":2} @@ -18,10 +19,11 @@ exports[`issue2297.json format 1`] = ` ====================================options===================================== parsers: ["json"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -{"a":1, "b":2} - +> 1 | {"a":1, "b":2} + | ^ + 2 | =====================================output===================================== {"a":1, "b":2} 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 6b0ca32a3..fbc7d8992 100644 --- a/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/require-pragma/js/__snapshots__/jsfmt.spec.js.snap @@ -79,13 +79,14 @@ exports[`range-with-pragma.js - {"requirePragma":true} format 1`] = ` parsers: ["flow", "babel", "typescript"] printWidth: 80 requirePragma: true - | printWidth + | | printWidth =====================================input====================================== -/** - * @prettier - */ -var test = true - + 1 | /** + 2 | * @prettier + 3 | */ +> 4 | var test = true + | ^^^^^^^^^^^^^^^ + 5 | =====================================output===================================== /** * @prettier @@ -100,10 +101,11 @@ exports[`range-without-pragma.js - {"requirePragma":true} format 1`] = ` parsers: ["flow", "babel", "typescript"] printWidth: 80 requirePragma: true - | printWidth + | | printWidth =====================================input====================================== -var test = true - +> 1 | var test = true + | ^^^^^^^^^^^^^^^ + 2 | =====================================output===================================== var test = true diff --git a/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap index e2e097c1c..3f0fc4f28 100644 --- a/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/range/__snapshots__/jsfmt.spec.js.snap @@ -4,19 +4,25 @@ exports[`issue-4926.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -class Foo { - /** Does this key match a given MinimalKey extending object? */ - match(keyevent) { - // 'in' doesn't include prototypes, so it's safe for this object. - for (let attr in this) { - if (this[attr] !== keyevent[attr]) return false - } - return true - } -} - + 1 | class Foo { + 2 | /** Does this key match a given MinimalKey extending object? */ + 3 | match(keyevent) { +> 4 | // 'in' doesn't include prototypes, so it's safe for this object. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 5 | for (let attr in this) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 6 | if (this[attr] !== keyevent[attr]) return false + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 7 | } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 8 | return true + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 9 | } + | ^^^^^ + 10 | } + 11 | =====================================output===================================== class Foo { /** Does this key match a given MinimalKey extending object? */ @@ -36,12 +42,13 @@ exports[`issue-7148.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== -export default class Test { - private obj = { isTest: true } -} - + 1 | export default class Test { +> 2 | private obj = { isTest: true } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 | } + 4 | =====================================output===================================== export default class Test { private obj = { isTest: true }; diff --git a/tests/vue/range/__snapshots__/jsfmt.spec.js.snap b/tests/vue/range/__snapshots__/jsfmt.spec.js.snap index 5917715a7..7bf549559 100644 --- a/tests/vue/range/__snapshots__/jsfmt.spec.js.snap +++ b/tests/vue/range/__snapshots__/jsfmt.spec.js.snap @@ -4,21 +4,24 @@ exports[`example.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 - | printWidth + | | printWidth =====================================input====================================== - - - - - - + 1 | + 5 | +> 6 | + | ^^^^^^^^^ + 9 | + 10 | + 13 | =====================================output=====================================