Skip to main content
interlace
Plugin: react-featuresRules

no-typos

no-typos rule

no-typos rule

Detect common typos in React component properties and lifecycle methods. This rule is part of eslint-plugin-react-features.

Quick Summary

AspectDetails
SeverityError (correctness)
Auto-Fix💡 Suggests corrections
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForAll React projects

Rule Details

Detects misspellings of React's class-component API in a class component (a class extending React's Component or PureComponent, by binding). React calls lifecycles and reads statics by exact name, so a misspelt one silently never runs.

Reported:

CodeWhy
ComponentDidMount(), static PropTypesReact's name in another letter case
componenDidMount(), static defaulPropsa documented dropped-letter misspelling
Card.DefaultProps = {} (Card is the class)the same, assigned after the class
static componentDidMount()React calls lifecycles on the instance
getDerivedStateFromProps() (not static)React calls it only as a static

Reading a static (Card.propTypes, PropTypes.string) is never reported, and neither is any class that is not a React component.

Examples

❌ Incorrect

class MyComponent extends React.Component {
  // Typo in lifecycle
  componentDidUpate() {}  // Should be componentDidUpdate
  componentWillUnmout() {}  // Should be componentWillUnmount
  
  // Typo in static property
  static PropTypes = {};  // Should be propTypes (lowercase p)
}

✅ Correct

class MyComponent extends React.Component {
  static propTypes = {};
  static getDerivedStateFromProps() {
    return null;
  }
  componentDidUpdate() {}
  componentWillUnmount() {}
}

Configuration Examples

Basic Usage

{
  rules: {
    'react-features/no-typos': 'error'
  }
}

Further Reading

Known False Negatives

The rule reads class components only (a class extending React's Component or PureComponent, by binding). Not detected:

  • statics assigned to a function component (Card.PropTypes = …): whether a function is a component is not decided here;
  • misspellings other than a different letter case and the listed dropped letters (componentDidMoun);
  • a class extending a Component the file never imports or declares.

Use this rule

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