Skip to content

Commit

Permalink
aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
camc314 committed Oct 21, 2023
1 parent 5de1b2c commit 4010328
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/react/react_in_jsx_scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use oxc_span::Span;
use crate::{context::LintContext, rule::Rule, AstNode};

#[derive(Debug, Error, Diagnostic)]
#[error("'React' must be in scope when using JSX")]
#[error("eslint-plugin-react(react-in-jsx-scope): 'React' must be in scope when using JSX")]
#[diagnostic(severity(warning), help("When using JSX, `<a />` expands to `React.createElement(\"a\")`. Therefore the `React` variable must be in scope."))]
struct ReactInJsxScopeDiagnostic(#[label] pub Span);

Expand Down
40 changes: 40 additions & 0 deletions crates/oxc_linter/src/snapshots/react_in_jsx_scope.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
source: crates/oxc_linter/src/tester.rs
expression: react_in_jsx_scope
---
eslint-plugin-react(react-in-jsx-scope): 'React' must be in scope when using JSX
╭─[react_in_jsx_scope.tsx:1:1]
1var App, a = <App />;
· ───────
╰────
help: When using JSX, `<a />` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope.

eslint-plugin-react(react-in-jsx-scope): 'React' must be in scope when using JSX
╭─[react_in_jsx_scope.tsx:1:1]
1var a = <App />;
· ───────
╰────
help: When using JSX, `<a />` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope.

eslint-plugin-react(react-in-jsx-scope): 'React' must be in scope when using JSX
╭─[react_in_jsx_scope.tsx:1:1]
1var a = <img />;
· ───────
╰────
help: When using JSX, `<a />` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope.

eslint-plugin-react(react-in-jsx-scope): 'React' must be in scope when using JSX
╭─[react_in_jsx_scope.tsx:1:1]
1var a = <>fragment</>;
· ─────────────
╰────
help: When using JSX, `<a />` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope.

eslint-plugin-react(react-in-jsx-scope): 'React' must be in scope when using JSX
╭─[react_in_jsx_scope.tsx:1:1]
1var Foo, a = <img />;
· ───────
╰────
help: When using JSX, `<a />` expands to `React.createElement("a")`. Therefore the `React` variable must be in scope.


0 comments on commit 4010328

Please sign in to comment.