Skip to content

Commit

Permalink
Convert week_number.jsx to flow (as a simple example) (Hacker0x01#1307)
Browse files Browse the repository at this point in the history
* Convert week_number.jsx to flow (as a simple example)

Workaround for react-docgen#125

* Run flow from lint script
  • Loading branch information
aij authored and martijnrusschen committed Mar 31, 2018
1 parent 988c28d commit 8dab292
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[ignore]

[include]

[libs]

[lints]

[options]

[strict]
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"eslint-plugin-react": "^7.4.0",
"express": "^4.16.2",
"extract-text-webpack-plugin": "^1.0.1",
"flow-bin": "^0.68.0",
"highlight.js": "^9.12.0",
"husky": "^0.14.3",
"isparta-loader": "^2.0.0",
Expand Down Expand Up @@ -95,10 +96,11 @@
},
"scripts": {
"eslint": "eslint {src,test,docs-site/src}/**/*.{js,jsx} *.js",
"flow": "flow",
"precommit": "lint-staged",
"sass-lint":
"sass-lint --config .sass-lint.yml 'src/stylesheets/*.scss, docs-site/src/*.scss' -i 'docs-site/src/higlight.scss, docs-site/src/reset.scss'",
"lint": "run-p eslint sass-lint",
"lint": "run-p eslint flow sass-lint",
"start": "cross-env MODULES=false node server.js",
"test": "cross-env NODE_ENV=test karma start karma.conf.js --single-run",
"prepublish": "test $(npm -v | tr . '\\n' | head -n 1) -ge '4' || exit 1",
Expand Down
8 changes: 6 additions & 2 deletions src/week_number.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// @flow
import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";

export default class WeekNumber extends React.Component {
export default class WeekNumber extends React.Component<{
weekNumber: number,
onClick?: Function
}> {
static propTypes = {
weekNumber: PropTypes.number.isRequired,
onClick: PropTypes.func
};

handleClick = event => {
handleClick = (event: any) => {
if (this.props.onClick) {
this.props.onClick(event);
}
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,10 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"

flow-bin@^0.68.0:
version "0.68.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.68.0.tgz#86c2d14857d306eb2e85e274f2eebf543564f623"

for-in@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
Expand Down

0 comments on commit 8dab292

Please sign in to comment.