-
Notifications
You must be signed in to change notification settings - Fork 13
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
--fix removes newline at EOF #100
Comments
Hey @jcardali, This is actually an expected behavior of Prettier. Indeed, Prettier for handlebars does remove the newline at EOF. I made one attempt at changing that: see prettier/prettier#6243 but it would require more work to refine the approach. |
Thanks for the quick response @dcyriller! Will definitely be keeping my eye on the PR you opened. For the sake of completeness, I also investigated whether this issue was surmountable with |
When you use Prettier to format your templates, it's recommended to turn ember-template-lint's |
Yep, just did it out of curiousity. |
Okay, then it doesn't work when you specify |
"never" only seemingly works because that is the default behavior of Pretter in this case. We have |
Hi @dcyriller, any update on this? |
editorconfig-to-prettier now supports the Next step would be to use the option in Prettier's handlebars printer. |
Seems like there is support for that approach prettier/prettier#9067. I looked at this a bit today, I am not seeing how exactly to achieve it without having minimist throw a warning... |
It will have to be probably implemented on this line: https://github.com/prettier/prettier/blob/2.1.2/src/language-handlebars/printer-glimmer.js#L51 |
the Is there any way to not remove the newline at EOF while running My
I have explicitly mentioned
|
Hi @rinoldsimon,
This is expected. Indeed, Prettier will always remove the last eol for now. I have opened prettier/prettier#10759 to read
As a workaround, you could change your editor config to insert final newlines for all files but hbs. |
I'm using VScode and below is the config I wrote to omit the final newline in hbs settings.json
|
I would like to understand the use case better. Mainly to decide if this should be considered a blocker for emberjs/rfcs#777. Why do you want to have a final new line in Ember / Glimmer templates? |
Behavior:
ember-template-lint --fix [FILE]
removes the newline at EOFExpected behavior:
EOF newlines should at minimum be respected, or even added, since that is Prettier's behavior
I do not see this behavior if I remove
prettier: true
from.template-lintrc.js
, which is what leads me to believe this is an issue with the plugin.Line 29 is the last line with text, and Line 30 is a newline
The text was updated successfully, but these errors were encountered: