Skip to content

react/jsx-no-undef Correctness

This rule is turned on by default.

What it does

Disallow undeclared variables in JSX

Why is this bad?

It is most likely a potential ReferenceError caused by a misspelling of a variable or parameter name.

Example

jsx
const A = () => <App />;
const C = <B />;

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny react/jsx-no-undef
json
{
  "rules": {
    "react/jsx-no-undef": "error"
  }
}

References

Released under the MIT License.