Skip to content

Commit 8dab292

Browse files
aijmartijnrusschen
authored andcommitted
Convert week_number.jsx to flow (as a simple example) (Hacker0x01#1307)
* Convert week_number.jsx to flow (as a simple example) Workaround for react-docgen#125 * Run flow from lint script
1 parent 988c28d commit 8dab292

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

.flowconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ignore]
2+
3+
[include]
4+
5+
[libs]
6+
7+
[lints]
8+
9+
[options]
10+
11+
[strict]

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"eslint-plugin-react": "^7.4.0",
4545
"express": "^4.16.2",
4646
"extract-text-webpack-plugin": "^1.0.1",
47+
"flow-bin": "^0.68.0",
4748
"highlight.js": "^9.12.0",
4849
"husky": "^0.14.3",
4950
"isparta-loader": "^2.0.0",
@@ -95,10 +96,11 @@
9596
},
9697
"scripts": {
9798
"eslint": "eslint {src,test,docs-site/src}/**/*.{js,jsx} *.js",
99+
"flow": "flow",
98100
"precommit": "lint-staged",
99101
"sass-lint":
100102
"sass-lint --config .sass-lint.yml 'src/stylesheets/*.scss, docs-site/src/*.scss' -i 'docs-site/src/higlight.scss, docs-site/src/reset.scss'",
101-
"lint": "run-p eslint sass-lint",
103+
"lint": "run-p eslint flow sass-lint",
102104
"start": "cross-env MODULES=false node server.js",
103105
"test": "cross-env NODE_ENV=test karma start karma.conf.js --single-run",
104106
"prepublish": "test $(npm -v | tr . '\\n' | head -n 1) -ge '4' || exit 1",

src/week_number.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
// @flow
12
import React from "react";
23
import PropTypes from "prop-types";
34
import classnames from "classnames";
45

5-
export default class WeekNumber extends React.Component {
6+
export default class WeekNumber extends React.Component<{
7+
weekNumber: number,
8+
onClick?: Function
9+
}> {
610
static propTypes = {
711
weekNumber: PropTypes.number.isRequired,
812
onClick: PropTypes.func
913
};
1014

11-
handleClick = event => {
15+
handleClick = (event: any) => {
1216
if (this.props.onClick) {
1317
this.props.onClick(event);
1418
}

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,10 @@ flatten@^1.0.2:
28412841
version "1.0.2"
28422842
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
28432843

2844+
flow-bin@^0.68.0:
2845+
version "0.68.0"
2846+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.68.0.tgz#86c2d14857d306eb2e85e274f2eebf543564f623"
2847+
28442848
for-in@^1.0.1:
28452849
version "1.0.2"
28462850
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"

0 commit comments

Comments
 (0)