Skip to main content
interlace
Plugin: react-featuresRules

jsx-uses-vars

Disallow variables used in JSX to be incorrectly marked as unused

Next step

jsx-uses-vars ships in eslint-plugin-react-features, with 11 of its 65 rules in the recommended preset.

Install
npm install -D eslint-plugin-react-features
eslint.config.js
import { configs } from 'eslint-plugin-react-features';

export default [configs.recommended];

Plugin pagenpmSource on GitHub

A component used only as a JSX tag is used, though no identifier expression names it. This rule is part of eslint-plugin-react-features and follows eslint-plugin-react/jsx-uses-vars in behaviour and options.

Quick Summary

AspectDetails
SeverityError (correctness)
Auto-Fix❌ No auto-fix
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForProjects with no-unused-vars on

Rule Details

The rule never reports. It marks every variable used as a JSX tag name as used, so the core no-unused-vars rule leaves import App from './App' alone when the file only has <App />. A member tag marks its leftmost name (<Foo.Bar /> uses Foo). Lowercase tags (<div />) are intrinsic elements and namespaced tags (<svg:circle />) name no binding: neither counts as a use.

Use this rule

npm install -D eslint-plugin-react-features
eslint.config.js
import reactFeatures from 'eslint-plugin-react-features';export default [  {    plugins: { 'react-features': reactFeatures },    rules: {      'react-features/jsx-uses-vars': 'error'    },  },];
npm install -D oxlint-plugin-react-features
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-react-features"],  "rules": {    "react-features/jsx-uses-vars": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-react-features'],    rules: {      'react-features/jsx-uses-vars': 'error',    },  },});

oxlint-plugin-react-features re-exports eslint-plugin-react-features/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.

Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.