Eslint-plugin-react: Spread of any object into jsx causes react/prop-types to stop working (errors not detected)

Created on 22 Aug 2018  路  3Comments  路  Source: yannickcr/eslint-plugin-react

Here is a minimal example:

import React from 'react'

class MyComponent extends React.Component {
    render() {
        // should be "'someProp' is missing in props validation (react/prop-types)" but is not
        this.props.someProp()

        return <div {...{}} />
    }
}

export default MyComponent

remove the spread {...{}} and everything is fine

bug help wanted

Most helpful comment

This was filed as #1601 for no-unused-prop-types and there's an unfinished PR in #1646.
If #1946 is merged, the fix will go into that common helper and apply for both rules.

All 3 comments

This was filed as #1601 for no-unused-prop-types and there's an unfinished PR in #1646.
If #1946 is merged, the fix will go into that common helper and apply for both rules.

Ah yeah, this seems fixed in master. At least now it does. I just added a test and noticed that it did not fail. :)

In that case, I'll close this now.

Was this page helpful?
0 / 5 - 0 ratings