-
-
Notifications
You must be signed in to change notification settings - Fork 73
Linter: Implement html-turbo-permanent linter rule alongside turbo-lint package
#677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hey @CuddlyBunion341, thanks for working this pull request! While this is a great rule, I wonder if this should be reserved for a potential That said, we also have to think about how we deal with Rails and ActionView-specific rules, like #480. So I wonder if it would make more sense if we have some kind of "built-in plugins" or "set of plugins", like |
html-turbo-permanent linter rule
Thanks for the suggestion regarding the I'd expect a PR that implements just the boilerplate of the turbo package, which I could merge my rules into. |
|
With the project specific rule activation I can see some problems. We would need to cover Gemfiles, Plugingemfiles, environments.. I think for now the easiest approach would be to enable all plugins by default (providing the best experience for RoR) and enable users to deactivate certain plugins. |
html-turbo-permanent linter rulehtml-turbo-permanent linter rule alongside turbo-lint package
|
I have created a new package I'd love to hear your thoughts regarding the namespacing and the boilerplate. |
|
Thanks for exploring this, @CuddlyBunion341. I checked, and sadly we cannot have the But then I was wondering if we should even have its own package/linter CLI. I'm more and more leaning towards migrating linter:
plugins:
- herb-plugin-stimulusAnd then just let it run as part of the regular As there are quite a lot of moving pieces right now, I'd like to push this back a bit after Herb v0.8.0, thank you! |
Summary
Add a new linter rule
html-turbo-permanentto validate correct usage of thedata-turbo-permanentboolean attribute in HTML files.Context
In HTML, boolean attributes are considered true when present, regardless of their assigned value.
The following examples are functionally identical:
This makes
data-turbo-permanent="false"misleading since it behaves as if the attribute were true.The new rule prevents such confusion by flagging
data-turbo-permanent="false"as an error.Rule Behavior
Allowed
Disallowed
Rationale
data-turbo-permanentmarks elements that persist across Turbo Drive navigations.Explicitly setting the value to
"false"does not disable this behavior and introduces ambiguity.This rule enforces clear, unambiguous use of the attribute.
References