Shopify / theme-check

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

[ bug ] when `root` is specified, Custom Check rule can't be used via require option #564

Closed kilgore5 closed 2 years ago

kilgore5 commented 2 years ago

desired behavior

By nature of specifying the root option (keeping theme build separate from project root), I'd expect to be able to keep my custom rules outside of this root, so I'd need to be able to specify a path accordingly.

error replication

# ./.config/theme-check.yml

root: dist

require:
  - ../src/lib/theme-check/custom_spaces_inside_braces.rb

running shopify theme check --config .config/.theme-check.yml then raises error...

[LoadError] cannot load such file -- dist/../src/lib/theme-check/custom_spaces_inside_braces.rb (LoadError)

more traceback...

    10: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/shopify-cli-2.12.0/lib/project_types/theme/commands/check.rb:27:in `call'
     9: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/cli.rb:127:in `run'
     8: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/cli.rb:111:in `run!'
     7: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/cli.rb:111:in `new'
     6: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/config.rb:94:in `initialize'
     5: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/config.rb:211:in `resolve_requires'
     4: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/config.rb:211:in `each'
     3: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/theme-check-1.9.2/lib/theme_check/config.rb:212:in `block in resolve_requires'
     2: from /Users/johnroyall/.rvm/gems/ruby-2.7.5/gems/shopify-cli-2.12.0/bin/shopify:9:in `require'
     1: from /Users/johnroyall/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/Users/johnroyall/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- dist/../src/lib/theme-check/custom_spaces_inside_braces.rb (LoadError)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.