From 88c950b2886262743294ffd34bdab1e945414eed Mon Sep 17 00:00:00 2001 From: Adolfo Panizo Date: Thu, 8 Mar 2018 17:19:00 +0100 Subject: [PATCH] Flow configuration --- .babelrc | 1 + .flowconfig | 22 +++++++++++++++++ package-lock.json | 30 ++++++++++++++++++++++++ package.json | 5 +++- src/routes/index.js | 5 ++-- src/routes/welcome/components/Layout.jsx | 1 + 6 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 .flowconfig diff --git a/.babelrc b/.babelrc index 0ad85de6..7b8e61e1 100644 --- a/.babelrc +++ b/.babelrc @@ -1,6 +1,7 @@ { "presets": [ "@babel/react", + "@babel/preset-flow", [ "@babel/env", { diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 00000000..74eee219 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,22 @@ +[ignore] +.*/node_modules/findup/* + +[include] +/src/** + +[libs] + +[lints] + +[options] +module.file_ext=.js +module.file_ext=.json +module.file_ext=.jsx +module.file_ext=.css +module.file_ext=.scss + +module.name_mapper='^~' ->'/src' +module.name_mapper='^#' ->'/gnosis-safe-contracts/build/contracts' +module.name_mapper='.*\(.s?css\)' -> '{}' + +[strict] diff --git a/package-lock.json b/package-lock.json index 39158ee8..6a2a4816 100644 --- a/package-lock.json +++ b/package-lock.json @@ -775,6 +775,12 @@ "integrity": "sha512-kqyNjf3KRJzGbW2YhDWDXruIZXRpy0xPUgrYKPmafHRwxoXKldKx+ThK0d12ETGbsRcBgIOevezWGNb5+k65SA==", "dev": true }, + "@babel/plugin-syntax-flow": { + "version": "7.0.0-beta.40", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0-beta.40.tgz", + "integrity": "sha512-KNY7lQ+/T7lsqJbrZ/l/6WV5LfluOZNyVLsae2+1CWL5AhQApVxQHh+0w/Al9ZhH8Ka4ESp8HkkmfN+kzZhjJQ==", + "dev": true + }, "@babel/plugin-syntax-function-bind": { "version": "7.0.0-beta.40", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-function-bind/-/plugin-syntax-function-bind-7.0.0-beta.40.tgz", @@ -968,6 +974,15 @@ "@babel/helper-builder-binary-assignment-operator-visitor": "7.0.0-beta.40" } }, + "@babel/plugin-transform-flow-strip-types": { + "version": "7.0.0-beta.40", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0-beta.40.tgz", + "integrity": "sha512-9vD+fwJ1nwPwcpcXRoRYbwjeWgoR6qBbCSPMCUrW/18UV7es0yAIxf9/Yzo3WWoYZMbWN8CLrO4noAKSoCWlXA==", + "dev": true, + "requires": { + "@babel/plugin-syntax-flow": "7.0.0-beta.40" + } + }, "@babel/plugin-transform-for-of": { "version": "7.0.0-beta.40", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0-beta.40.tgz", @@ -1255,6 +1270,15 @@ } } }, + "@babel/preset-flow": { + "version": "7.0.0-beta.40", + "resolved": "https://registry.npmjs.org/@babel/preset-flow/-/preset-flow-7.0.0-beta.40.tgz", + "integrity": "sha512-PVAn6HXlzboz8eD7Wa3kNqNwkzYTHPBiifhMChnlFBzTWItNoXvqB5mjrW20QmdPeIG7eNxGLowaFFYPr13Llw==", + "dev": true, + "requires": { + "@babel/plugin-transform-flow-strip-types": "7.0.0-beta.40" + } + }, "@babel/preset-react": { "version": "7.0.0-beta.40", "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.0.0-beta.40.tgz", @@ -7016,6 +7040,12 @@ "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", "dev": true }, + "flow-bin": { + "version": "0.66.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.66.0.tgz", + "integrity": "sha1-qW3ecBXcM0P9VSp7SWPAK+cFyiY=", + "dev": true + }, "flow-parser": { "version": "0.66.0", "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.66.0.tgz", diff --git a/package.json b/package.json index 29eb6833..249ae098 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "start": "node scripts/start.js", "build": "node scripts/build.js", "test": "node scripts/test.js --env=jsdom", - "precommit": "./precommit.sh" + "precommit": "./precommit.sh", + "flow": "flow" }, "repository": { "type": "git", @@ -30,6 +31,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.40", "@babel/polyfill": "^7.0.0-beta.40", "@babel/preset-env": "^7.0.0-beta.40", + "@babel/preset-flow": "^7.0.0-beta.40", "@babel/preset-react": "^7.0.0-beta.40", "@babel/preset-stage-0": "^7.0.0-beta.40", "autoprefixer": "^8.1.0", @@ -49,6 +51,7 @@ "eslint-plugin-react": "^7.7.0", "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "^1.1.11", + "flow-bin": "^0.66.0", "fs-extra": "^5.0.0", "html-loader": "^0.5.5", "html-webpack-plugin": "^3.0.4", diff --git a/src/routes/index.js b/src/routes/index.js index 5e6649c6..47aded0c 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -1,6 +1,7 @@ -import { CircularProgress } from 'material-ui/Progress'; +// @flow +import { CircularProgress } from 'material-ui/Progress' import React from 'react' -import Loadable from 'react-loadable'; +import Loadable from 'react-loadable' import { Switch, Redirect, Route } from 'react-router-dom' import Welcome from './welcome/components/Layout' diff --git a/src/routes/welcome/components/Layout.jsx b/src/routes/welcome/components/Layout.jsx index a90cdb6b..c02d22eb 100644 --- a/src/routes/welcome/components/Layout.jsx +++ b/src/routes/welcome/components/Layout.jsx @@ -1,3 +1,4 @@ +// @flow import Button from 'material-ui/Button'; import React, { Component } from 'react' import { Form, Field } from 'react-final-form'