Open Benecke opened 2 years ago
Yes, I have same issue
Have you tried
ignore:
- src/*
?
I think I did. To be sure I just validated this again.
/src/sections/components/cart-infos/schema_end.liquid
Edit:
I also tried
ignore:
- src/**/*
Oh I think I'm seeing what's happening. I think that root
and ignore
are concatenated. So you end up in a place where it's actually ignoring theme/src
and not src
.
Thanks for the detailed report!
In the meantime, I think you can add a .theme-check.yml
in the src
folder and the plugin will prefer this one over the other.
You could put one that extends: nothing and it should effectively do the same as ignore
.
# src/.theme-check.yml
root: .
extends: :nothing
Hm, not sure if that'd help. Wouldn't that check the /src
folder? I need to check /theme
.
src
and theme
directorytheme
folder won't work at all (no check runs)Note that I tried it with:
extends: nothing
(...you had a double colon there I suppose)
The idea is the following:
extends: nothing
(the colon should be irrelevant, it looks like we handle that)So that when you open a file in src
, the VS Code plugin will think that the root config is the one in $projectRoot/src
and won't check your files.
Because the language server actually looks "upward" from the file you have open to find a .theme-check.yml file.
In other words, if you open src/theme/layout.liquid
, the language server will look for a config file in the following order:
$projectRoot/src/theme/.theme-check.yml
$projectRoot/src/.theme-check.yml
$projectRoot/.theme-check.yml
If it doesn't find one, it'll pick the default config.
What happens in your case, I assume, is that it goes:
$projectRoot/src/theme/.theme-check.yml
❌ $projectRoot/src/.theme-check.yml
❌ $projectRoot/.theme-check.yml
✅ But the ignore
doesn't ignore the file in src
since it ignore theme/src
because of path.join(root, ignore)
That being said the language server will pick the config for the first file that it finds. So if you did open a file in /theme, it might pick up $projectRoot/.theme-check.yml
...
Ugh appologies if this is needlessly complicated 😓
No need to apologize, thanks for the work your put into this.
So I tested again and now I added src/.theme-check.yml
with this:
root: .
extends: nothing
This is what happens now:
When I open: src/layout/theme.liquid
the check is run and now no problems from this file are reported (good!).
However, unlike before, also the dist file theme/layout/theme.liquid
is not reported anymore. When I manually open theme/layout/theme.liquid
, the errors of this file are reported.
😅
What if... we backtrack and ignore ../src
at the root config instead (and delete src/.theme-check.yml
)? I suspect it will simply not run checks at all but we could be surprised :D
~~Sorry for being a bit off-topic. Please add an ignore:
example to the documentation:
https://shopify.dev/themes/tools/theme-check/configuration~~
I had to dig until I found this Issue to understand how to use it. 🥲
edit: damn, now that I went to it again I see you already included an ignore example inside the ThemeCheck: section, Sorry! 😅
Ignoring files is not really possible, errors still popup in the problems tab in VS.
My
.theme-check.yml
I also tested
"themeCheck.checkOnOpen": false
on my VS config. Still, saved files from thesrc
directory are then checked and reported in the problems tab (both on full and on partial theme check).