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

Add flow type checking #2717

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
3 changes: 2 additions & 1 deletion lib/utils/array.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export default function last(arr) {
// @flow
export default function last(arr: Array<mixed>): mixed {
return arr[arr.length - 1];
}
3 changes: 2 additions & 1 deletion lib/utils/file.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
/*
* Based on https://github.com/kevva/executable
* Since this module doesn't expose the function to check stat mode only,
Expand All @@ -10,7 +11,7 @@
* PR: https://github.com/kevva/executable/pull/10
*/

export default function isExecutable(fileStat) {
export default function isExecutable(fileStat: {[string]: number}): boolean {
if (process.platform === 'win32') {
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/url-command.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @flow
import path from 'path';
import * as regex from './url-regex';

export default function isUrlCommand(shell, data) {
export default function isUrlCommand(shell: string, data: string): string | null {
const matcher = regex[path.parse(shell).name];
if (undefined === matcher || !data) {
return null;
Expand Down
1 change: 1 addition & 0 deletions lib/utils/url-regex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
export const sh = /(?:ba)?sh: ((?:file:\/\/)|(?:\/\/))?(.*): (?:(?:command not found)|(?:No such file or directory))/;
export const bash = sh;
export const zsh = /zsh: (?:(?:command not found)|(?:no such file or directory)): ((?:file:\/\/)|(?:\/\/))?([^\n]+)/;
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
"eslintConfig": {
"plugins": [
"react",
"prettier"
"prettier",
"flowtype"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
Expand Down Expand Up @@ -91,7 +93,8 @@
},
"babel": {
"presets": [
"react"
"react",
"flow"
],
"env": {
"production": {
Expand Down Expand Up @@ -218,8 +221,10 @@
"ava": "0.24.0",
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "8.2.2",
"babel-loader": "7.1.2",
"babel-preset-babili": "0.1.4",
"babel-preset-flow": "6.23.0",
"babel-preset-react": "6.24.1",
"copy-webpack-plugin": "4.3.1",
"cross-env": "5.1.3",
Expand All @@ -230,8 +235,10 @@
"electron-rebuild": "1.7.3",
"eslint": "^4.7.2",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-flowtype": "2.46.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-react": "^7.3.0",
"flow-bin": "0.66.0",
"husky": "0.14.3",
"inquirer": "5.0.0",
"node-gyp": "3.6.2",
Expand Down
112 changes: 107 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,75 @@
imurmurhash "^0.1.4"
slide "^1.1.5"

"@babel/code-frame@7.0.0-beta.40", "@babel/code-frame@^7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.40.tgz#37e2b0cf7c56026b4b21d3927cadf81adec32ac6"
dependencies:
"@babel/highlight" "7.0.0-beta.40"

"@babel/generator@7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.40.tgz#ab61f9556f4f71dbd1138949c795bb9a21e302ea"
dependencies:
"@babel/types" "7.0.0-beta.40"
jsesc "^2.5.1"
lodash "^4.2.0"
source-map "^0.5.0"
trim-right "^1.0.1"

"@babel/helper-function-name@7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.40.tgz#9d033341ab16517f40d43a73f2d81fc431ccd7b6"
dependencies:
"@babel/helper-get-function-arity" "7.0.0-beta.40"
"@babel/template" "7.0.0-beta.40"
"@babel/types" "7.0.0-beta.40"

"@babel/helper-get-function-arity@7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.40.tgz#ac0419cf067b0ec16453e1274f03878195791c6e"
dependencies:
"@babel/types" "7.0.0-beta.40"

"@babel/highlight@7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.40.tgz#b43d67d76bf46e1d10d227f68cddcd263786b255"
dependencies:
chalk "^2.0.0"
esutils "^2.0.2"
js-tokens "^3.0.0"

"@babel/template@7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.40.tgz#034988c6424eb5c3268fe6a608626de1f4410fc8"
dependencies:
"@babel/code-frame" "7.0.0-beta.40"
"@babel/types" "7.0.0-beta.40"
babylon "7.0.0-beta.40"
lodash "^4.2.0"

"@babel/traverse@^7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.40.tgz#d140e449b2e093ef9fe1a2eecc28421ffb4e521e"
dependencies:
"@babel/code-frame" "7.0.0-beta.40"
"@babel/generator" "7.0.0-beta.40"
"@babel/helper-function-name" "7.0.0-beta.40"
"@babel/types" "7.0.0-beta.40"
babylon "7.0.0-beta.40"
debug "^3.0.1"
globals "^11.1.0"
invariant "^2.2.0"
lodash "^4.2.0"

"@babel/types@7.0.0-beta.40", "@babel/types@^7.0.0-beta.40":
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.40.tgz#25c3d7aae14126abe05fcb098c65a66b6d6b8c14"
dependencies:
esutils "^2.0.2"
lodash "^4.2.0"
to-fast-properties "^2.0.0"

"@concordance/react@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@concordance/react/-/react-1.0.0.tgz#fcf3cad020e5121bfd1c61d05bc3516aac25f734"
Expand Down Expand Up @@ -537,6 +606,17 @@ babel-core@6.26.0, babel-core@^6.17.0, babel-core@^6.26.0:
slash "^1.0.0"
source-map "^0.5.6"

babel-eslint@8.2.2:
version "8.2.2"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.2.tgz#1102273354c6f0b29b4ea28a65f97d122296b68b"
dependencies:
"@babel/code-frame" "^7.0.0-beta.40"
"@babel/traverse" "^7.0.0-beta.40"
"@babel/types" "^7.0.0-beta.40"
babylon "^7.0.0-beta.40"
eslint-scope "~3.7.1"
eslint-visitor-keys "^1.0.0"

babel-generator@^6.1.0, babel-generator@^6.26.0:
version "6.26.1"
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90"
Expand Down Expand Up @@ -976,7 +1056,7 @@ babel-preset-babili@0.1.4:
babel-plugin-transform-undefined-to-void "^6.8.2"
lodash.isplainobject "^4.0.6"

babel-preset-flow@^6.23.0:
babel-preset-flow@6.23.0, babel-preset-flow@^6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz#e71218887085ae9a24b5be4169affb599816c49d"
dependencies:
Expand Down Expand Up @@ -1045,6 +1125,10 @@ babel-types@^6.24.1, babel-types@^6.26.0:
lodash "^4.17.4"
to-fast-properties "^1.0.3"

babylon@7.0.0-beta.40, babylon@^7.0.0-beta.40:
version "7.0.0-beta.40"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a"

babylon@^6.1.0, babylon@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3"
Expand Down Expand Up @@ -2508,6 +2592,12 @@ eslint-config-prettier@^2.6.0:
dependencies:
get-stdin "^5.0.1"

eslint-plugin-flowtype@2.46.1:
version "2.46.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.46.1.tgz#c4f81d580cd89c82bc3a85a1ccf4ae3a915143a4"
dependencies:
lodash "^4.15.0"

eslint-plugin-prettier@^2.3.1:
version "2.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7"
Expand All @@ -2524,7 +2614,7 @@ eslint-plugin-react@^7.3.0:
jsx-ast-utils "^2.0.1"
prop-types "^15.6.0"

eslint-scope@^3.7.1:
eslint-scope@^3.7.1, eslint-scope@~3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
dependencies:
Expand Down Expand Up @@ -2804,6 +2894,10 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"

flow-bin@0.66.0:
version "0.66.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.66.0.tgz#a96dde7015dc3343fd552a7b4963c02be705ca26"

flush-write-stream@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.2.tgz#c81b90d8746766f1a609a46809946c45dd8ae417"
Expand Down Expand Up @@ -3032,7 +3126,7 @@ global-dirs@^0.1.0:
dependencies:
ini "^1.3.4"

globals@^11.0.1:
globals@^11.0.1, globals@^11.1.0:
version "11.3.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0"

Expand Down Expand Up @@ -3445,7 +3539,7 @@ interpret@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"

invariant@^2.0.0, invariant@^2.2.2:
invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.2:
version "2.2.3"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688"
dependencies:
Expand Down Expand Up @@ -3770,6 +3864,10 @@ jsesc@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b"

jsesc@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe"

jsesc@~0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
Expand Down Expand Up @@ -4018,7 +4116,7 @@ lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"

lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.8.0, lodash@~4.17.4:
lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.8.0, lodash@~4.17.4:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"

Expand Down Expand Up @@ -6206,6 +6304,10 @@ to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"

to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"

tough-cookie@~2.3.0, tough-cookie@~2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561"
Expand Down