Shopify / dawn

Shopify's first source available reference theme, with Online Store 2.0 features and performance built-in.
Other
2.48k stars 3.32k forks source link

Theme Check failing with errors on two files #3296

Open dominicmichaud opened 6 months ago

dominicmichaud commented 6 months ago

Describe the current behavior

Running shopify theme check on the latest version of Dawn brings about two errors which should be fixed. The files in questions are:

Describe the expected behavior

Running shopify theme check on the latest version of Dawn should pass and be successful and only highlights some warnings. No errors should be detected.

Version information (Dawn, browsers and operating systems)

Possible solution

I've modified the Liquid and Schema code that were wrong and Theme Check passes successfully, like so:

Line 144, fix:

{% if section.settings.sticky_header_type != 'none' %}
<sticky-header data-sticky-type="{{ section.settings.sticky_header_type }}" class="header-wrapper color-{{ section.settings.color_scheme }} gradient{% if section.settings.show_line_separator %} header-wrapper--border-bottom{% endif %}">
{% else %}
<div class="header-wrapper color-{{ section.settings.color_scheme }} gradient{% if section.settings.show_line_separator %} header-wrapper--border-bottom{% endif %}">
{% endif %}

Line 340, fix:

{% if section.settings.sticky_header_type != 'none' %}
</sticky-header>
{% else %}
</div>
{% endif %}

It should be replaced with enabled_on and be moved up near the top of the schema:

"name": "t:sections.email-signup-banner.name",
  "tag": "section",
  "class": "section",
  "enabled_on": {
    "templates": ["password"]
  },

Additional context/screenshots

I am setting up a new GitLab CI/CD pipeline structure for our projects with the Shopify CLI and added a Test stage. In this stage, I am running Theme Check to ensure that the Theme is correctly maintained and error-free before merging in branches. My builds were failing because the Check summary detected these two errors. After correcting said-errors like mentioned above, the builds were successful.

Screenshots: Fail: gitlab-ci-cd-build-fail

Success: gitlab-ci-cd-success-build

captainscorch commented 6 months ago

Thank you! Using

"name": "t:sections.email-signup-banner.name",
  "tag": "section",
  "class": "section",
  "enabled_on": {
    "templates": ["password"]
  },

in the sections/email-signup-banner.liquid fixed the theme check error for me.

dominicmichaud commented 6 months ago

@captainscorch You're quite welcome! Happy to hear it helped you out :)