Skip to content

Commit

Permalink
Add Prettier to some files
Browse files Browse the repository at this point in the history
Reviewed By: sahrens

Differential Revision: D7958196

fbshipit-source-id: 05a04380a4a1f3abd4cc3a9034fc70deaa4a444b
  • Loading branch information
elicwhite authored and facebook-github-bot committed May 10, 2018
1 parent 8f5ebe5 commit 86b6f5d
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 44 deletions.
22 changes: 13 additions & 9 deletions babel-preset/configs/hmr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';

Expand All @@ -13,8 +15,8 @@ var transformPath = require.resolve(hmrTransform);

module.exports = function(options, filename) {
var transform = filename
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
: hmrTransform;
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
: hmrTransform;

// Fix the module path to use '/' on Windows.
if (path.sep === '\\') {
Expand All @@ -26,13 +28,15 @@ module.exports = function(options, filename) {
[
require('metro-babel7-plugin-react-transform'),
{
transforms: [{
transform: transform,
imports: ['react'],
locals: ['module'],
}]
transforms: [
{
transform: transform,
imports: ['react'],
locals: ['module'],
},
],
},
]
]
],
],
};
};
4 changes: 3 additions & 1 deletion babel-preset/configs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

'use strict';
Expand Down Expand Up @@ -31,7 +33,7 @@ const defaultPlugins = [
require('@babel/plugin-transform-modules-commonjs'),
{
strict: false,
strictMode : false, // prevent "use strict" injections
strictMode: false, // prevent "use strict" injections
allowTopLevelThis: true, // dont rewrite global `this` -> `undefined`
},
],
Expand Down
1 change: 1 addition & 0 deletions flow-github/metro.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

declare module 'metro' {
Expand Down
12 changes: 9 additions & 3 deletions flow/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,29 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

// These annotations are copy/pasted from the built-in Flow definitions for
// Native Map.

declare module "Map" {
declare module 'Map' {
// Use the name "MapPolyfill" so that we don't get confusing error
// messages about "Using Map instead of Map".
declare class MapPolyfill<K, V> {
@@iterator(): Iterator<[K, V]>;
constructor<Key, Value>(_: void): MapPolyfill<Key, Value>;
constructor<Key, Value>(_: null): MapPolyfill<Key, Value>;
constructor<Key, Value>(iterable: Iterable<[Key, Value]>): MapPolyfill<Key, Value>;
constructor<Key, Value>(
iterable: Iterable<[Key, Value]>,
): MapPolyfill<Key, Value>;
clear(): void;
delete(key: K): boolean;
entries(): Iterator<[K, V]>;
forEach(callbackfn: (value: V, index: K, map: MapPolyfill<K, V>) => mixed, thisArg?: any): void;
forEach(
callbackfn: (value: V, index: K, map: MapPolyfill<K, V>) => mixed,
thisArg?: any,
): void;
get(key: K): V | void;
has(key: K): boolean;
keys(): Iterator<K>;
Expand Down
7 changes: 4 additions & 3 deletions flow/Position.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
*
* @flow
* @nolint
* @format
*/

declare class Position {
coords: Coordinates,
timestamp: number,
mocked: boolean,
coords: Coordinates;
timestamp: number;
mocked: boolean;
}
27 changes: 14 additions & 13 deletions flow/Promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,42 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

// These annotations are copy/pasted from the built-in Flow definitions for
// Native Promises with some non-standard APIs added in
declare class Promise<+R> {
constructor(callback: (
resolve: (result?: Promise<R> | R) => void,
reject: (error?: any) => void
) => mixed): void;
constructor(
callback: (
resolve: (result?: Promise<R> | R) => void,
reject: (error?: any) => void,
) => mixed,
): void;

then<U>(
onFulfill?: ?(value: R) => Promise<U> | ?U,
onReject?: ?(error: any) => Promise<U> | ?U
onReject?: ?(error: any) => Promise<U> | ?U,
): Promise<U>;

catch<U>(
onReject?: (error: any) => ?Promise<U> | U
): Promise<U>;
catch<U>(onReject?: (error: any) => ?Promise<U> | U): Promise<U>;

static resolve<T>(object?: Promise<T> | T): Promise<T>;
static reject<T>(error?: any): Promise<T>;

static all<T: Iterable<mixed>>(promises: T): Promise<$TupleMap<T, typeof $await>>;
static all<T: Iterable<mixed>>(
promises: T,
): Promise<$TupleMap<T, typeof $await>>;
static race<T>(promises: Array<Promise<T>>): Promise<T>;

// Non-standard APIs

// See https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/Promise.native.js#L21
finally<U>(
onFinally?: ?(value: any) => Promise<U> | U
): Promise<U>;
finally<U>(onFinally?: ?(value: any) => Promise<U> | U): Promise<U>;

done<U>(
onFulfill?: ?(value: R) => mixed,
onReject?: ?(error: any) => mixed
onReject?: ?(error: any) => mixed,
): void;

static cast<T>(object?: T): Promise<T>;
Expand Down
8 changes: 6 additions & 2 deletions flow/Set.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
*
* @flow
* @nolint
* @format
*/

// These annotations are copy/pasted from the built-in Flow definitions for
// Native Set.

declare module "Set" {
declare module 'Set' {
// Use the name "SetPolyfill" so that we don't get confusing error
// messages about "Using Set instead of Set".
declare class SetPolyfill<T> {
Expand All @@ -21,7 +22,10 @@ declare module "Set" {
clear(): void;
delete(value: T): boolean;
entries(): Iterator<[T, T]>;
forEach(callbackfn: (value: T, index: T, set: SetPolyfill<T>) => mixed, thisArg?: any): void;
forEach(
callbackfn: (value: T, index: T, set: SetPolyfill<T>) => mixed,
thisArg?: any,
): void;
has(value: T): boolean;
keys(): Iterator<T>;
size: number;
Expand Down
19 changes: 10 additions & 9 deletions flow/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

declare module 'console' {
Expand All @@ -22,17 +23,17 @@ declare module 'console' {
declare function warn(...data: any): void;
declare class Console {
constructor(stdout: stream$Writable, stdin?: stream$Writable): void;
assert(value: any, ...message: any): void,
assert(value: any, ...message: any): void;
dir(
obj: Object,
options: {showHidden: boolean, depth: number, colors: boolean},
): void,
error(...data: any): void,
info(...data: any): void,
log(...data: any): void,
time(label: any): void,
timeEnd(label: any): void,
trace(first: any, ...rest: any): void,
warn(...data: any): void,
): void;
error(...data: any): void;
info(...data: any): void;
log(...data: any): void;
time(label: any): void;
timeEnd(label: any): void;
trace(first: any, ...rest: any): void;
warn(...data: any): void;
}
}
8 changes: 7 additions & 1 deletion flow/fbjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

declare module 'fbjs/lib/invariant' {
declare module.exports: <T>(condition: any, message: string, ...args: Array<any>) => void;
declare module.exports: <T>(
condition: any,
message: string,
...args: Array<any>
) => void;
}

declare module 'fbjs/lib/nullthrows' {
Expand Down
7 changes: 4 additions & 3 deletions flow/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @flow
* @nolint
* @format
*/

// TODO (bvaughn) Remove this file once flowtype/flow-typed/pull/773 is merged
Expand All @@ -14,7 +15,7 @@ type $npm$propTypes$ReactPropsCheckType = (
props: any,
propName: string,
componentName: string,
href?: string
href?: string,
) => ?Error;

declare module 'prop-types' {
Expand All @@ -39,6 +40,6 @@ declare module 'prop-types' {
values: V,
location: string,
componentName: string,
getStack: ?(() => ?string)
) : void;
getStack: ?() => ?string,
): void;
}

0 comments on commit 86b6f5d

Please sign in to comment.