File tree Expand file tree Collapse file tree
changelog_unreleased/javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #### Fix range format for function bodies (#13173 by @thorn0 )
2+
3+ <!-- prettier-ignore -->
4+ ``` jsx
5+ // Input
6+ let fn = (() => {
7+ return ; //
8+ // ^^^^^^^^^^ - range
9+ });
10+
11+ // Prettier stable
12+ let fn = (() => {
13+ return ; //
14+ };);
15+
16+ // Prettier main
17+ let fn = (() => {
18+ return ; //
19+ });
20+ ```
Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ function findSiblingAncestors(
6464 } else {
6565 break ;
6666 }
67+ if ( resultStartNode === resultEndNode ) {
68+ break ;
69+ }
6770 }
6871
6972 return {
Original file line number Diff line number Diff line change @@ -182,6 +182,27 @@ rangeStart: 0
182182================================================================================
183183` ;
184184
185+ exports [` function-body.js format 1` ] = `
186+ ====================================options=====================================
187+ parsers: ["babel", "flow", "typescript"]
188+ printWidth: 80
189+ rangeEnd: 33
190+ rangeStart: 20
191+ | | printWidth
192+ =====================================input======================================
193+ 1 | let fn =a((x ) => {
194+ > 2 | quux (); //
195+ | ^^^^^^^^^^^^^
196+ 3 | } );
197+ 4 |
198+ =====================================output=====================================
199+ let fn =a((x ) => {
200+ quux (); //
201+ } );
202+
203+ ================================================================================
204+ ` ;
205+
185206exports [` function-declaration.js format 1` ] = `
186207====================================options=====================================
187208parsers: ["babel", "flow", "typescript"]
Original file line number Diff line number Diff line change 1+ let fn = a ( ( x ) => {
2+ < << PRETTIER_RANGE_START > >> quux ( ) ; //<<<PRETTIER_RANGE_END>>>
3+ } ) ;
You can’t perform that action at this time.
0 commit comments