From 5a2e90bfa1ed9ddfadbcfda2ba132c1a0f509c51 Mon Sep 17 00:00:00 2001 From: Amila Welihinda Date: Thu, 6 Oct 2016 19:52:58 -0700 Subject: [PATCH] Added eslint-plugin-flowtype-errors support, updated deps --- .eslintrc | 8 +++++--- .flowconfig | 3 --- app/utils/data.js | 2 +- app/utils/finance.js | 2 +- app/utils/functions.js | 2 +- package.json | 26 ++++++++++++++------------ 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.eslintrc b/.eslintrc index aa94a6b..f5e1d5c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,7 +11,8 @@ }, "plugins": [ - "react" + "react", + "flowtype-errors" ], // Map from global var to bool specifying if it can be redefined @@ -62,6 +63,7 @@ "no-func-assign": 1, // disallow overwriting functions written as function declarations "no-inner-declarations": 0, // disallow function or variable declarations in nested blocks "no-invalid-regexp": 1, // disallow invalid regular expression strings in the RegExp constructor + "flowtype-errors/show-errors": 2, // Report Flowtype errors as ESLint errors "no-negated-in-lhs": 1, // disallow negation of the left operand of an in expression "no-obj-calls": 1, // disallow the use of object properties of the global object (Math and JSON) as functions "no-regex-spaces": 1, // disallow multiple spaces in a regular expression literal @@ -204,8 +206,8 @@ "react/jsx-sort-props": 0, "react/jsx-uses-react": 0, "react/jsx-uses-vars": 1, - "react/no-did-mount-set-state": [1, "allow-in-func"], - "react/no-did-update-set-state": [1, "allow-in-func"], + "react/no-did-mount-set-state": 1, + "react/no-did-update-set-state": 1, "react/no-multi-comp": 0, "react/no-unknown-property": 0, "react/prop-types": 0, diff --git a/.flowconfig b/.flowconfig index 45fd3cc..be52c09 100644 --- a/.flowconfig +++ b/.flowconfig @@ -92,6 +92,3 @@ suppress_type=$FixMe suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy - -[version] -^0.25.0 diff --git a/app/utils/data.js b/app/utils/data.js index 9015e7f..96ded4f 100644 --- a/app/utils/data.js +++ b/app/utils/data.js @@ -1,4 +1,4 @@ -/* @flow */ +// @flow exports.mock = [{ AfterHoursChangeRealtime: null, AnnualizedGain: null, diff --git a/app/utils/finance.js b/app/utils/finance.js index 5535804..df14132 100644 --- a/app/utils/finance.js +++ b/app/utils/finance.js @@ -1,4 +1,4 @@ -/* @flow */ +// @flow exports.getStock = function(opts: Object, type: string) : Object { var defs = { baseURL: 'http://query.yahooapis.com/v1/public/yql?q=', diff --git a/app/utils/functions.js b/app/utils/functions.js index b08d153..9cffabe 100644 --- a/app/utils/functions.js +++ b/app/utils/functions.js @@ -1,4 +1,4 @@ -/* @flow */ +// @flow exports.dynamicSort = function(property: string) : Function { var sortOrder = 1; if (property[0] === '-') { diff --git a/package.json b/package.json index be74609..022bb21 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", + "lint": "eslint app android ios . *.js", "build-android": "npm run release-android; osascript -e 'display notification \"DONE!\" with title \"Android built\"'", "bundle-android": "$NVM_BIN/react-native bundle --platform android --dev false --entry-file ./index.android.js --bundle-output android/app/src/main/assets/index.android.bundle # --assets-dest android/app/src/main/res/", "release-android": "cd android && ./gradlew assembleRelease && cd .." @@ -28,19 +29,20 @@ }, "homepage": "https://github.com/7kfpun/FinanceReactNative#readme", "dependencies": { - "alt": "^0.18.4", - "moment": "^2.13.0", - "react": "15.0.2", - "react-native": "0.26.3", - "react-native-navbar": "^1.5.0", - "react-native-router-flux": "^3.26.24", - "react-native-simple-store": "^1.0.1", - "react-native-vector-icons": "^2.0.3", - "rn-viewpager": "^1.1.2" + "alt": "^0.18.6", + "moment": "^2.15.1", + "react": "15.3.2", + "react-native": "0.34.1", + "react-native-navbar": "^1.5.4", + "react-native-router-flux": "^3.35.0", + "react-native-simple-store": "^1.1.0", + "react-native-vector-icons": "^2.1.0", + "rn-viewpager": "^1.1.3" }, "devDependencies": { - "babel-eslint": "^6.0.4", - "eslint": "^2.11.1", - "eslint-plugin-react": "^5.1.1" + "babel-eslint": "^7.0.0", + "eslint": "^3.7.1", + "eslint-plugin-flowtype-errors": "^1.3.1", + "eslint-plugin-react": "^6.3.0" } }