Linter Idea: Check For Hard Coded Text
I need to implement a linter that checks if there is any hard coded text (instead of i18n translations or method calls in general) for a project. So I wondered whether this project is a good place for this linter to live.
Here are some examples:
.foo
| This is bad
.foo
= t('.this_is_good')
.foo
= this_is_also_ok(42)
Hey @jaimerson,
This is doable with Slim-Lint, but I think you will find edge cases where static text is indeed what you want, which will lead you to do something silly like = 'My text'.
Open to a pull request that adds a linter checking this, but we'd have it disabled by default. Thanks!
@sds Yeah, sure. There will be also some cases where it's impossible to detect whether static text is being used, like = link_to 'Untranslated text here' ..., but I think detecting the type I mentioned is a good start.
Thanks for the response!