Перейти к содержимому

useReactAsyncServerFunction

Это содержимое пока не доступно на вашем языке.

biome.json
{
"linter": {
"rules": {
"nursery": {
"useReactAsyncServerFunction": "error"
}
}
}
}

Require functions with the “use server” directive to be async.

Require Server Functions (functions in a file with a top-level "use server" directive or functions with their own "use server" directive) to be async.

See the React documentation for more details.

<form
action={() => {
'use server';
// ...
}}
>
// ...
</form>
code-block.jsx:2:11 lint/nursery/useReactAsyncServerFunction  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This server function is missing the async keyword.

1 │ <form
> 2 │ action={() => {
^^^^^^^
> 3 │ ‘use server’;
> 4 │ // …
> 5 │ }}
^
6 │ >
7 │ // …

Functions with the “use server” directive are React Server Functions and therefore must be async.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Unsafe fix: Add async keyword.

2 │ ··action={async·()·=>·{
++++++
function serverFunction() {
'use server';
// ...
}
code-block.js:1:1 lint/nursery/useReactAsyncServerFunction  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This server function is missing the async keyword.

> 1 │ function serverFunction() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2 │ ‘use server’;
> 3 │ // …
> 4 │ }
^
5 │

Functions with the “use server” directive are React Server Functions and therefore must be async.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Unsafe fix: Add async keyword.

1 │ async·function·serverFunction()·{
++++++
'use server';
export function serverFunction() {
// ...
}
code-block.js:2:8 lint/nursery/useReactAsyncServerFunction  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This server function is missing the async keyword.

1 │ ‘use server’;
> 2 │ export function serverFunction() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 3 │ // …
> 4 │ }
^
5 │

Functions exported from files with the “use server” directive are React Server Functions and therefore must be async.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Unsafe fix: Add async keyword.

2 │ export·async·function·serverFunction()·{
++++++
<form
action={async () => {
'use server';
// ...
}}
>
// ...
</form>
async function serverFunction() {
'use server';
// ...
}
'use server';
export async function serverFunction() {
// ...
}