Skip to content
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

Flowtype migration #607

Merged
merged 6 commits into from
Dec 12, 2016
Merged

Flowtype migration #607

merged 6 commits into from
Dec 12, 2016

Conversation

amilajack
Copy link
Member

@amilajack amilajack commented Dec 9, 2016

⚠️ Do Not Merge

This essentially requires the user of the boilerplate to know at least a little flow. Lets merge this when we provide some learning resources and documentation on the tools that this boilerplate uses

  • Update eslint-plugin-flowtype-errors
  • Add eslint-plugin-flowtype
  • Add babel-plugin-tcomb
  • Migrate react static propTypes to flow types

@amilajack amilajack changed the title Flowtype props migration Flowtype migration Dec 9, 2016
@amilajack
Copy link
Member Author

amilajack commented Dec 10, 2016

@dustintownsend for some reason I can add you as a reviewer. Would be great if you could review this.

When should this be merged? The propTypes examples in the boilerplate use flow: https://github.com/chentsulin/electron-react-boilerplate/blob/flowtype-props-migration/app/components/Counter.js#L7-L13

This allows for better static analysis when developing. Also if I'm not mistaken, propTypes will be deprecated at some point.

Is this okay to be merged now?

@amilajack
Copy link
Member Author

amilajack commented Dec 10, 2016

PropTypes Validation with flow/eslint

screen shot 2016-12-08 at 8 42 10 pm

Type errors at runtime in dev env (babel-plugin-tcomb)

function square(x: number) {
  return x * 'x';
}

square('2');

screen shot 2016-12-10 at 9 47 56 am

@amilajack
Copy link
Member Author

amilajack commented Dec 11, 2016

@dustintownsend accidentally tagged the wrong person. Meant to tag you in #607 (comment). Would be great if you could respond to it.

@amilajack amilajack merged commit 109aa6a into master Dec 12, 2016
@amilajack amilajack deleted the flowtype-props-migration branch December 12, 2016 06:56
@amilajack amilajack restored the flowtype-props-migration branch December 12, 2016 07:13
@dustintownsend
Copy link
Collaborator

@amilajack I really need to learn more about flow. I assume it's basically just making javascript more like typescript. For the benefit of catching typos/code mistakes in the editor.

I'm not 100% sure what I'm looking for here, but I see the same warnings from #610 but in the editor. ESLint warnings for flowtype/no-weak-types. I assume this is what is expected and if so it's working.
I am running Atom with the recommended packages from the readme.

@amilajack amilajack deleted the flowtype-props-migration branch December 12, 2016 16:31
@amilajack
Copy link
Member Author

@dustintownsend Hmm try restarting the editor.

Here's what I see:

screen shot 2016-12-12 at 8 41 19 am

Try restarting atom

@dustintownsend
Copy link
Collaborator

@amilajack if I add /* eslint flowtype/no-weak-types: 2 */ to the file I get the Error instead of Warning.

Is that the expected behavior?

@amilajack
Copy link
Member Author

Yea. /* eslint flowtype/no-weak-types: 1 */ Will give you a warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants