react/require-optimization
Configuration
rslint.config.ts
Enforce React components to declare a shouldComponentUpdate method (or use an equivalent optimization mechanism such as extending React.PureComponent or applying a PureRender decorator/mixin).
Rule Details
This rule prevents you from creating React components without declaring a shouldComponentUpdate method.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
allowDecorators: optional array of decorator names. When a class is decorated with one of these decorators, the rule treats it as already optimized.
allowDecorators
Examples of correct code with the option above:
The decorator name must appear as a bare identifier in the class's decorator list. Call-form decorators (@pureRender()) and member-access forms (@some.pureRender) do not match this option — only the matching @reactMixin.decorate(PureRenderMixin) shape, which is recognized independently of allowDecorators, accepts a call form.