Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.69 KB

jsx-uses-inferno.md

File metadata and controls

56 lines (35 loc) · 1.69 KB

Disallow Inferno to be incorrectly marked as unused (inferno/jsx-uses-inferno)

🚫 This rule is disabled in the 🏃 jsx-runtime config.

💼 This rule is enabled in the following configs: all. This rule is disabled in the following configs: jsx-runtime.

Note: This rule is not part of recommended set, because babel-plugin-inferno can handle inferno import declaration by itself. Import inferno only if your code needs it.

JSX expands to a call to Inferno.createElement, a file which includes Inferno but only uses JSX should consider the Inferno variable as used.

If you are using the @jsx pragma this rule will mark the designated variable and not the Inferno one.

This rule has no effect if the no-unused-vars rule is not enabled.

You can use the shared settings to specify a custom pragma.

Rule Details

The following patterns are considered warnings:

var Inferno = require('inferno');

// nothing to do with Inferno
/** @jsx Foo */
var Inferno = require('inferno');

var Hello = <div>Hello {this.props.name}</div>;

The following patterns are not considered warnings:

var Inferno = require('inferno');

var Hello = <div>Hello {this.props.name}</div>;
/** @jsx Foo */
var Foo = require('foo');

var Hello = <div>Hello {this.props.name}</div>;

When Not To Use It

If you are not using JSX, if Inferno is declared as global variable or if you do not use the no-unused-vars rule then you can disable this rule.