From 86b6f5d39ecc571260dee891aa422f8d3cc807e8 Mon Sep 17 00:00:00 2001 From: Eli White Date: Thu, 10 May 2018 15:44:53 -0700 Subject: [PATCH] Add Prettier to some files Reviewed By: sahrens Differential Revision: D7958196 fbshipit-source-id: 05a04380a4a1f3abd4cc3a9034fc70deaa4a444b --- babel-preset/configs/hmr.js | 22 +++++++++++++--------- babel-preset/configs/main.js | 4 +++- flow-github/metro.js | 1 + flow/Map.js | 12 +++++++++--- flow/Position.js | 7 ++++--- flow/Promise.js | 27 ++++++++++++++------------- flow/Set.js | 8 ++++++-- flow/console.js | 19 ++++++++++--------- flow/fbjs.js | 8 +++++++- flow/prop-types.js | 7 ++++--- 10 files changed, 71 insertions(+), 44 deletions(-) diff --git a/babel-preset/configs/hmr.js b/babel-preset/configs/hmr.js index e2b4a0f3dec0e0..05b305c09e6cc8 100644 --- a/babel-preset/configs/hmr.js +++ b/babel-preset/configs/hmr.js @@ -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'; @@ -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 === '\\') { @@ -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'], + }, + ], }, - ] - ] + ], + ], }; }; diff --git a/babel-preset/configs/main.js b/babel-preset/configs/main.js index e6aeeec39865ba..526d6f7f909ddd 100644 --- a/babel-preset/configs/main.js +++ b/babel-preset/configs/main.js @@ -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'; @@ -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` }, ], diff --git a/flow-github/metro.js b/flow-github/metro.js index ff06b427774628..db5dbdc28c7a5e 100644 --- a/flow-github/metro.js +++ b/flow-github/metro.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @flow + * @format */ declare module 'metro' { diff --git a/flow/Map.js b/flow/Map.js index f2021affd67a63..0723ea4266ec62 100644 --- a/flow/Map.js +++ b/flow/Map.js @@ -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 { @@iterator(): Iterator<[K, V]>; constructor(_: void): MapPolyfill; constructor(_: null): MapPolyfill; - constructor(iterable: Iterable<[Key, Value]>): MapPolyfill; + constructor( + iterable: Iterable<[Key, Value]>, + ): MapPolyfill; clear(): void; delete(key: K): boolean; entries(): Iterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: MapPolyfill) => mixed, thisArg?: any): void; + forEach( + callbackfn: (value: V, index: K, map: MapPolyfill) => mixed, + thisArg?: any, + ): void; get(key: K): V | void; has(key: K): boolean; keys(): Iterator; diff --git a/flow/Position.js b/flow/Position.js index 58e3330b0b926a..5bd2717c0e742a 100644 --- a/flow/Position.js +++ b/flow/Position.js @@ -6,10 +6,11 @@ * * @flow * @nolint + * @format */ declare class Position { - coords: Coordinates, - timestamp: number, - mocked: boolean, + coords: Coordinates; + timestamp: number; + mocked: boolean; } diff --git a/flow/Promise.js b/flow/Promise.js index d69944eb4b47e2..64350cabc0b5c5 100644 --- a/flow/Promise.js +++ b/flow/Promise.js @@ -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) => void, - reject: (error?: any) => void - ) => mixed): void; + constructor( + callback: ( + resolve: (result?: Promise | R) => void, + reject: (error?: any) => void, + ) => mixed, + ): void; then( onFulfill?: ?(value: R) => Promise | ?U, - onReject?: ?(error: any) => Promise | ?U + onReject?: ?(error: any) => Promise | ?U, ): Promise; - catch( - onReject?: (error: any) => ?Promise | U - ): Promise; + catch(onReject?: (error: any) => ?Promise | U): Promise; static resolve(object?: Promise | T): Promise; static reject(error?: any): Promise; - static all>(promises: T): Promise<$TupleMap>; + static all>( + promises: T, + ): Promise<$TupleMap>; static race(promises: Array>): Promise; // Non-standard APIs // See https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/Promise.native.js#L21 - finally( - onFinally?: ?(value: any) => Promise | U - ): Promise; + finally(onFinally?: ?(value: any) => Promise | U): Promise; done( onFulfill?: ?(value: R) => mixed, - onReject?: ?(error: any) => mixed + onReject?: ?(error: any) => mixed, ): void; static cast(object?: T): Promise; diff --git a/flow/Set.js b/flow/Set.js index 54b997a68a6f44..ea3b1533b830b6 100644 --- a/flow/Set.js +++ b/flow/Set.js @@ -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 { @@ -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) => mixed, thisArg?: any): void; + forEach( + callbackfn: (value: T, index: T, set: SetPolyfill) => mixed, + thisArg?: any, + ): void; has(value: T): boolean; keys(): Iterator; size: number; diff --git a/flow/console.js b/flow/console.js index 4e57ba953715c3..a5d0d31bf36742 100644 --- a/flow/console.js +++ b/flow/console.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @flow + * @format */ declare module 'console' { @@ -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; } } diff --git a/flow/fbjs.js b/flow/fbjs.js index f7b41b5a6a3ad8..9106e436da85d8 100644 --- a/flow/fbjs.js +++ b/flow/fbjs.js @@ -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: (condition: any, message: string, ...args: Array) => void; + declare module.exports: ( + condition: any, + message: string, + ...args: Array + ) => void; } declare module 'fbjs/lib/nullthrows' { diff --git a/flow/prop-types.js b/flow/prop-types.js index c79dab62ba9345..be239f5bdfb385 100644 --- a/flow/prop-types.js +++ b/flow/prop-types.js @@ -6,6 +6,7 @@ * * @flow * @nolint + * @format */ // TODO (bvaughn) Remove this file once flowtype/flow-typed/pull/773 is merged @@ -14,7 +15,7 @@ type $npm$propTypes$ReactPropsCheckType = ( props: any, propName: string, componentName: string, - href?: string + href?: string, ) => ?Error; declare module 'prop-types' { @@ -39,6 +40,6 @@ declare module 'prop-types' { values: V, location: string, componentName: string, - getStack: ?(() => ?string) - ) : void; + getStack: ?() => ?string, + ): void; }