Skip to content

no-unused-props unable to handle inline functions #1309

Closed
@Robinfr

Description

@Robinfr

When you do the following, no-unused-props is triggered even though the props are used:

const Thing = (props) => (
    <div>
        {(() => {
            if(props.enabled){
                return (
                    <span>Enabled!</span>
                )
            }
            
            return (
                <span>Disabled..</span>
            )
        })()}
    </div>
);

Thing.propTypes = {
    enabled: React.PropTypes.bool
};

Thing.defaultProps = {
    enabled: false
};

export default Thing;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions