Closed evoactivity closed 1 year ago
Downgrading prettier to 2.8.7 and eslint-plugin-prettier to 4.2.1 got it running. So seems to be an issue with prettier 3
I looked into this a little bit. It's non-trivial.
The proximate cause of the failure is that assertExists( estreePrinter.hasPrettierIgnore )
fails because estreePrinter
is now an async function that returns the printer, not the printer itself. There's not an obvious place to absorb the asynchrony right at that spot.
The call signature of embed
has also changed so that:
printer.embed = (path, print, textToDoc, options) => {
return stuff
}
becomes something like:
printer.embed = (path, options) => {
return async (textToDoc, print) => {
return stuff;
}
}
Hitting the same thing error on updating to prettier v3
There's not an obvious place to absorb the asynchrony right at that spot.
The code is within definePrinter
function which is only consumed in the parser preprocess
hook
https://github.com/gitKrystan/prettier-plugin-ember-template-tag/blob/c73e1d77aa8a34f102fae16bd1729dd8734b644e/src/parse.ts#L78C1-L79
prettier v3 says -> "Also, the preprocess method of a printer can return a promise now." https://prettier.io/blog/2023/07/05/3.0.0.html#api
So I think that'll be the place.
I've opened a draft PR here https://github.com/gitKrystan/prettier-plugin-ember-template-tag/pull/63
I am stuck on 2 types issues, if anyone could lend a hand. Else, feel free to use it as a guide for your own prettier v3 update
I've been watching the status updates for Prettier v3 like π . Looks like it's here now. I'll try to look into this ASAP
Facing this same issue trying out ember-template-imports
. This project already uses prettierV3
.
Just released prettier-plugin-ember-template-tag@1.0.0-0
with a fix for this issue. Can one of you try it out and LMK if everything is working properly with your set-up? After that I will release 1.0.0
for real.
@gitKrystan that is working for me with prettier 3.0.0 π π π π π π
Same here!!! That fix solved the issue.
(Now I'm blocked by https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues/81#issuecomment-1650560485 π )
Working for me. @gitKrystan Thanks for fixing this so quickly π
Fixed as of v1.0.0 π
works great for me as well. thanks for putting in the effort here to get it across the line! happily on prettier 3 now :)
π Describe the Bug
Trying to get this working in vs code, also seeing this error when running
pnpm lint
.Sidenote, to get to this point I had to follow the tips in https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues/38
π¬ Minimal Reproduction
Not sure how reproducible this is I'm not sure of the cause. As it shows up outside of vscode I don't think it's an editor specific issue.
Some probably relevant info
π Actual Behavior
Will not run. Failing with
assertExists failed
and a stack trace of minified code.π€ Expected Behavior
Prettier is run.
π Environment
β Additional Context
Output from VS Code
Output from
pnpm lint:js