react/react-in-jsx-scope Suspicious
What it does
Disallow missing React when using JSX
Why is this bad?
When using JSX, <a />
expands to React.createElement("a")
. Therefore the React
variable must be in scope.
Example
Examples of incorrect code for this rule:
jsx
var a = <a />;
Examples of correct code for this rule:
jsx
import React from "react";
var a = <a />;
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny react/react-in-jsx-scope
json
{
"rules": {
"react/react-in-jsx-scope": "error"
}
}