Actual behaviour
Checks are being run twice (once per time included in the require array, plus once for being auto discovered)
With --auto-correct flag
Debugging information
OS: macOS
OS Version: Sonoma 14.4
Theme Check Version: 2.2.2 & 2.4.0
Theme CLI Version: 3.58.0
I've included the Theme CLI version here because I first discovered the issue when testing Theme Check via the Theme CLI. I've since installed @shopify/theme-check-node and encountered the same issue.
I may have just missed it, but auto discovery of plugins doesn't seem to be documented. It definitely seems worth shouting about as a handy feature, especially as it encourages people to following the naming convention for their packages.
Describe the bug Plugins can be applied more than once. This produces duplicate offences in Theme Check and prevents auto fixes from being applied.
This issue is avoidable by removing the
require
key from the config, but may cause issues if users are extending multiple configs.Source
Expected behaviour Checks should only be run once
Actual behaviour Checks are being run twice (once per time included in the
require
array, plus once for being auto discovered)With
--auto-correct
flagDebugging information
I've included the Theme CLI version here because I first discovered the issue when testing Theme Check via the Theme CLI. I've since installed
@shopify/theme-check-node
and encountered the same issue.Additional context I discovered this during testing because I was unaware third party checks (for example packages in node modules beginning
theme-check-
) are auto discovered and was using therequire
config option.I may have just missed it, but auto discovery of plugins doesn't seem to be documented. It definitely seems worth shouting about as a handy feature, especially as it encourages people to following the naming convention for their packages.
Replication Steps
feature/build
branchpnpm tsup
to build so it can be imported into a projectpnpm install ../path/to/repo
if using pnpm)shopify theme check
and note duplicate error reportsshopify theme check --auto-correct
and note an error because of overlapping fix rangesnode ./check.js
and note duplicate offenses in the output