Skip to content

Commit 0d0e611

Browse files
authored
feat(js_analyze): implement useReactAsyncServerFunction (#9909)
1 parent 29accb3 commit 0d0e611

20 files changed

Lines changed: 1895 additions & 2 deletions

File tree

.changeset/stale-ties-report.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Added the nursery rule [`useReactAsyncServerFunction`](https://biomejs.dev/linter/rules/use-react-async-server-function), which requires React server actions to be async.
6+
7+
**Invalid:**
8+
9+
```js
10+
function serverFunction() {
11+
'use server';
12+
// ...
13+
}
14+
```

crates/biome_analyze/src/rule.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ pub enum RuleSource<'a> {
158158
EslintReactJsx(&'a str),
159159
/// A subset of DOM rules from [eslint-react.xyz](https://eslint-react.xyz/)
160160
EslintReactDom(&'a str),
161+
/// A subset of RSC rules from [eslint-react.xyz](https://eslint-react.xyz/)
162+
EslintReactRsc(&'a str),
161163
/// Rules from [Eslint Plugin Regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
162164
EslintRegexp(&'a str),
163165
/// Rules from [Eslint Plugin Solid](https://github.com/solidjs-community/eslint-plugin-solid)
@@ -236,6 +238,7 @@ impl<'a> std::fmt::Display for RuleSource<'a> {
236238
Self::EslintReactXyz(_) => write!(f, "@eslint-react/eslint-plugin"),
237239
Self::EslintReactJsx(_) => write!(f, "eslint-plugin-react-jsx"),
238240
Self::EslintReactDom(_) => write!(f, "eslint-plugin-react-dom"),
241+
Self::EslintReactRsc(_) => write!(f, "eslint-plugin-react-rsc"),
239242
Self::EslintRegexp(_) => write!(f, "eslint-plugin-regexp"),
240243
Self::EslintSolid(_) => write!(f, "eslint-plugin-solid"),
241244
Self::EslintSonarJs(_) => write!(f, "eslint-plugin-sonarjs"),
@@ -318,6 +321,7 @@ impl<'a> RuleSource<'a> {
318321
| Self::EslintReactXyz(rule_name)
319322
| Self::EslintReactJsx(rule_name)
320323
| Self::EslintReactDom(rule_name)
324+
| Self::EslintReactRsc(rule_name)
321325
| Self::EslintRegexp(rule_name)
322326
| Self::EslintSolid(rule_name)
323327
| Self::EslintSonarJs(rule_name)
@@ -372,6 +376,7 @@ impl<'a> RuleSource<'a> {
372376
Self::EslintReactXyz(_) => "@eslint-react",
373377
Self::EslintReactJsx(_) => "react-jsx",
374378
Self::EslintReactDom(_) => "react-dom",
379+
Self::EslintReactRsc(_) => "react-rsc",
375380
Self::EslintRegexp(_) => "regexp",
376381
Self::EslintSolid(_) => "solid",
377382
Self::EslintSonarJs(_) => "sonarjs",
@@ -434,6 +439,7 @@ impl<'a> RuleSource<'a> {
434439
Self::EslintReactXyz(rule_name) => format!("https://eslint-react.xyz/docs/rules/{rule_name}"),
435440
Self::EslintReactJsx(rule_name) => format!("https://eslint-react.xyz/docs/rules/jsx-{rule_name}"),
436441
Self::EslintReactDom(rule_name) => format!("https://eslint-react.xyz/docs/rules/dom-{rule_name}"),
442+
Self::EslintReactRsc(rule_name) => format!("https://eslint-react.xyz/docs/rules/rsc-{rule_name}"),
437443
Self::EslintRegexp(rule_name) => format!("https://ota-meshi.github.io/eslint-plugin-regexp/rules/{rule_name}.html"),
438444
Self::EslintSolid(rule_name) => format!("https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/{rule_name}.md"),
439445
Self::EslintSonarJs(rule_name) => format!("https://github.com/SonarSource/eslint-plugin-sonarjs/blob/HEAD/docs/rules/{rule_name}.md"),

crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/biome_configuration/src/analyzer/linter/rules.rs

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/biome_configuration/src/generated/domain_selector.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/biome_configuration/src/generated/linter_options_check.rs

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/biome_diagnostics_categories/src/categories.rs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)