Shopify / erb-lint

Lint your ERB or HTML files
MIT License
592 stars 113 forks source link

Allow way to inherit ERBLint configs from other gems #317

Open khiga8 opened 1 year ago

khiga8 commented 1 year ago

The same way that Rubocop supports inheriting configs from a gem, it would be nice if ERBLint supported inheriting ERBLint configs from a gem.

khiga8 commented 1 year ago

I noticed there is actually existing code in runner_config_resolver that actually allow us to inherit erb-lint configs from other gems.

Based on the example shown in the README, I thought inherit_gem only works for inheriting Rubocop configs , but this seems to work too:

---
EnableDefaultLinters: true
inherit_gem:
  custom-erblint-gem: config/default.yml

This is a setup where my dependency gem, "custom-erblint-gem" has a yml config in the path config/default.yml. It looks like the resulting config is what we want, with the configs in config/default.yml deep merged.

However, linter_registry.rb only has access to rules included in the custom directory .erb-linters. I think we'd want it to automatically pull in ERB lint rules that are defined in the gem specified in inherit_gem.