Skip to content

Commit

Permalink
Add support for Flow
Browse files Browse the repository at this point in the history
- Demo a very simple example of Flow usage in RoomLabel/index.js
- Modify ESLint config to play nice with Flow. See: https://github.com/gajus/eslint-plugin-flowtype and http://stackoverflow.com/questions/36258234/eslint-with-arbnb-config-and-facebook-flow-together
- Trick Flow into playing nice with scss module imports. See: facebook/flow#338
  • Loading branch information
Zachary Smith committed Mar 23, 2017
1 parent b798017 commit 3153be9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"eslint-config-kyt"
],

"parser": "babel-eslint",

"env": {
},

"plugins": [
"flowtype"
],

"rules": {
Expand Down
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[options]
module.name_mapper.extension='scss' -> 'empty/object'
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
"@kadira/storybook": "^2.21.0",
"@types/enzyme": "^2.7.6",
"@types/jest": "^19.2.2",
"babel-eslint": "^7.2.1",
"empty": "^0.10.1",
"enzyme": "^2.4.1",
"eslint-plugin-flowtype": "^2.30.4",
"flow-bin": "^0.42.0",
"react-addons-test-utils": "^15.3.0"
},
"repository": {
Expand All @@ -29,6 +33,7 @@
"scripts": {
"dev": "kyt dev",
"build": "kyt build",
"flow": "flow; test $? -eq 0 -o $? -eq 2",
"start": "node build/server/main.js",
"proto": "kyt proto",
"test": "kyt test",
Expand Down
3 changes: 2 additions & 1 deletion src/components/01-atoms/RoomLabel/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @flow

import React, { PropTypes } from 'react';
import styles from './styles.scss';

const RoomLabel = ({ name = '' }) => (
const RoomLabel = ({ name = '' }: { name: string }) => (
<div className={styles.roomLabel}>
<span className={styles.foo}>{ name }</span>
</div>
Expand Down

0 comments on commit 3153be9

Please sign in to comment.