💡 This rule is manually fixable by editor suggestions.
Require Server Actions (functions with the use server
directive) to be async, as mandated by the use server
spec.
This must be the case even if the function does not use await
or return
a promise.
Examples of incorrect code for this rule:
<form
action={() => {
'use server';
...
}}
>
...
</form>
function action() {
'use server';
...
}
Examples of correct code for this rule:
<form
action={async () => {
'use server';
...
}}
>
...
</form>
async function action() {
'use server';
...
}
If you are not using React Server Components.