-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[prop-types] It crash eslint when using spread operator in a flow type #1178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can also say that babel itself could not run that code until the 6.24.1 (or a bit earlier) version of |
Wow, so fast! Fantastic! |
Sadly I still get that issue:
|
Different rule, same issue. I will fix this one too. |
This should be reopened, still a problem with the same stack on version 7.0.1. I'll see if I can add a test PR that demonstrates it, I suspect it is due to the use of
|
I've pulled master, I see EDIT: See below, I can't make tests fail, so... |
I've discovered that this problem is not isolated to libdefs, code that is present inside my project is failing to be validated using the object type spread, it appears to be because I think this method will need to check if it is indeed an object type spread and flatten it in-line. Unfortunately, it doesn't seem to matter what I put in the tests, they all pass, leading me to believe there is a problem in the tests. e.g.: {
code: [
'import type {Data} from \'./Data\'',
'type Person = {',
' ...Data,',
' lastname: string',
'};',
'class Hello extends React.Component {',
' props: Person;',
' render () {',
' return <div>Hello {this.props.bar}</div>;',
' }',
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'import type {Data} from \'some-libdef-like-flow-typed-provides\'',
'type Person = {',
' ...Data,',
' lastname: string',
'};',
'class Hello extends React.Component {',
' props: Person;',
' render () {',
' return <div>Hello {this.props.bar}</div>;',
' }',
'}'
].join('\n'),
parser: 'babel-eslint'
} Both report as passing, and I cannot see how that could be true. If @yannickcr will reopen this and advise me on the bad tests succeeding, I'm willing to take a shot at this. |
I finally debugged my case close enough to add a test that breaks the current {
code: [
'import type {BasePerson} from \'./types\'',
'type Props = {',
' person: {',
' ...$Exact<BasePerson>',
' lastname: string',
' }',
'};',
'class Hello extends React.Component {',
' props: Props;',
' render () {',
' return <div>Hello {this.props.person.firstname}</div>;',
' }',
'}'
].join('\n'),
parser: 'babel-eslint'
} |
@rosskevin would you open a new issue for that, that links back to this one? The OP is fixed; your issue is slightly different :-) |
Hello! This code crashs eslint:
Edit: disabling this rules does not happen.
Thank you!
The text was updated successfully, but these errors were encountered: