-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add html to prettier #13252
Add html to prettier #13252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@swarajsaaj move html extension to inside skipClient condition. |
@mshima I could find |
But these are Thymeleaf templates, I'm not sure Prettier can do a good job with them although I did not check. |
@gmarziou I think for Thymeleaf most of syntax is inserted as attributes to HTML elements (with a prefix namespace), so they should not interfere with formatting. For Angular templates, Prettier seems to have support for |
@gmarziou you can see the result at https://github.com/jhipster/generator-jhipster/pull/13252/checks?check_run_id=1542973740 (MERGE: project diff section). Backend files are the first. Looks ok to me. |
Thanks for the examples, output is consistent and works well with templates. It's just that I'm not a big fan of the way Prettier formats html which uses much more vertical space than original formatting. <input
type="password"
class="form-control"
id="newPassword"
name="newPassword"
placeholder="{{ 'global.form.newpassword.placeholder' | translate }}"
formControlName="newPassword"
data-cy="resetPassword"
#newPassword
/> or <html
xmlns:th="http://www.thymeleaf.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.thymeleaf.org"
th:lang="${#locale.language}"
lang="en"
> Also embedded CSS formatting does not look familiar to me, I would keep @media only screen and (max-width: 280px) {
body,
p { |
Not a big fan either, but overall is better with prettier enabled IMO. |
Agreed, let's favor style consistency. |
HTML files will now be included in prettier command Fix jhipster#13090
d350332
to
163f3cf
Compare
@mshima @gmarziou Could you please help why "npm test" is failing in the CI (https://github.com/jhipster/generator-jhipster/pull/13252/checks?check_run_id=1546315589) ? I am not sure how this timeout error can be due to html prettier change, or is it due to some other issue? |
Try to increase timeout to 40000 at: generator-jhipster/.mocharc.js Line 5 in 7b07d28
Enabling prettier at html can make the generation slower. |
Increasing timeout for mocha tests due to failure in CI as HTML formatting may increase generation time. Fix jhipster#13090
@mshima I have tried increasing 30000ms to 90000ms in steps, but seems that is not the issue (original test runs in ~3s), seems there is some conflict with
|
Correct HelloVue.html syntax to <head> tag instead of nested <meta> tags, and reverted mocha tests timeout to 30000ms are original Fix jhipster#13090
@mshima Finally found the hidden problem, under the hood in test prettier was getting stuck due to a syntax error in |
@swarajsaaj Thanks for the contribution! |
Great job finding the error. |
HTML files will now be included in prettier command
Fix #13090
Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (bellow reviewers) and adding
skip-ci
label, you can still see CI build result at your branch.