eslint-plugin-injected-proptypes

    0.3.0 • Public • Published

    Travis Build State codecov npm

    Install

    1. Install the package:

      npm install --dev eslint-plugin-injected-proptypes

      yarn add --dev eslint-plugin-injected-proptypes

    2. Add "plugins": ["injected-proptypes"] to your eslint config file.

    Prevent missing propTypes in React components (non-injected-prop-types)

    This rule ensures that all your React components have propTypes set for all of their used properties. However, it ignores common injected properties such as those introduced by Redux's mapDispatchToProps and mapStateToProps. See eslint-plugin-react/#553 for more details.

    Rule Details

    Examples of incorrect code for this rule:

    const Foo = ({ propMissingType }) => 
        (<span>
            {propMissingType}
        </span>);

    Examples of correct code for this rule:

    const Foo = ({providedProp, injectedProp}) =>
        (<span>
            {providedProp}
            {injectedProp}
        </span>);
     
    const mapStateToProps = state => ({
        injectedProp: state.fooBar
    });
     
    Foo.propTypes = {
        providedProp: PropTypes.string.isRequired
    };
     
    export default connect(mapStateToProps)(Foo);

    Options

    Consult the documentation for the original rule here: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md

    Install

    npm i eslint-plugin-injected-proptypes

    DownloadsWeekly Downloads

    4

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    52.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • ammaraskar