-
Notifications
You must be signed in to change notification settings - Fork 357
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
WIP: Formatting test #415
base: main
Are you sure you want to change the base?
WIP: Formatting test #415
Conversation
{# First page link #} | ||
|
||
{% if module.show_first_and_last_links == true %} | ||
<a class="pagination__link pagination__link--first {{ "pagination__link--disabled" if not last_page_num }}"> |
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.
Missing template data
<nav aria-label="Pagination navigation" role="navigation" class="pagination"> | ||
{% set page_list = %} | ||
{% if contents.total_page_count - current_page_num == 1 %} | ||
{% set offset = %} |
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.
Indenting
{% if module.button_link.no_follow %} | ||
{% do rel.append("nofollow") %} | ||
{% dorel.append("nofollow") %} |
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.
space
{% endif %} | ||
{% set rel = [] %} | ||
{% set rel = %} |
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.
missing
name="{{ module.feature_icon.name }}" | ||
purpose="decorative" | ||
style="{{ module.feature_icon.type }}" | ||
unicode="{{ module.feature_icon.unicode }}" %}{{ feature }}</li> |
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.
weird formatting
{% if module.link.no_follow %} | ||
{% do rel.append("nofollow") %} | ||
{% dorel.append("nofollow") %} |
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.
space missing
@@ -4,141 +4,143 @@ | |||
<style> | |||
{% scope_css %} | |||
|
|||
{# Features #} | |||
{# Features #} |
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.
I'm thinking scoped css should never add indentation?
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.
I'd be good with that rule 👍🏼 so maybe: indent for if statements but don't indent for HubL functions (e.g. require_css/scope_css) CC: @TanyaScales
@@ -4,141 +4,143 @@ | |||
<style> | |||
{% scope_css %} | |||
|
|||
{# Features #} | |||
{# Features #} |
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.
I'm thinking scoped css should never add indentation?
[ {"social_account": "facebook-f"}, {"social_account": "linkedin-in"}, | ||
{"social_account": "twitter"}, {"social_account": "instagram"} ] |
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.
arrays shouldn't break
[ {"social_account": "facebook-f"}, {"social_account": "linkedin-in"}, | ||
{"social_account": "twitter"}, {"social_account": "instagram"} ] |
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.
arrays shouldn't break
{% set list_type = "small" %} | ||
{% set list_type = "small" %} | ||
{% elif module.layout_style == "list" %} | ||
{% set list_type = "large" %} | ||
{% set list_type = "large" %} |
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.
I would still expect the {% set %}
lines to be indented inside of the if statement.
Current prettier formatting:
{% if module.layout_style == "card" %}
{% set list_type = "small" %}
{% elif module.layout_style == "list" %}
{% set list_type = "large" %}
{% endif %}
Previous and expected format:
{% if module.layout_style == "card" %}
{% set list_type = "small" %}
{% elif module.layout_style == "list" %}
{% set list_type = "large" %}
{% endif %}
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.
Curious to hear @jasonnrosa thoughts on this, it appears this is a rule around all {% if %}
statements
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.
Yeah I would also expect and much prefer the previous comment. Formatting of the first instance Tanya mentioned is much harder to read. In general we always prefer an indent within if
statements.
{% if module.link.open_in_new_tab %}target="_blank" | ||
{% endif %} | ||
{% if rel %}rel="{{ rel|join( ) }}" | ||
{% endif %} |
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.
This is odd formatting to me -- seems like this should stay on one line, or if following some of the other ways prettier is trying to format, the attribute should be on its own line:
{% if module.link.open_in_new_tab %}
target="_blank"
{% endif %}
{% set menu = menu(module.menu, "site_root").children %} | ||
{% set menu = %} |
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.
Missing/removed the value here
<li class="menu__item menu__item--depth-{{ depth }} {{ "menu__item--has-submenu" if link.children && depth < module.max_levels }} hs-skip-lang-url-rewrite"> | ||
<li class="menu__item menu__item--depth-depth {{ "menu__item--has-submenu" if link.children and depth < module.max_levels }} hs-skip-lang-url-rewrite"> |
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.
Seems to have removed the brackets around depth in the class name:
menu__item menu__item--depth-{{ depth }}
changed to menu__item menu__item--depth-depth
<span class="menu__child-toggle-icon"></span> | ||
</button> | ||
<ul class="menu__submenu menu__submenu--level-{{ depth + 1 }} no-list"> | ||
{% set depth = %} |
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.
Missing/removed depth + 1
here
<a class="menu__link {{ "menu__link--toggle" if link.children && depth < module.max_levels }} {{ "menu__link--active-branch" if link.activeBranch }} {{ "menu__link--active-link" if link.activeNode }}" href="{{ link.url }}" {{ 'aria-haspopup="true" aria-expanded="false"' if link.children && depth < module.max_levels }} {{ 'aria-current="page"' if link.activeNode }} {{ 'target="_blank" rel="noopener"' if link.linkTarget }}>{{ link.label }}</a> | ||
<a class="menu__link {{ "menu__link--toggle" if link.children and depth < module.max_levels }} {{ "menu__link--active-branch" if link.activeBranch }} {{ "menu__link--active-link" if link.activeNode }}" href="{{ link.url }}" {{ "aria-haspopup="true" aria-expanded="false"" if link.children and depth < module.max_levels }} {{ "aria-current="page"" if link.activeNode }} {{ "target="_blank" rel="noopener"" if link.linkTarget }} | ||
>{{ link.label }}</a | ||
> |
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.
Bit of strange formatting here, breaking the ending caret of the anchor tag to a new line on both the opening and closing tag
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.
Also noticed that the quotes were changed here from single to double causing this line to break:
Original:
{{ 'target="_blank" rel="noopener"' if link.linkTarget }}
Change to:
{{ "target="_blank" rel="noopener"" if link.linkTarget }}
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.
There are other instances of the single to double quotes as well in this line (and probably throughout this PR)
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.
Ah- Good catch! Will look into this
|
||
{# Tags #} | ||
{# Tags #} |
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.
I think we have some extra spacing being added in here
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.
This actually looks like it is across the board (looks like it might be pushing things in in some areas 4 spaces instead of 2).
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.
I've noticed this in another scope_css
block, are you noticing this in any other tags?
Normally we indent the body inside of a tag block, but because this is CSS (and we're not really parsing CSS) it might make sense to skip that first indent for scope_css
{% set href = "mailto:" + href %} | ||
{% set href = %} |
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.
missing here too
<hr class="card__hr"> | ||
<hr class="card__hr" /> |
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.
not sure if we want self-closing tags to have their closing backslash removed - @jasonnrosa ?
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.
These are coming straight from prettier and I believe that there is no option to override them. It definitely warrants another look, though.
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.
Yeah I'd prefer to omit if possible but sounds like this obviously depends on prettier
}, | ||
max_width={{ context.max_width || 700 }}, |
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.
Seems to be removing the commas between the top level params.
Current
background_image={...}
max_width={{...}}
padding={...}
vertical_alignment="MIDDLE"
Expected:
background_image={...},
max_width={{...}},
padding={...},
vertical_alignment="MIDDLE"
{% endif %} | ||
<article | ||
class="blog-index__post blog-index__post--{{ list_type }}" | ||
aria-label="Blog post summary: {{ content.name }}" |
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.
Is there any reason this is pushing attributes to their own line?
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.
The prettier HTML formatter is handling HTML attributes, so this is expected behavior
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.
Also worth noting that prettier is really opinionated and the team does not accept requests for new options. More info on that here https://prettier.io/docs/en/option-philosophy.html
{% endif %} | ||
|
||
{# Blog author listing header #} | ||
|
||
{% if blog_author %} | ||
<h2 class="blog-author-heading">{{ module.blog_author_listing.subheading }} {{ blog_author.display_name }}:</h2> | ||
<h2 class="blog-author-heading">{{ module.blog_author_listing.subheading }} {{ blog_author.display_name }}:</h2> |
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.
Similar indenting issue
{% endif %} | ||
|
||
{# Blog tag listing header #} | ||
|
||
{% if tag %} | ||
<h2 class="blog-tag-heading">{{ module.blog_tag_listing.subheading }} {{ page_meta.html_title|split(" | ")|last }}:</h2> | ||
<h2 class="blog-tag-heading">{{ module.blog_tag_listing.subheading }} {{ page_meta.html_title|split(" | ")|last }}:</h2> |
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.
Similar indenting issue
{% endif %} | ||
{% if module.button_link.open_in_new_tab %} | ||
{% do rel.append("noopener") %} | ||
{% dorel.append("noopener") %} |
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.
space
{% do rel.append("nofollow") %} | ||
{# Sets attributes used for the link field #} | ||
|
||
{% set href = %} |
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.
missing
|
||
{% set href = %} | ||
{% if item.social_link.url.type == "EMAIL_ADDRESS" %} | ||
{% set href = %} |
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.
missing
{% if item.social_link.url.type == "EMAIL_ADDRESS" %} | ||
{% set href = %} | ||
{% endif %} | ||
{% set rel = %} |
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.
missing
{% endif %} | ||
{% set rel = %} | ||
{% if item.social_link.no_follow %} | ||
{% dorel.append("nofollow") %} |
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.
space
{% dorel.append("nofollow") %} | ||
{% endif %} | ||
{% if item.social_link.open_in_new_tab %} | ||
{% dorel.append("noopener") %} |
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.
space
{% set social_icon = %} | ||
{% else %} | ||
{% set social_icon = %} | ||
{% endif %} |
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.
missing values for two social_icon
variables above
vertical_alignment="MIDDLE" | ||
%} | ||
} | ||
vertical_alignment="MIDDLE" %} |
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.
Doesn't seem to be allowing the closing tag being on its own line.
{% end_dnd_module %} | ||
{% end_dnd_row %} | ||
{% dnd_row %} | ||
{% dnd_module | ||
path="../modules/button", | ||
button_text={{ context.button_text || "Get started" }}, | ||
path="../modules/button" |
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.
removed comma
"src": context.image or get_asset_url("../images/grayscale-mountain.png") | ||
} | ||
offset=0 | ||
width=6 %} |
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.
More missing commas above
offset=6, | ||
width=6 | ||
%} | ||
{% dnd_column offset=6 width=6 %} |
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.
Shifted these from being on their own lines with commas to being in one line with no comma
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.
Fixing issue with commas.
In regards to going from multiple lines to single line, prettier will try to fit a tag on one line and only break if it doesn't fit. Curious if folks feel strongly about always breaking on new lines?
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.
We typically always have HubL tags break params onto their own lines throughout all of our assets -- so, I generally do appreciate that formatting -- what I would like more is consistency -- so if you're saying that some HubL tags will break onto multiple lines because they are longer/have more params, and others won't because they are shorter, I don't really like them diverging like that
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.
Yeah I also much prefer them broken out onto multiple lines. I find it a lot easier to read separate parameters on their own lines vs. trying to read them all on one line (similar to CSS declarations).
pageEditor.appendChild(linkNode); | ||
} | ||
</script> | ||
{% end_require_js %} | ||
{% end_require_js %} |
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.
Would just want to make sure all of this JS formatting is expected
{{ require_css(get_asset_url("../../css/main.css")) }} | ||
{# This is intended to be used if a template requires template specific style sheets #} | ||
{# | ||
<!-- This is intended to be used if a template requires template specific style sheets --> |
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.
Added HTML comment within HubL comment
{% endif %} | ||
{{ require_css(get_asset_url("../../css/theme-overrides.css")) }} | ||
{# To see a full list of what is included via standard_header_includes please reference this article: https://developers.hubspot.com/docs/cms/hubl/variables#required-page-template-variables #} | ||
{# | ||
<!-- To see a full list of what is included via standard_header_includes please reference this article: https://developers.hubspot.com/docs/cms/hubl/variables#required-page-template-variables --> |
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.
HTML within HubL comment
Types of change
Description
A clear and concise description of what the pull request is solving.
Relevant links
Example page:
GitHub issue:
Checklist
People to notify