diff --git a/.eslintrc.json b/.eslintrc.json index e1065ce..3cfc9ab 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,8 @@ "extends": "eslint-config-shakacode", "plugins": [ - "react-native" + "react-native", + "flowtype" ], "env": { @@ -17,6 +18,9 @@ "extensions": [".js", ".android.js", ".ios.js"], "moduleDirectory": ["..", "node_modules"] } + }, + "flowtype": { + "onlyFilesWithFlowAnnotation": true } }, @@ -31,6 +35,27 @@ "react-native/no-color-literals": 2, "react/jsx-no-bind": 1, "react/prefer-stateless-function": 1, - "react/jsx-indent": 1 + "react/jsx-indent": 1, + + "flowtype/require-parameter-type": 1, + "flowtype/require-return-type": [ + 0, + "always", + { + "annotateUndefined": "never" + } + ], + "flowtype/space-after-type-colon": [ + 1, + "always" + ], + "flowtype/space-before-type-colon": [ + 1, + "never" + ], + "flowtype/type-id-match": [ + 1, + "^([A-Z][a-z0-9]+)+Type$" + ] } } diff --git a/.flowconfig b/.flowconfig index e28e2f5..9881873 100644 --- a/.flowconfig +++ b/.flowconfig @@ -8,13 +8,13 @@ # Ignore malformed json .*/node_modules/y18n/test/.*\.json +.*/node_modules/jsonlint/test/.*\.json [include] [libs] node_modules/react-native/Libraries/react-native/react-native-interface.js node_modules/react-native/flow -flow/ [options] module.system=haste @@ -22,8 +22,6 @@ module.system=haste esproposal.class_static_fields=enable esproposal.class_instance_fields=enable -experimental.strict_type_args=true - munge_underscores=true module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' @@ -38,4 +36,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9 suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy [version] -^0.27.0 +^0.22.1 diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..8a0704f --- /dev/null +++ b/.jscsrc @@ -0,0 +1,18 @@ +{ + "preset": "airbnb", + "fileExtensions": [ + ".js", + ".jsx" + ], + "excludeFiles": [ + "ios/**", + "android/**", + "node_modules/**" + ], + "esprima": "babel-jscs", + "validateQuoteMarks": { + "mark": "'", + "escape": true, + "ignoreJSX": true + } +} diff --git a/app/App.js b/app/App.js index e68429f..a64bc9a 100644 --- a/app/App.js +++ b/app/App.js @@ -1,3 +1,4 @@ +// @flow import React from 'react'; import { Provider } from 'react-redux'; diff --git a/app/components/AddComment/AddComment.js b/app/components/AddComment/AddComment.js index f10bfd2..9d926ee 100644 --- a/app/components/AddComment/AddComment.js +++ b/app/components/AddComment/AddComment.js @@ -2,7 +2,8 @@ import React, { PropTypes } from 'react'; import { Text, View, TextInput } from 'react-native'; import _ from 'lodash/fp'; -import ActivityIndicator from 'ReactNativeTutorial/app/components/ActivityIndicator/ActivityIndicator'; +import ActivityIndicator from + 'ReactNativeTutorial/app/components/ActivityIndicator/ActivityIndicator'; import withFormState from 'ReactNativeTutorial/app/hocs/withFormState'; import withAddCommentHandlers from 'ReactNativeTutorial/app/hocs/withAddCommentHandlers'; import Button from 'ReactNativeTutorial/app/components/Button/Button'; diff --git a/app/components/Comments/Comments.js b/app/components/Comments/Comments.js index 7df93dd..740bfac 100644 --- a/app/components/Comments/Comments.js +++ b/app/components/Comments/Comments.js @@ -8,7 +8,8 @@ import _ from 'lodash/fp'; import Comment from 'ReactNativeTutorial/app/components/Comment/Comment'; import Button from 'ReactNativeTutorial/app/components/Button/Button'; -import ActivityIndicator from 'ReactNativeTutorial/app/components/ActivityIndicator/ActivityIndicator'; +import ActivityIndicator from + 'ReactNativeTutorial/app/components/ActivityIndicator/ActivityIndicator'; import withRemoteDataSource from 'ReactNativeTutorial/app/hocs/withRemoteDataSource'; import routes from 'ReactNativeTutorial/app/constants/routes'; import styles from './CommentsStyle'; @@ -21,6 +22,7 @@ const Comments = (props) => ( props.actions.resetErrorState(); props.remoteDataSourceFetch(); }} + text="Reload" />