fresh-server-event-handlers
NOTE: this rule is part of the
fresh
rule set.Enable full set in
deno.json
:{ "lint": { "rules": { "tags": ["fresh"] } } }
Enable full set using the Deno CLI:
deno lint --rules-tags=fresh
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include
or exclude
array in deno.json
:{ "lint": { "rules": { "include": ["fresh-server-event-handlers"], "exclude": ["fresh-server-event-handlers"] } } }
Disallows event handlers in fresh server components.
Components inside the routes/
folder in a fresh app are exclusively rendered
on the server. They are not rendered in the client and setting an event handler
will have no effect.
Note that this rule only applies to server components inside the routes/
folder, not to fresh islands or any other components.
Invalid:
<button onClick={() => {}} />
<button onclick={() => {}} />
<my-custom-element foo={() => {}} />
Valid:
<button />
<my-custom-element />