1- import { doc } from 'prettier' ;
2- import {
3- isLast ,
4- isNextLineEmpty ,
5- isPrettier2
6- } from './backward-compatibility.js' ;
1+ import { doc , util } from 'prettier' ;
72
83const { group, indent, join, line, softline, hardline } = doc . builders ;
4+ const { isNextLineEmpty } = util ;
95
106export const printComments = ( node , path , options , filter = ( ) => true ) => {
117 if ( ! node . comments ) return '' ;
@@ -26,14 +22,7 @@ export const printComments = (node, path, options, filter = () => true) => {
2622 . filter ( Boolean )
2723 ) ;
2824
29- // The following if statement will never be 100% covered in a single run
30- // since it depends on the version of Prettier being used.
31- // Mocking the behaviour will introduce a lot of maintenance in the tests.
32- /* c8 ignore start */
33- return isPrettier2
34- ? document . parts // Prettier V2
35- : document ; // Prettier V3
36- /* c8 ignore stop */
25+ return document ;
3726} ;
3827
3928export function printPreservingEmptyLines ( path , key , options , print ) {
@@ -56,7 +45,7 @@ export function printPreservingEmptyLines(path, key, options, print) {
5645
5746 // Only attempt to append an empty line if `node` is not the last item
5847 if (
59- ! isLast ( childPath , key , index ) &&
48+ ! childPath . isLast &&
6049 isNextLineEmpty ( options . originalText , options . locEnd ( node ) + 1 )
6150 ) {
6251 // Append an empty line if the original text already had an one after
0 commit comments