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.
npm install -D eslint-plugin-react-featuresimport { configs } from 'eslint-plugin-react-features';
export default [configs.recommended];
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
| Aspect | Details |
|---|---|
| Severity | Error (correctness) |
| Auto-Fix | ❌ No auto-fix |
| Category | React |
| ESLint MCP | ✅ Optimized for ESLint MCP integration |
| Best For | Projects 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-featuresimport 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{ "jsPlugins": ["oxlint-plugin-react-features"], "rules": { "react-features/jsx-uses-vars": "error" }}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.