Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
337 stars 95 forks source link

[Bug]: Erroneous MissingTemplate errors when not using default directory structure (supplying [ ROOT ] to theme serve) #649

Closed peepers-rick closed 1 year ago

peepers-rick commented 2 years ago

Please confirm that you have:

What type of project are you working on?

theme

Expected behavior

Using shopify theme serve [ ROOT ] where the root is not the default directory structure should NOT result in theme-check(MissingTemplate) for all snippets and sections.``

Actual behavior

Using shopify theme serve [ ROOT ] where the root is not the default directory structure shows errors for valid sections and snippets

Stack trace

No response

Reproduction steps

  1. Create theme with non-standard directory structure, example, put assets, config, layout, locales, etc, in a src folder
  2. Run shopify theme serve src
  3. Observe that all {% render %} {% include %} {% section %} tags result in a theme-check(MissingTemplate). If you try to click through, it ignores the root (in this case src) and looks directly at the default root directory.

Operating System

Windows 10

CLI version (run shopify version if you're not sure)

2.15.3

Shell

zsh

Ruby version (run ruby -v if you're not sure)

3.0.1p64

What language and version are you using in your application?

Liquid

gonzaloriestra commented 2 years ago

Hi! Sorry for the late response.

I'm not able to reproduce it, but we are investigating what could be happening.

gonzaloriestra commented 2 years ago

Could you please share a screenshot with the errors?

peepers-rick commented 2 years ago

Hi @gonzaloriestra , No problem. I've attached a screenshot. This is a template located at theme/templates/page.info.liquid. The MissingTemplate error is appearing on {% section 'info-hero' %} which definitely exists at theme/sections/info-hero.liquid. This happens for all section and snippet files. I'm running shopify theme serve theme (the 2nd theme to indicate the root of the theme is the theme folder. The error indicates 'sections/info-hero.liquid' is not found theme-check (MissingTemplate) which indicates to me it's probably looking at the default root, not the theme root I specified via shopify theme serve theme. missingtemplate

github-actions[bot] commented 2 years ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.

→ If there's no activity within a week, then a bot will automatically close this.

Thanks for helping to improve Shopify's dev tooling and experience.

peepers-rick commented 2 years ago

I'm still having this issue with the latest version of shopify-cli (currently 2.20.1)

github-actions[bot] commented 1 year ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.

→ If there's no activity within a week, then a bot will automatically close this.

Thanks for helping to improve Shopify's dev tooling and experience.

peepers-rick commented 1 year ago

I'm still having this issue with the latest version of shopify-cli (currently 2.29)

gonzaloriestra commented 1 year ago

cc @Shopify/theme-developer-tools

Poitrin commented 1 year ago

I was able to reproduce the issue. It's important to mention here that shopify theme check src does not return any MissingTemplate error (when a root is defined), but that the Shopify Liquid VS Code extension does not (can't?) take into account any root. I will come back with more info soon, thanks for creating this issue!

Poitrin commented 1 year ago

@peepers-rick – Is your issue related/the same as https://github.com/Shopify/theme-check-vscode/issues/79 ? If yes, can you…

  1. add root: src to your .theme-check.yml
  2. reload VS Code

14-00-dcrzq-5elkb

… to see whether the error disappears?

peepers-rick commented 1 year ago

@Poitrin that fixed it! Thanks! Sorry I didn't even realize I had theme check installed to be honest with you, I thought it was all through shopify-cli

Poitrin commented 1 year ago

@peepers-rick – Awesome, thanks for the quick reply! I will close the issue then. And yes, I agree, It's indeed a little confusing that "Theme Check" stands for multiple projects/tools, but my team is already aware of this :)

bakura10 commented 10 months ago

Hi,

I'm trying to migrate from PHPStorm to VS Code, but I am facing the same issue and I can't solve it.

I have created a workspace in VS Code where one folder = one theme.

Each theme has its own .theme-check.yml, and properly reference the dist folder in the root option:

image

Despite being properly set up, it constantly raise missing templates for all includes (there are, of course, in the folder):

image

How can I make this work?