Fix eslint issues and turn on prettier by default (#1195)

* Automatically generate prop-types from Flow

* Remove propTypes usage

* Fix flow

* Modify some eslint settings

* Fix flowtype

* Lint tweaks

* use prop-types pkg

* Run prettier

* Fix flow

* Fix few lint issues

* Make eslint pass

* Run lint on tests

* Fix flow

* Fixes

* Alphabetical

* Trailing comma: ES5 for website compat, also fix config/paths

* Apply eslint --fix only to src now

* Fix missing transitionconfig

* Update TypeDefinition.js

* New stuff

* Unstage website and examples

* reformat code

* Update circle.yml
This commit is contained in:
Mike Grabowski
2017-04-24 14:01:22 +02:00
committed by Satyajit Sahoo
parent 23e310742c
commit bbe9caff06
57 changed files with 1983 additions and 1264 deletions

View File

@@ -2,10 +2,7 @@
import invariant from 'fbjs/lib/invariant';
import type {
NavigationRoute,
NavigationState,
} from './TypeDefinition';
import type { NavigationRoute, NavigationState } from './TypeDefinition';
/**
* Utilities to perform atomic operation with navigate state and routes.
@@ -16,12 +13,11 @@ import type {
* ```
*/
const StateUtils = {
/**
* Gets a route by key. If the route isn't found, returns `null`.
*/
get(state: NavigationState, key: string): ?NavigationRoute {
return state.routes.find(route => route.key === key) || null;
return state.routes.find((route: *) => route.key === key) || null;
},
/**
@@ -29,7 +25,7 @@ const StateUtils = {
* routes of the navigation state, or -1 if it is not present.
*/
indexOf(state: NavigationState, key: string): number {
return state.routes.map(route => route.key).indexOf(key);
return state.routes.map((route: *) => route.key).indexOf(key);
},
/**
@@ -37,7 +33,7 @@ const StateUtils = {
* routes of the navigation state.
*/
has(state: NavigationState, key: string): boolean {
return !!state.routes.some(route => route.key === key);
return !!state.routes.some((route: *) => route.key === key);
},
/**
@@ -185,7 +181,7 @@ const StateUtils = {
const nextIndex: number = index === undefined ? routes.length - 1 : index;
if (state.routes.length === routes.length && state.index === nextIndex) {
const compare = (route, ii) => routes[ii] === route;
const compare = (route: *, ii: *) => routes[ii] === route;
if (state.routes.every(compare)) {
return state;
}