Skip to main content
interlace
Plugin: react-featuresRules

no-unknown-property

no-unknown-property rule

Prevent unknown DOM properties in JSX. This rule is part of eslint-plugin-react-features.

Quick Summary

AspectDetails
SeverityError (correctness)
Auto-Fix✅ Yes (converts to correct prop)
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForAll React/JSX projects

Rule Details

React uses camelCase for DOM attributes and has some renamed attributes (e.g., className instead of class).

Common Corrections

HTML AttributeJSX Property
classclassName
forhtmlFor
tabindextabIndex
colspancolSpan
rowspanrowSpan
readonlyreadOnly
maxlengthmaxLength
cellpaddingcellPadding
cellspacingcellSpacing
frameborderframeBorder

Examples

❌ Incorrect

<div class="container">Content</div>
<label for="input">Label</label>
<input tabindex="1" readonly />
<table cellpadding="5" cellspacing="0"></table>

✅ Correct

<div className="container">Content</div>
<label htmlFor="input">Label</label>
<input tabIndex={1} readOnly />
<table cellPadding={5} cellSpacing={0}></table>

Configuration Examples

Basic Usage

{
  rules: {
    'react-features/no-unknown-property': 'error'
  }
}

Further Reading

Known False Negatives

  • An attribute name React does not know at all (<div foo="x">) is not reported unless it is the HTML spelling of a React property: React 16+ passes unknown attributes through to the DOM.
  • Namespaced names (xlink:href) are not checked.
  • Components and custom elements (<my-widget>) take any prop and are never checked.

Use this rule

npm install -D oxlint-plugin-react-features
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-react-features"],  "rules": {    "react-features/no-unknown-property": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-react-features'],    rules: {      'react-features/no-unknown-property': '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.