Skip to content

Latest commit

 

History

History
83 lines (60 loc) · 1.28 KB

File metadata and controls

83 lines (60 loc) · 1.28 KB

inferno/require-optimization

📝 Enforce Inferno components to have a shouldComponentUpdate method.

Rule Details

Examples of incorrect code for this rule:

class YourComponent extends Inferno.Component {

}
createClass({
});

Examples of correct code for this rule:

class YourComponent extends Inferno.Component {
  shouldComponentUpdate () {
    return false;
  }
}
createClass({
  shouldComponentUpdate: function () {
    return false;
  }
});
createClass({
  mixins: [PureRenderMixin]
});
@infernoMixin.decorate(PureRenderMixin)
createClass({

});

Rule Options

...
"inferno/require-optimization": [<enabled>, { allowDecorators: [<allowDecorator>] }]
...
  • enabled: for enabling the rule. 0=off, 1=warn, 2=error. Defaults to 0.
  • allowDecorators: optional array of decorators names to allow validation.

allowDecorators

Sets the allowed names of decorators. If the variable is present in the chain of decorators, it validates

Examples of correct code for this rule:

// ['pureRender']
@pureRender
class Hello extends Inferno.Component {}

Example

...
"inferno/require-optimization": [2, {allowDecorators: ['customDecorators']}]
...