prop-types and es7.objectRestSpread
See original GitHub issueI’m currently getting a lint warning saying that a prop is not defined with the following example:
import React from 'react';
import SharedPropTypes from './SharedPropTypes';
export default class A extends React.Component {
render() {
return (
<span
a={this.props.a}
b={this.props.b}
c={this.props.c}>
{this.props.children}
</span>
);
}
}
A.propTypes = {
a: React.PropTypes.string,
...SharedPropTypes // eslint-disable-line object-shorthand
};
The propTypes are getting assigned utilizing the experimental Stage 1 feature from Babel es7.objectRestSpread.
I already have to disable one line as it is not yet supported in eslint as per eslint/eslint#2514.
I don’t know if this is a limiting issue due to eslint not supporting this ES7 feature yet or not.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
prop-types and es7.objectRestSpread · Issue #106 - GitHub
I'm currently getting a lint warning saying that a prop is not defined with the following example: import React from 'react'; ...
Read more >Using ES7 static propTypes with React-Native - Stack Overflow
When I'm launching my project using React-Native default packager, I have this error: Unexpected token on this line: static propTypes = { ///...
Read more >[Solved]-Using ES7 static propTypes with React-Native-React ...
Coding example for the question Using ES7 static propTypes with React-Native-React Native.
Read more >Parse prop-types - johnlivingston.io - Snippet
An experiment with JavaScript AST (Abstract Syntax Tree) using acorn to parse prop-types.
Read more >Typechecking With PropTypes - React
To run typechecking on the props for a component, you can assign the special propTypes property: import PropTypes from 'prop-types'; class Greeting extends ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mtscout6 this should work
I fixed a crash related to the spread operator (#389). Components propTypes validation is now ignored if propTypes are using the spread operator (since in this case we cannot determine what propTypes are defined or not).