You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am raising cases that I discovered from discussions on some recent PRs. I will understand if the Prettier team wants to split this into multiple issues.
Currently results in an internal exception thrown by src/language-js/print/call-arguments.js, when using --parser=babel-ts:
$ ./bin/prettier.js --parser=babel-ts case2a.js
case2a.js[error] case2a.js: TypeError: Cannot read property 'type' of null
[error] at printCallArguments (/home/brodybits/prettier/src/language-js/print/call-arguments.js:49:13)
[error] at printCallExpression (/home/brodybits/prettier/src/language-js/print/call-expression.js:93:5)
[error] at printPathNoParens (/home/brodybits/prettier/src/language-js/printer-estree.js:413:14)
[error] at Object.genericPrint [as print] (/home/brodybits/prettier/src/language-js/printer-estree.js:100:30)
[error] at callPluginPrintFunction (/home/brodybits/prettier/src/main/ast-to-doc.js:140:18)
[error] at /home/brodybits/prettier/src/main/ast-to-doc.js:64:16
[error] at printComments (/home/brodybits/prettier/src/main/comments.js:549:19)
[error] at printGenerically (/home/brodybits/prettier/src/main/ast-to-doc.js:62:13)
[error] at FastPath.call (/home/brodybits/prettier/src/common/fast-path.js:66:20)
[error] at printPathNoParens (/home/brodybits/prettier/src/language-js/printer-estree.js:279:14)
My apologies for the confusion, I reported multiple cases that I think we should take a look at. I have now updated the description to be hopefully more clear.
Case 1a and 1b are comments printed in the wrong place.
The cases with the exceptions are internal TypeErrors that come up when using --parser=babel-ts. These internal TypeErrors come from src/language-js/print/call-arguments.js.
These may be corner cases but I would love to see them resolved and tested someday. Unfortunately I cannot promise when I will get a chance to contribute any solutions. Thanks.
I am raising cases that I discovered from discussions on some recent PRs. I will understand if the Prettier team wants to split this into multiple issues.
Cases with comments in the wrong place
Case 1a
from discussion in PR #9857
results from recently merged PR #9787:
Prettier pr-9787
Playground link
Input:
Output:
Expected output:
Case 1b
results from recently merged PR #9787
Prettier pr-9787
Playground link
Input:
Output:
Cases with internal TypeErrors
Case 2a
Fixed by PR #10023:
Currently results in an internal exception thrown by
src/language-js/print/call-arguments.js
, when using--parser=babel-ts
:Case 2b
not (yet) fixed by PR #10023:
Currently results in the same internal exception when using
--parser=babel-ts
.Case 2c
also not (yet) fixed by PR #10023:
Currently results in the same internal exception when using
--parser=babel-ts
.Case 2d
simplification of case 2c, raised by @fisker in discussion on PR #10023
Currently results in the same internal exception when using
--parser=babel-ts
.The text was updated successfully, but these errors were encountered: