-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Bug: inconsistencies when using pugSingleQuote: false
with singleQuote: true
in vue SFCs templates
#339
Comments
pugSingleQuote: false
with singleQuote: true
pugSingleQuote: false
with singleQuote: true
in vue SFCs templates
To clarify : this is not a |
Have not touched the code base for a while, so I currently don't know the exact location where to start. I have a https://github.com/prettier/plugin-pug/blob/main/CONTRIBUTING.md and it is very helpful to just copy one of the tests and create a |
RIght, @Shinigami92 I'll try to dive in soon and make the fixes. |
Any progress? |
Cound’t manage to start, but it's in my pipe. I can propose you something during this week. |
@Shinigami92, I have found the origin of the issue, but I need your insight. The problem lies here : Lines 267 to 277 in 40bd270
where pug<X> options have been introduced to override <X> prettier options, useful in the case of Vue SFCs.
I have perfomed other tests with all the possible So in order to have consistency in template interpolation using javascript code, we should not be doing singleQuote: options.pugSingleQuote ?? options.singleQuote However, as expected, removing the override breaks others tests:
So the solution would be the use a vue-specific options object (without |
@qnp I would assume that we can specifically can override the option if text token was called 🤔 Could you try to add an over-override here? Lines 453 to 463 in 40bd270
Maybe like |
It's exactly what I thought doing, I think this is the best solution. Keep in touch |
Info
Prettier config
Output
After formatting, we obtain:
Code between "mustaches"
{{ ... }}
is not pug markup but Javascript code, however it does not respect thesingleQuote: true
prettier option.Expected Output
Everything between "mustaches"
{{ ... }}
must be treated as Javascript code, so that thesingleQuote: true
prettier option is respected, as follows:Additional Context
May be related to #66 ?
Minimal repro playground
issue-prettier-plugin-pug-quotes.zip
The text was updated successfully, but these errors were encountered: