React API names should not have typos
- REACT_API_TYPO
- Error
- Medium
- react
This rule applies when a typo exists in React API names.
In such a case, a TypeError
exception may be thrown or intended behaviors may be omitted.
Noncompliant Code Example
View with compliant examples side by sideimport React from 'react';
export default function Hello() {
const [count, setCount] = React.useStates(0); // REACT_API_TYPO alarm because 'useState' is the correct API name.
function handleClick() {
setCount(c => c + 1);
}
return (
<div onClick={handleClick}>{count}</div>
);
}
Compliant Code Example
View with noncompliant examples side by sideimport React from 'react';
export default function Hello() {
const [count, setCount] = React.useState(0);
function handleClick() {
setCount(c => c + 1);
}
return (
<div onClick={handleClick}>{count}</div>
);
}
Version
This rule was introduced in DeepScan 1.3.0-beta.