logoESLint React
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

On this page