Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier v3 Support #1597

Closed
itsezc opened this issue Aug 4, 2023 · 5 comments
Closed

Prettier v3 Support #1597

itsezc opened this issue Aug 4, 2023 · 5 comments
Assignees

Comments

@itsezc
Copy link

itsezc commented Aug 4, 2023

Prettier v3 is currently out, and projects are starting to migrate over, any project using Prettier v3 is unable to use the GQty CLI.

node_modules/prettier/plugins/flow.js:5
`),x.js_error)throw x.js_error}}else throw x}function f$(){var x=p0.process;x&&x.on?x.on("uncaughtException",function(r,e){bU(r),x.exit(2)}):p0.addEventListener&&p0.addEventListener("error",function(r){r.error&&bU(r.error)})}f$();function a(x,r){return(x.l>=0?x.l:x.l=x.length)==1?x(r):ys(x,[r])}function d(x,r,e){return(x.l>=0?x.l:x.l=x.length)==2?x(r,e):ys(x,[r,e])}function ex(x,r,e,t){return(x.l>=0?x.l:x.l=x.length)==3?x(r,e,t):ys(x,[r,e,t])}function we(x,r,e,t,n){return(x.l>=0?x.l:x.l=x.length)==4?x(r,e,t,n):ys(x,[r,e,t,n])}function Xe(x,r,e,t,n,i){return(x.l>=0?x.l:x.l=x.length)==5?x(r,e,t,n,i):ys(x,[r,e,t,n,i])}function c$(x,r,e,t,n,i,f,o){return(x.l>=0?x.l:x.l=x.length)==7?x(r,e,t,n,i,f,o):ys(x,[r,e,t,n,i,f,o])}var vP=[q1,eU,-1],xX=[q1,Lz,-2],vn=[q1,vw,-3],lP=[q1,gz,-4],Cr=[q1,$j,-7],rX=[q1,bD,-8],eX=[q1,XD,-9],A1=[q1,aM,-11],e3=[q1,uz,-12],s$=[4,0,0,0,[12,45,[4,0,0,0,0]]],pP=[0,[11,'File "',[2,0,[11,'", line ',[4,0,0,0,[11,jD,[4,0,0,0,[12,45,[4,0,0,0,[11,": ",[2,0,0]]]]]]]]]],'File "%s", line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j),Pt(8,eX,XD),Pt(7,rX,bD),Pt(6,Cr,$j),Pt(5,[q1,wj,-6],wj),Pt(4,[q1,IM,-5],IM),Pt(3,lP,gz),Pt(2,vn,vw),Pt(1,xX,Lz),Pt(0,vP,eU);var o$="output_substring",a$=Yf,v$=y7,l$=B7,p$="CamlinternalLazy.Undefined",d$=zz,y$="\\'",m$="\\b",k$="\\t",h$="\\n",w$="\\r",_$="List.iter2",T$="tl",S$="hd",A$="String.blit / Bytes.blit_string",g$="Bytes.blit",E$="String.sub / Bytes.sub",I$="Array.blit",N$="Array.sub",C$="Map.remove_min_elt",P$=[0,0,0,0],L$=[0,"map.ml",400,10],O$=[0,0,0],R$=u4,M$=u4,j$=u4,D$=u4,z$="Stdlib.Queue.Empty",U$="Buffer.add_substring/add_subbytes",X$="Buffer.add: cannot grow buffer",K$=[0,TM,93,2],Y$=[0,TM,94,2],B$="Buffer.sub",J$="%c",V$="%s",$$=uM,Z$=Dz,Q$=Xj,F$=bz,W$="%f",G$="%B",H$="%{",q$="%}",b$="%(",xZ="%)",rZ=nD,eZ="%t",tZ="%?",nZ="%r",uZ="%_r",iZ=[0,or,850,23],fZ=[0,or,814,21],cZ=[0,or,815,21],sZ=[0,or,818,21],oZ=[0,or,819,21],aZ=[0,or,822,19],vZ=[0,or,823,19],lZ=[0,or,826,22],pZ=[0,or,827,22],dZ=[0,or,831,30],yZ=[0,or,832,30],mZ=[0,or,836,26],kZ=[0,or,837,26],hZ=[0,or,846,28],wZ=[0,or,847,28],_Z=[0,or,851,23],TZ=[0,or,1558,4],SZ="Printf: bad conversion %[",AZ=[0,or,1626,39],gZ=[0,or,1649,31],EZ=[0,or,1650,31],IZ="Printf: bad conversion %_",NZ=tz,CZ=Kj,PZ=tz,LZ=Kj,OZ=[0,[11,"invalid box description ",[3,0,0]],"invalid box description %S"],RZ=[0,0,4],MZ=xk,jZ="neg_infinity",DZ=Gj,zZ=Yf,UZ=[0,At],XZ="%+nd",KZ="% nd",YZ="%+ni",BZ="% ni",JZ="%nx",VZ="%#nx",$Z="%nX",ZZ="%#nX",QZ="%no",FZ="%#no",WZ="%nd",GZ=Xj,HZ="%nu",qZ="%+ld",bZ="% ld",xQ="%+li",rQ="% li",eQ="%lx",tQ="%#lx",nQ="%lX",uQ="%#lX",iQ="%lo",fQ="%#lo",cQ="%ld",sQ=Dz,oQ="%lu",aQ="%+Ld",vQ="% Ld",lQ="%+Li",pQ="% Li",dQ="%Lx",yQ="%#Lx",mQ="%LX",kQ="%#LX",hQ="%Lo",wQ="%#Lo",_Q="%Ld",TQ=bz,SQ="%Lu",AQ="%+d",gQ="% d",EQ="%+i",IQ="% i",NQ="%x",CQ="%#x",PQ="%X",LQ="%#X",OQ="%o",RQ="%#o",MQ=Ql,jQ=uM,DQ=gD,zQ=Ja,UQ="@}",XQ="@?",KQ=`@
                                     ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
@vicary
Copy link
Member

vicary commented Aug 4, 2023

Which version of CLI are you using?

@vicary vicary self-assigned this Aug 4, 2023
@itsezc
Copy link
Author

itsezc commented Aug 4, 2023

Using 4.0.0-alpha-74beaa55.0

@vicary
Copy link
Member

vicary commented Aug 4, 2023

Looking at the source file node_modules/prettier/plugins/flow.js, it seems like prettier is trying to format with Flow instead of TypeScript.

I haven't tried prettier v3 yet, would you please help isolating it from your project configurations? i.e. It's the default behaviour and we need to tell Prettier V3 to treat it as TypeScript/JavaScript instead of Flow.

@vicary
Copy link
Member

vicary commented Aug 5, 2023

I upgraded the project to Prettier V3 in alpha, examples and tests are passing without experiencing this issue.

Please give 3.0.0-alpha-1300f672.0 a try, hopefully narrowing down the possible causes.

@vicary
Copy link
Member

vicary commented Aug 9, 2023

Some of the older dependencies are preventing us from completely upgrade prettier, but since it's not a peer dependency it really shouldn't matters. We will downgrade to Prettier V2 in the upcoming versions, please feel free to reopen if you find it still an issue.

EDIT 2024-05-08

Inline snapshots in jest v29 is not compatible with prettier v3, the upcoming jest v30 should work but it's still in pre-release. Deferring updates until it's officially out.

We may also replace jest with vitest in #1754 and stop worrying about the prettier peer.

@vicary vicary closed this as completed Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants