no-deprecated
Configuration
rslint.config.ts
Rule Details
Several methods are deprecated between React versions. This rule warns about usage of methods that have been deprecated in the React version configured via settings.react.version. When no version is configured, the rule treats the project as "latest" and flags every known deprecation.
The rule detects deprecated APIs through member access, named imports, destructuring from require() / module bindings, and lifecycle methods declared inside React components (ES5 createReactClass objects and ES6 classes extending Component / PureComponent).
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Settings
This rule is influenced by the shared React settings:
settings.react.version— determines which deprecations are active (default: latest).settings.react.pragma— theReactobject name used for<pragma>.Xdeprecations (default:"React"). An inline@jsxcomment overrides this setting for the file.
Differences from ESLint
rslint flags these forms; ESLint does not:
(React).createClassand any other parenthesized wrap around the receiver.React?.createClass()and optional-chain forms likeReact?.addons?.TestUtils.