mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-15 06:39:17 +00:00
fix(transform-react): match Babel diagnostic reporting (#26128)
Match Babel’s default React Compiler diagnostic reporting and severity. AI-assisted.
This commit is contained in:
48 files changed
+75
-105
No files matched your search
@@ -94,7 +94,8 @@ impl ErrorCategory {
|
||||
/// `panicThreshold: critical_errors` (see [`has_critical_errors`]).
|
||||
const fn severity(self) -> Severity {
|
||||
match self {
|
||||
Self::IncompatibleLibrary | Self::UnsupportedSyntax | Self::Todo => Severity::Warning,
|
||||
Self::IncompatibleLibrary | Self::UnsupportedSyntax => Severity::Warning,
|
||||
Self::Todo => Severity::Advice,
|
||||
_ => Severity::Error,
|
||||
}
|
||||
}
|
||||
@@ -200,11 +201,8 @@ impl ErrorCategory {
|
||||
|
||||
#[cold]
|
||||
fn diagnostic(category: ErrorCategory, reason: impl AsRef<str>) -> OxcDiagnostic {
|
||||
let diagnostic = match category.severity() {
|
||||
Severity::Error => OxcDiagnostic::error(reason.as_ref().to_string()),
|
||||
_ => OxcDiagnostic::warn(reason.as_ref().to_string()),
|
||||
};
|
||||
diagnostic
|
||||
OxcDiagnostic::error(reason.as_ref().to_string())
|
||||
.with_severity(category.severity())
|
||||
.with_error_code(ErrorCategory::CODE_SCOPE, category.as_str())
|
||||
.with_help(category.default_help())
|
||||
.with_note(category.default_note())
|
||||
|
||||
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/ecma/error.reserved-words.ts
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle ThisExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 228, end: 232 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle ThisExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 228, end: 232 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Cannot access refs during render", labels: [LabeledSpan { label: Some("Cannot access ref value during render"), span: Span { start: 264, end: 275 }, primary: true }], help: Some("React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during render can cause your component not to update as expected"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Refs") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/refs") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.bug-hir_structural_diff.js
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 402, end: 416 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 402, end: 416 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.default-param-accesses-loca
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::node.lowerReorderableExpression) Expression type `ArrowFunctionExpression` cannot be safely reordered", labels: [LabeledSpan { label: Some("`ArrowFunctionExpression` cannot be safely reordered"), span: Span { start: 31, end: 38 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::node.lowerReorderableExpression) Expression type `ArrowFunctionExpression` cannot be safely reordered", labels: [LabeledSpan { label: Some("`ArrowFunctionExpression` cannot be safely reordered"), span: Span { start: 31, end: 38 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.dont-hoist-inline-reference
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "[hoisting] EnterSSA: Expected identifier to be defined before being used", labels: [LabeledSpan { label: Some("`x$1` is used before it is defined"), span: Span { start: 67, end: 89 }, primary: true }], help: Some("Identifier x$1 is undefined"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "[hoisting] EnterSSA: Expected identifier to be defined before being used", labels: [LabeledSpan { label: Some("`x$1` is used before it is defined"), span: Span { start: 67, end: 89 }, primary: true }], help: Some("Identifier x$1 is undefined"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.hoisting-simple-function-de
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support functions with unreachable code that may contain hoisted declarations", labels: [LabeledSpan { label: None, span: Span { start: 175, end: 178 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support functions with unreachable code that may contain hoisted declarations", labels: [LabeledSpan { label: None, span: Span { start: 175, end: 178 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.mutate-global-increment-op-
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Support UpdateExpression where argument is a global", labels: [LabeledSpan { label: None, span: Span { start: 45, end: 58 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Support UpdateExpression where argument is a global", labels: [LabeledSpan { label: None, span: Span { start: 45, end: 58 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-for-await-loops.js
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle for-await loops", labels: [LabeledSpan { label: None, span: Span { start: 54, end: 65 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle for-await loops", labels: [LabeledSpan { label: None, span: Span { start: 54, end: 65 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-for-in-loop-with-conte
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..in inits", labels: [LabeledSpan { label: Some("Non-trivial for..in initializer"), span: Span { start: 259, end: 262 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..in inits", labels: [LabeledSpan { label: Some("Non-trivial for..in initializer"), span: Span { start: 259, end: 262 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-for-of-loop-with-conte
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..of inits", labels: [LabeledSpan { label: Some("Non-trivial for..of initializer"), span: Span { start: 259, end: 262 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..of inits", labels: [LabeledSpan { label: Some("Non-trivial for..of initializer"), span: Span { start: 259, end: 262 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-functiondecl-hoisting.
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "[PruneHoistedContexts] Rewrite hoisted function references", labels: [LabeledSpan { label: None, span: Span { start: 371, end: 374 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "[PruneHoistedContexts] Rewrite hoisted function references", labels: [LabeledSpan { label: None, span: Span { start: 371, end: 374 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-handle-update-context-
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas.", labels: [LabeledSpan { label: None, span: Span { start: 71, end: 80 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas.", labels: [LabeledSpan { label: None, span: Span { start: 71, end: 80 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-hir_unsupported_node_f
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle Import expressions", labels: [LabeledSpan { label: None, span: Span { start: 204, end: 210 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle Import expressions", labels: [LabeledSpan { label: None, span: Span { start: 204, end: 210 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-hoist-function-decls.j
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support functions with unreachable code that may contain hoisted declarations", labels: [LabeledSpan { label: None, span: Span { start: 51, end: 55 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support functions with unreachable code that may contain hoisted declarations", labels: [LabeledSpan { label: None, span: Span { start: 51, end: 55 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-hoisting-simple-var-de
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 187, end: 197 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 187, end: 197 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-hook-call-spreads-muta
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support spread syntax for hook arguments", labels: [LabeledSpan { label: None, span: Span { start: 147, end: 161 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support spread syntax for hook arguments", labels: [LabeledSpan { label: None, span: Span { start: 147, end: 161 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-invalid-jsx-in-catch-i
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 134, end: 137 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 257, end: 266 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 134, end: 137 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 257, end: 266 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
// @validateNoJSXInTryStatements @outputMode:"lint"
|
||||
import { identity } from "shared-runtime";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-invalid-jsx-in-try-wit
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 92, end: 95 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 119, end: 128 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 92, end: 95 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 119, end: 128 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
// @validateNoJSXInTryStatements @outputMode:"lint"
|
||||
function Component(props) {
|
||||
|
||||
@@ -4,13 +4,13 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-kitchensink.js
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 73, end: 84 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 73, end: 84 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Inline `class` declarations are not supported", labels: [LabeledSpan { label: Some("Move this class outside the component or hook"), span: Span { start: 88, end: 190 }, primary: true }], help: Some("Move class declarations outside of components/hooks"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("UnsupportedSyntax") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::node.lowerReorderableExpression) Expression type `MemberExpression` cannot be safely reordered", labels: [LabeledSpan { label: Some("`MemberExpression` cannot be safely reordered"), span: Span { start: 858, end: 861 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::node.lowerReorderableExpression) Expression type `BinaryExpression` cannot be safely reordered", labels: [LabeledSpan { label: Some("`BinaryExpression` cannot be safely reordered"), span: Span { start: 810, end: 815 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::node.lowerReorderableExpression) Expression type `MemberExpression` cannot be safely reordered", labels: [LabeledSpan { label: Some("`MemberExpression` cannot be safely reordered"), span: Span { start: 858, end: 861 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::node.lowerReorderableExpression) Expression type `BinaryExpression` cannot be safely reordered", labels: [LabeledSpan { label: Some("`BinaryExpression` cannot be safely reordered"), span: Span { start: 810, end: 815 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Cannot reassign variables declared outside of the component/hook", labels: [LabeledSpan { label: Some("`v` cannot be reassigned"), span: Span { start: 571, end: 572 }, primary: true }], help: Some("Variable `v` is declared outside of the component/hook. Reassigning this value during render is a side effect which can cause unpredictable behavior. If this variable is used in rendering, use useState instead. Otherwise, update it in an effect"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Globals") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/globals") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Cannot reassign variables declared outside of the component/hook", labels: [LabeledSpan { label: Some("`v` cannot be reassigned"), span: Span { start: 603, end: 604 }, primary: true }], help: Some("Variable `v` is declared outside of the component/hook. Reassigning this value during render is a side effect which can cause unpredictable behavior. If this variable is used in rendering, use useState instead. Otherwise, update it in an effect"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Globals") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/globals") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..of inits", labels: [LabeledSpan { label: None, span: Span { start: 565, end: 568 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..of inits", labels: [LabeledSpan { label: None, span: Span { start: 597, end: 600 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..of inits", labels: [LabeledSpan { label: None, span: Span { start: 565, end: 568 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support non-trivial for..of inits", labels: [LabeledSpan { label: None, span: Span { start: 597, end: 600 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-new-target-meta-proper
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle MetaProperty expressions other than import.meta", labels: [LabeledSpan { label: None, span: Span { start: 73, end: 83 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle MetaProperty expressions other than import.meta", labels: [LabeledSpan { label: None, span: Span { start: 73, end: 83 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-object-expression-get-
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle get functions in ObjectExpression", labels: [LabeledSpan { label: Some("Unsupported get function"), span: Span { start: 53, end: 56 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle get functions in ObjectExpression", labels: [LabeledSpan { label: Some("Unsupported get function"), span: Span { start: 53, end: 56 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-object-expression-set-
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle set functions in ObjectExpression", labels: [LabeledSpan { label: Some("Unsupported set function"), span: Span { start: 64, end: 67 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle set functions in ObjectExpression", labels: [LabeledSpan { label: Some("Unsupported set function"), span: Span { start: 64, end: 67 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-round2_identifier_diff
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle ClassExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 368, end: 381 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle ClassExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 368, end: 381 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-try-catch-finally.js
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause", labels: [LabeledSpan { label: None, span: Span { start: 97, end: 106 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause", labels: [LabeledSpan { label: None, span: Span { start: 97, end: 106 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
// @outputMode:"lint"
|
||||
function Component() {
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo-valid-functiondecl-hoi
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "[PruneHoistedContexts] Rewrite hoisted function references", labels: [LabeledSpan { label: None, span: Span { start: 369, end: 372 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "[PruneHoistedContexts] Rewrite hoisted function references", labels: [LabeledSpan { label: None, span: Span { start: 369, end: 372 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.todo.try-catch-with-throw.j
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch", labels: [LabeledSpan { label: None, span: Span { start: 49, end: 58 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch", labels: [LabeledSpan { label: None, span: Span { start: 49, end: 58 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.typescript-this-param-in-co
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle ThisExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 247, end: 251 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle ThisExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 247, end: 251 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/error.useMemo-callback-generator.
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle YieldExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 225, end: 232 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle YieldExpression expressions", labels: [LabeledSpan { label: None, span: Span { start: 225, end: 232 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "useMemo() callbacks may not be async or generator functions", labels: [LabeledSpan { label: Some("Async and generator functions are not supported"), span: Span { start: 206, end: 220 }, primary: true }], help: Some("useMemo() callbacks are called once and must synchronously return a value"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("UseMemo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/use-memo") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/error.validate-blocklisted-import
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Import from a blocklisted module", labels: [LabeledSpan { label: Some("`DangerousImport` is blocklisted"), span: Span { start: 69, end: 86 }, primary: true }], help: Some("Remove the import from blocklisted module `DangerousImport`"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Import from a blocklisted module", labels: [LabeledSpan { label: Some("`DangerousImport` is blocklisted"), span: Span { start: 69, end: 86 }, primary: true }], help: Some("Remove the import from blocklisted module `DangerousImport`"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/fault-tolerance/error.try-finally
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 281, end: 284 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 304, end: 313 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 281, end: 284 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 304, end: 313 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "This value cannot be modified", labels: [LabeledSpan { label: Some("value cannot be modified"), span: Span { start: 373, end: 378 }, primary: true }], help: Some("Do not mutate component props or hook arguments. If the value should change, update it where it is owned and pass an update callback, or use local state"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Immutability") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/immutability") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/fault-tolerance/error.try-finally
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 347, end: 350 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 375, end: 384 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 347, end: 350 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 375, end: 384 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Cannot access refs during render", labels: [LabeledSpan { label: Some("Cannot access ref value during render"), span: Span { start: 460, end: 471 }, primary: true }], help: Some("React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during render can cause your component not to update as expected"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Refs") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/refs") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/fault-tolerance/error.try-finally
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 421, end: 424 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 444, end: 453 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "`try`/`finally` without `catch` is not supported by React Compiler", labels: [LabeledSpan { label: Some("Unsupported `try` starts here"), span: Span { start: 421, end: 424 }, primary: true }, LabeledSpan { label: Some("This `finally` clause requires unsupported control flow"), span: Span { start: 444, end: 453 }, primary: false }], help: Some("React Compiler cannot analyze this control flow. Refactor the cleanup to avoid `finally`, or suppress this warning if this function should remain uncompiled"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "This value cannot be modified", labels: [LabeledSpan { label: Some("value cannot be modified"), span: Span { start: 579, end: 584 }, primary: true }], help: Some("Do not mutate component props or hook arguments. If the value should change, update it where it is owned and pass an update callback, or use local state"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Immutability") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/immutability") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Cannot access refs during render", labels: [LabeledSpan { label: Some("Cannot access ref value during render"), span: Span { start: 529, end: 540 }, primary: true }], help: Some("React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during render can cause your component not to update as expected"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Refs") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/refs") } }
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/fault-tolerance/error.var-declara
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 310, end: 334 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 310, end: 334 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "This value cannot be modified", labels: [LabeledSpan { label: Some("value cannot be modified"), span: Span { start: 400, end: 405 }, primary: true }], help: Some("Do not mutate component props or hook arguments. If the value should change, update it where it is owned and pass an update callback, or use local state"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Immutability") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/immutability") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/fault-tolerance/error.var-declara
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 376, end: 398 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration", labels: [LabeledSpan { label: None, span: Span { start: 376, end: 398 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Cannot access refs during render", labels: [LabeledSpan { label: Some("Cannot access ref value during render"), span: Span { start: 454, end: 465 }, primary: true }], help: Some("React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during render can cause your component not to update as expected"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Refs") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/refs") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,9 +4,9 @@ input_file: crates/oxc_react_compiler/fixtures/fbt/error.todo-fbt-as-local.js
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 525, end: 528 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 525, end: 528 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 525, end: 528 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 665, end: 668 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 525, end: 528 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 525, end: 528 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 525, end: 528 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 665, end: 668 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/fbt/error.todo-fbt-plural-in-expr
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support duplicate fbt tags", labels: [LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 96, end: 106 }, primary: true }, LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 292, end: 302 }, primary: false }], help: Some("Support `<fbt>` tags with multiple `<fbt:plural>` values"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support duplicate fbt tags", labels: [LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 96, end: 106 }, primary: true }, LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 292, end: 302 }, primary: false }], help: Some("Support `<fbt>` tags with multiple `<fbt:plural>` values"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
+1
-1
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/fbt/error.todo-fbt-unknown-enum-v
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support duplicate fbt tags", labels: [LabeledSpan { label: Some("Multiple `<fbt:enum>` tags found"), span: Span { start: 100, end: 108 }, primary: true }, LabeledSpan { label: Some("Multiple `<fbt:enum>` tags found"), span: Span { start: 170, end: 178 }, primary: false }], help: Some("Support `<fbt>` tags with multiple `<fbt:enum>` values"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support duplicate fbt tags", labels: [LabeledSpan { label: Some("Multiple `<fbt:enum>` tags found"), span: Span { start: 100, end: 108 }, primary: true }, LabeledSpan { label: Some("Multiple `<fbt:enum>` tags found"), span: Span { start: 170, end: 178 }, primary: false }], help: Some("Support `<fbt>` tags with multiple `<fbt:enum>` values"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/fbt/error.todo-locally-require-fb
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 36, end: 39 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support local variables named `fbt`", labels: [LabeledSpan { label: Some("Local variables named `fbt` are not supported"), span: Span { start: 36, end: 39 }, primary: true }], help: Some("Local variables named `fbt` may conflict with the fbt plugin and are not yet supported"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/fbt/error.todo-multiple-fbt-plura
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support duplicate fbt tags", labels: [LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 1311, end: 1321 }, primary: true }, LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 1442, end: 1452 }, primary: false }], help: Some("Support `<fbt>` tags with multiple `<fbt:plural>` values"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support duplicate fbt tags", labels: [LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 1311, end: 1321 }, primary: true }, LabeledSpan { label: Some("Multiple `<fbt:plural>` tags found"), span: Span { start: 1442, end: 1452 }, primary: false }], help: Some("Support `<fbt>` tags with multiple `<fbt:plural>` values"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/import-as-local.tsx
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Support UpdateExpression where argument is a global", labels: [LabeledSpan { label: None, span: Span { start: 180, end: 184 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Support UpdateExpression where argument is a global", labels: [LabeledSpan { label: None, span: Span { start: 180, end: 184 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { useEffect, useRef, experimental_useEffectEvent as useEffectEvent } from "react";
|
||||
|
||||
@@ -4,7 +4,7 @@ input_file: crates/oxc_react_compiler/fixtures/repro-retain-source-when-bailout.
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support functions with unreachable code that may contain hoisted declarations", labels: [LabeledSpan { label: None, span: Span { start: 186, end: 189 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "Support functions with unreachable code that may contain hoisted declarations", labels: [LabeledSpan { label: None, span: Span { start: 186, end: 189 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "This value cannot be modified", labels: [LabeledSpan { label: Some("value cannot be modified"), span: Span { start: 116, end: 121 }, primary: true }], help: Some("Do not mutate component props or hook arguments. If the value should change, update it where it is owned and pass an update callback, or use local state"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Error, code: OxcCode { scope: Some("react-compiler"), number: Some("Immutability") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/immutability") } }
|
||||
|
||||
// @panicThreshold:"none"
|
||||
|
||||
@@ -4,6 +4,6 @@ input_file: crates/oxc_react_compiler/fixtures/typescript-captured-update-target
|
||||
---
|
||||
Diagnostics:
|
||||
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas.", labels: [LabeledSpan { label: None, span: Span { start: 71, end: 90 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Warning, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
OxcDiagnostic { inner: OxcDiagnosticInner { message: "(BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas.", labels: [LabeledSpan { label: None, span: Span { start: 71, end: 90 }, primary: true }], help: Some("Rewrite the highlighted code using syntax supported by React Compiler"), note: Some("React Compiler skipped optimizing this component or hook"), severity: Advice, code: OxcCode { scope: Some("react-compiler"), number: Some("Todo") }, url: Some("https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax") } }
|
||||
|
||||
No changes.
|
||||
@@ -4,7 +4,7 @@ use cow_utils::CowUtils;
|
||||
use oxc_allocator::Allocator;
|
||||
use oxc_ast::ast::{ModuleExportName, Program, Statement};
|
||||
use oxc_codegen::Codegen;
|
||||
use oxc_diagnostics::Diagnostics;
|
||||
use oxc_diagnostics::{Diagnostics, Severity};
|
||||
use oxc_parser::Parser;
|
||||
use oxc_semantic::SemanticBuilder;
|
||||
use oxc_span::SourceType;
|
||||
@@ -632,20 +632,12 @@ fn diagnostics_preserve_compiler_severity() {
|
||||
result.diagnostics
|
||||
);
|
||||
|
||||
// A local named `fbt` is an unsupported-syntax bail-out — a warning, not an error.
|
||||
// A Todo bail-out is advice.
|
||||
let source = "function Component() {\n const fbt = \"span\";\n return <fbt desc=\"label\">Hello</fbt>;\n}\n";
|
||||
let allocator = Allocator::default();
|
||||
let (_program, result) = transform_source(source, SourceType::tsx(), &allocator, options());
|
||||
assert!(
|
||||
result.diagnostics.has_warnings(),
|
||||
"fbt bail-out should be reported as a warning: {:?}",
|
||||
result.diagnostics
|
||||
);
|
||||
assert!(
|
||||
!result.diagnostics.has_errors(),
|
||||
"fbt warning must not be reported as an error: {:?}",
|
||||
result.diagnostics
|
||||
);
|
||||
assert_eq!(result.diagnostics.len(), 1);
|
||||
assert_eq!(result.diagnostics[0].severity, Severity::Advice);
|
||||
}
|
||||
|
||||
/// A warning-level function bail-out must not be promoted to a fatal error:
|
||||
|
||||
@@ -59,9 +59,9 @@ The asynchronous `transform` runs on a worker-pool thread. It is useful when
|
||||
processing files concurrently, but can be slower for a single small file.
|
||||
|
||||
`TransformResult` contains `code`, an optional source `map`, `errors`, and a
|
||||
`fatal` flag. Recoverable React Compiler bail-outs appear in `errors` as
|
||||
warnings while still producing code, so use `fatal` to determine whether the
|
||||
output is usable.
|
||||
`fatal` flag. Recoverable React Compiler bail-outs are omitted in every output
|
||||
mode, matching Babel's default `logger: null`. Fatal diagnostics appear in
|
||||
`errors` without producing code.
|
||||
|
||||
## Options
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -323,7 +323,7 @@ export interface TransformResult {
|
||||
code: string
|
||||
/** Source map, populated when `sourcemap` is `true`. */
|
||||
map?: SourceMap
|
||||
/** Parse, semantic, React Compiler, and downstream transform diagnostics. */
|
||||
/** Parse, semantic, downstream transform, and fatal React Compiler diagnostics. */
|
||||
errors: Array<OxcError>
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use napi_derive::napi;
|
||||
use oxc::{
|
||||
allocator::Allocator,
|
||||
codegen::{Codegen, CodegenOptions},
|
||||
diagnostics::{Diagnostics, Severity},
|
||||
diagnostics::Diagnostics,
|
||||
parser::Parser,
|
||||
semantic::{SemanticBuilder, SemanticBuilderReturn},
|
||||
transformer::Transformer,
|
||||
@@ -50,7 +50,7 @@ pub struct TransformResult {
|
||||
/// Source map, populated when `sourcemap` is `true`.
|
||||
pub map: Option<SourceMap>,
|
||||
|
||||
/// Parse, semantic, React Compiler, and downstream transform diagnostics.
|
||||
/// Parse, semantic, downstream transform, and fatal React Compiler diagnostics.
|
||||
pub errors: Vec<OxcError>,
|
||||
}
|
||||
|
||||
@@ -98,24 +98,17 @@ fn transform_impl(
|
||||
return error_result(filename, source_text, diagnostics);
|
||||
}
|
||||
|
||||
let (react_output, mut react_diagnostics, react_fatal) = match react_compiler_options {
|
||||
None => (None, Diagnostics::new(), false),
|
||||
let react_output = match react_compiler_options {
|
||||
None => None,
|
||||
Some(options) => match react_compiler_compile(&program, &semantic, &allocator, options) {
|
||||
CompileResult::Success { output, diagnostics } => (output, diagnostics, false),
|
||||
CompileResult::Fatal { diagnostics } => (None, diagnostics, true),
|
||||
// Match Babel's default `logger: null` by omitting recoverable diagnostics.
|
||||
CompileResult::Success { output, .. } => output,
|
||||
CompileResult::Fatal { diagnostics: react_diagnostics } => {
|
||||
diagnostics.extend(react_diagnostics);
|
||||
return error_result(filename, source_text, diagnostics);
|
||||
}
|
||||
},
|
||||
};
|
||||
if !react_fatal {
|
||||
for diagnostic in react_diagnostics.iter_mut() {
|
||||
if diagnostic.severity == Severity::Error {
|
||||
diagnostic.severity = Severity::Warning;
|
||||
}
|
||||
}
|
||||
}
|
||||
diagnostics.extend(react_diagnostics);
|
||||
if react_fatal {
|
||||
return error_result(filename, source_text, diagnostics);
|
||||
}
|
||||
|
||||
let mut scoping = semantic.into_scoping();
|
||||
if let Some(output) = react_output {
|
||||
|
||||
@@ -227,11 +227,7 @@ export function Component({ value }: { value: string }) {
|
||||
);
|
||||
|
||||
expect(result.fatal).toBe(false);
|
||||
expect(result.errors).toHaveLength(1);
|
||||
expect(result.errors[0]).toMatchObject({
|
||||
severity: "Warning",
|
||||
message: "React rule suppression prevents optimization",
|
||||
});
|
||||
expect(result.errors).toEqual([]);
|
||||
expect(result.code).not.toContain("react/compiler-runtime");
|
||||
expect(result.code).not.toContain("_c(");
|
||||
});
|
||||
@@ -247,9 +243,7 @@ export function Component({ value }: { value: string }) {
|
||||
);
|
||||
|
||||
expect(result.fatal).toBe(false);
|
||||
expect(result.errors).toHaveLength(1);
|
||||
expect(result.errors[0].severity).toBe("Warning");
|
||||
expect(result.errors[0].message).toBe("React rule suppression prevents optimization");
|
||||
expect(result.errors).toEqual([]);
|
||||
expect(result.code).not.toContain("react/compiler-runtime");
|
||||
});
|
||||
|
||||
@@ -290,12 +284,7 @@ export function Component({ value }: { value: string }) {
|
||||
);
|
||||
|
||||
expect(result.fatal).toBe(false);
|
||||
expect(result.errors).toHaveLength(1);
|
||||
expect(result.errors[0]).toMatchObject({
|
||||
severity: "Warning",
|
||||
message: "Use of incompatible library",
|
||||
});
|
||||
expect(result.errors.some((error) => error.message.includes("Unexpected error"))).toBe(false);
|
||||
expect(result.errors).toEqual([]);
|
||||
expect(result.code).toContain("react/compiler-runtime");
|
||||
expect(result.code).not.toContain("props: { text: string }");
|
||||
expect(result.code).not.toContain("<span");
|
||||
@@ -333,9 +322,7 @@ export function Component({ value }: { value: string }) {
|
||||
);
|
||||
|
||||
expect(result.fatal).toBe(false);
|
||||
expect(result.errors).toHaveLength(1);
|
||||
expect(result.errors[0].severity).toBe("Warning");
|
||||
expect(result.errors[0].message).toBe("React rule suppression prevents optimization");
|
||||
expect(result.errors).toEqual([]);
|
||||
expect(result.code).toContain("react/compiler-runtime");
|
||||
expect(result.code).not.toContain("props: { text: string }");
|
||||
expect(result.code).not.toContain("<span");
|
||||
|
||||
@@ -323,7 +323,7 @@ export interface TransformResult {
|
||||
code: string
|
||||
/** Source map, populated when `sourcemap` is `true`. */
|
||||
map?: SourceMap
|
||||
/** Parse, semantic, React Compiler, and downstream transform diagnostics. */
|
||||
/** Parse, semantic, downstream transform, and fatal React Compiler diagnostics. */
|
||||
errors: Array<OxcError>
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user