DocumentationRulesuse-jsx-vars

use-jsx-vars

Full Name in eslint-plugin-react-x

react-x/use-jsx-vars

Full Name in @eslint-react/eslint-plugin

@eslint-react/use-jsx-vars

Presets

  • core
  • recommended

What it does

Helpes eslint/no-unused-vars to correctly detect variables used in JSX.

Since 0.17.0 the eslint no-unused-varss rule does not detect variables used in JSX (see details). This rule will find variables used in JSX and mark them as used. This rule only has an effect when the no-unused-vars rule is enabled.

Examples

Failing

const Hello = require("./Hello");

Passing

const Hello = require("./Hello");
 
<Hello name="John" />;

Implementation