Skip to content

Linter Rule: Validate the herb:slots mode ​

Rule: herb-slots-valid-mode

Description ​

Requires the herb:slots directive to name at most one mode, spelled client or server.

Rationale ​

The engine reads the directive's option with a permissive match and falls back to server when nothing matches. A misspelled mode like clien therefore compiles without complaint, every slot renders on the server, and the client features the author asked for never activate, with no error anywhere. The same silence covers a directive naming two modes, where the first recognized one wins.

Examples ​

✅ Good ​

erb
<%# herb:slots client %>

<div><%= @name %></div>
erb
<%# herb:slots %>

<div><%= @name %></div>

🚫 Bad ​

erb
<%# herb:slots clien %>
`herb:slots clien` does not name a single mode, and the engine silently resolves it to `server`. Write `<%# herb:slots client %>` or `<%# herb:slots server %>`. (herb-slots-valid-mode)
<div><%= @name %></div>
erb
<%# herb:slots client server %>
`herb:slots client server` does not name a single mode, and the engine silently resolves it to `client`. Write `<%# herb:slots client %>` or `<%# herb:slots server %>`. (herb-slots-valid-mode)
<div><%= @name %></div>

References ​

-

Released under the MIT License.