So a linter simply without this restriction would work for my case.
The only thing between me and a PR is how to structure the configuration. Some options I came up with:
Create a new InstanceVariable linter that works for all templates and document the fact that if you enable this and PartialInstanceVariable, you may get double warnings
Create a new NonPartialInstanceVariable linter that only works on non-partials to avoid double linting if someone has both enabled
Add configuration to PartialInstanceVariable of the sort all_templates: true to make it work for all templates
Deprecate PartialInstanceVariable and create a InstanceVariable linter with a partials_only: true configuration
I'm inclined toward option 1 for simplicity, but I'm very open to whatever so I can add this linter 😄
PartialInstanceVariable
is great for partials, but I'd like to forbid instance variables in all templates.The
PartialInstanceVariable
linter implementation has this guard to restrict it to partials:https://github.com/Shopify/erb-lint/blob/c30fa2783d5a028b9c67795ab20f4d6b19280b9e/lib/erb_lint/linters/partial_instance_variable.rb#L11
So a linter simply without this restriction would work for my case.
The only thing between me and a PR is how to structure the configuration. Some options I came up with:
InstanceVariable
linter that works for all templates and document the fact that if you enable this andPartialInstanceVariable
, you may get double warningsNonPartialInstanceVariable
linter that only works on non-partials to avoid double linting if someone has both enabledPartialInstanceVariable
of the sortall_templates: true
to make it work for all templatesPartialInstanceVariable
and create aInstanceVariable
linter with apartials_only: true
configurationI'm inclined toward option 1 for simplicity, but I'm very open to whatever so I can add this linter 😄