67919e4 Jul 28, 2016
45 lines (30 sloc) 1.09 KB

Forbid certain props on Components (forbid-component-props)

By default this rule prevents passing of props that add lots of complexity (className, style) to Components. This rule only applies to Components (e.g. <Foo />) and not DOM nodes (e.g. <div />). The list of forbidden props can be customized with the forbid option.

Rule Details

This rule checks all JSX elements and verifies that no forbidden props are used on Components. This rule is off by default.

The following patterns are considered warnings:

<Hello className='foo' />
<Hello style={{color: 'red'}} />

The following patterns are not considered warnings:

<Hello name='Joe' />
<div className='foo' />
<div style={{color: 'red'}} />

Rule Options

"forbid-component-props": [<enabled>, { "forbid": [<string>] }]


An array of strings, with the names of props that are forbidden. The default value of this option is ['className', 'style'].