Rules
jsx-uses-vars
Full Name in eslint-plugin-react-x
react-x/jsx-uses-vars
Full Name in @eslint-react/eslint-plugin
@eslint-react/jsx-uses-vars
Presets
x
recommended
Description
Marks variables used in JSX elements as used.
Since 0.17.0 the eslint no-unused-vars
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
import Hello from "./Hello";
Passing
import Hello from "./Hello";
<Hello name="John" />;
Implementation
See Also
jsx-no-undef
Prevents using variables in JSX that are not defined in the scope.jsx-uses-react
Marks React variables as used when JSX is used.jsx-no-duplicated-props
Disallow duplicate props in JSX elements.