-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
SyntaxError: Handlebars partials are not supported #11834
Comments
Can you use issue template? |
Yes I can use template. It is parsing with no problem. |
Can you reproduce the bug at https://prettier.io/playground/ ? |
Definitely but I am in India and its kind of late night here. Will it be okay if I perform this tomorrow morning and then inform you? |
By the way you can also try this by taking any handlebar partial in your file |
To be honest, I know very little about Handlebars. So it's costly to try it in my own environment. It would be helpful if you could share the results on Playground. |
SyntaxError: Unexpected token (1:3)
This is what i am getting in playground |
SyntaxError: Unexpected token (1:3)
|
Thank you. Prettier doesn't support Handlebars partials Prettier 2.4.1 --parser glimmer Input: {{> header}} Output: SyntaxError: Handlebars partials are not supported:
|
| {{> header}}
|
(error occurred in 'an unknown module' @ line 1 : column 0) (1:0)
> 1 | {{> header}}
| ^^^^^^^^^^^^ |
Then how we can solve this issue? |
Sorry, I don't know. I'll investigate. |
I think we have to add this feature. |
Any news to this? |
No |
FYI we use the Glimmer parser that does the parsing of code that combines Handlebars + HTML (the Handlebars parser doesn't support HTML), but that parser does not support all Handlebars features (e.g. partials) That means we're blocked until the Glimmer parser support those features or somebody comes up with another solution. |
- handlebar partials are not yet supported by prettier, so removing files with errors - prettier/prettier#11834
@duailibe is there an issue to have support for this be added to Glimmer? |
Any progress on this? |
@Th3S4mur41 I don't think there are any concrete plans, since Glimmer is supporting Ember's style of Handlebars and not Handlebars generally. I see an attempt was made here though: glimmerjs/glimmer-vm#1367 |
I would also really like to see this being fixed 👍🏻 Is there any way one can help? |
Seem unlikely at this point. Would there be any way to just avoid triggering an error and being able to just ignore those lines?? |
bummer |
@sosukesuzuki && @itssabhishek : It seems like a meet-you-halfway-solution would be to allow comments that prevent the parser from touching that bit of code. However, it still tries to "validate" and gives that error. Example:
However, not even that works. it still produces that error... |
There is a prettierrc configuration that formats the partials the right way For more details see shpp/programming.org.ua#25 filename: .prettierrc.json content: {
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"printWidth": 100,
"useTabs": false,
"bracketSpacing": true,
"endOfLine": "lf",
"arrowParens": "always",
// IMPORTANT PART BELLOW
"overrides": [
{
"files": "**/*.hbs",
"options": {
"parser": "angular"
}
}
]
} |
@SitaGomes it works for partials, but doesn't work with conditions for attributes:
Any ideas how to parse and format them correctly? |
Initially, I also formatted the templates in `theme/`, but this triggers prettier/prettier#11834. So I exclude them for now.
Initially, I also formatted the templates in `theme/`, but this triggers prettier/prettier#11834. So I exclude them for now. --------- Co-authored-by: Ming-Ying Chung <mych@chromium.org>
Any news or workaround about using Prettier with Handlebars partials? |
??? resolved this issue? |
did you find a workaround ? |
@SitaGomes nope |
#11834 (comment) |
Any update? I can't ignore code either. |
Prettier 2.4.1
Handlebars files are not getting formatted when included partials. I searched it on google but no proper solution was found. Please fix this.
Edited by maintainer:
Prettier 3.0.3
Playground link
Input:
Output:
The text was updated successfully, but these errors were encountered: