From 96dfce7a5df35ebc5c8bf242456834f0401056ab Mon Sep 17 00:00:00 2001 From: Jack Wearden Date: Tue, 21 Jan 2020 17:30:49 +0000 Subject: [PATCH] highland: convert spaces to tabs and add tslint rule (#41717) --- types/highland/highland-tests.ts | 100 ++++++++++++++--------------- types/highland/index.d.ts | 104 +++++++++++++++---------------- types/highland/tslint.json | 1 + 3 files changed, 103 insertions(+), 102 deletions(-) diff --git a/types/highland/highland-tests.ts b/types/highland/highland-tests.ts index 0f44d14c35..ac71a12257 100644 --- a/types/highland/highland-tests.ts +++ b/types/highland/highland-tests.ts @@ -47,28 +47,28 @@ var anyArrStream: Highland.Stream; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - interface Foo { - foo(): string; + foo(): string; } interface Bar { - bar(): string; + bar(): string; } interface Baz { - foo(): string; - bar: number; - baz: boolean; + foo(): string; + bar: number; + baz: boolean; } interface StrFooArrMap { - [key: string]: Foo[]; + [key: string]: Foo[]; } interface StrBarArrMap { - [key: string]: Bar[]; + [key: string]: Bar[]; } declare class MyPromise implements PromiseLike { - constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (err: any) => void) => void); - then(onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): PromiseLike; + constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (err: any) => void) => void); + then(onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): PromiseLike; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -144,24 +144,24 @@ fooStream = streamRedirect.to; fooStream = _(); fooStream = _(fooArr); fooStream = _((push, next) => { - push(null, foo); - push(err); - next(); + push(null, foo); + push(err); + next(); }); fooStream = _(fooStream); fooStream = _(readable); fooStream = _(readable, (r, cb) => { - return; + return; }); fooStream = _(readable, (r, cb) => { - return () => { return; } + return () => { return; } }); fooStream = _(readable, (r, cb) => { - return { continueOnError: true }; + return { continueOnError: true }; }); fooStream = _(readable, (r, cb) => { - return { onDestroy: () => { return; } }; + return { onDestroy: () => { return; } }; }); fooStream = _(str, emitter); fooStream = _(str, emitter, num); @@ -208,22 +208,22 @@ fooArrStream = fooStream.collect(); fooStream = fooStream.compact(); barStream = fooStream.consume( - ( - err: Error, - x: Foo | Highland.Nil, - push: (err: Error, value?: Bar | Highland.Nil) => void, - next: () => void - ) => { - push(err); - push(null, bar); - next(); - } + ( + err: Error, + x: Foo | Highland.Nil, + push: (err: Error, value?: Bar | Highland.Nil) => void, + next: () => void + ) => { + push(err); + push(null, bar); + next(); + } ); barStream = fooStream.consume((err, x, push, next) => { - push(err); - push(null, bar); - next(); + push(err); + push(null, bar); + next(); }); fooStream = fooStream.debounce(num); @@ -233,21 +233,21 @@ fooStream = fooStream.doto((x: Foo) => {}); fooStream = fooStream.drop(2); fooStream = fooStream.errors( - (err: Error, push: (e: Error, x?: Foo) => void) => { - push(err); - push(null, x); - push(null, foo); - } + (err: Error, push: (e: Error, x?: Foo) => void) => { + push(err); + push(null, x); + push(null, foo); + } ); fooStream = fooStream.errors((err, push) => { - push(err); - push(null, x); - push(null, foo); + push(err); + push(null, x); + push(null, foo); }); fooStream = fooStream.filter((x: Foo) => { - return bool; + return bool; }); // $ExpectType Stream @@ -257,13 +257,13 @@ numStream = numStream.filter((n: number) => n < 3); fooStream.filter(isBaz); fooStream = fooStream.find((x: Foo) => { - return bool; + return bool; }); fooStream = fooStream.findWhere(obj); strFooArrMapStream = fooStream.group((x: Foo) => { - return str; + return str; }); strFooArrMapStream = fooStream.group(str); @@ -282,7 +282,7 @@ fooStream = fooStream.last(); fooStream = fooStream.latest(); barStream = fooStream.map((x: Foo) => { - return bar; + return bar; }); // $ExpectType Stream> @@ -299,30 +299,30 @@ fooStream = fooStream.ratelimit(3, 1000); // $ExpectType Stream fooStream = fooStream.reduce1((memo: Foo, x: Foo) => { - return memo; + return memo; }); // $ExpectType Stream barStream = fooStream.reduce1((memo: Foo | Bar, x: Foo) => { - return bar; + return bar; }); fooStream = fooStream.reject((x: Foo) => { - return bool; + return bool; }); barStream = fooStream.scan(bar, (memo: Bar, x: Foo) => { - return memo; + return memo; }); // $ExpectType Stream fooStream = fooStream.scan1((memo: Foo, x: Foo) => { - return memo; + return memo; }); // $ExpectType Stream barStream = fooStream.scan1((memo: Foo | Bar, x: Foo) => { - return bar; + return bar; }); // $ExpectType Stream @@ -374,15 +374,15 @@ fooStream = fooStream.concat(fooStream); fooStream = fooStream.concat(fooArr); fooStream = fooStream.flatFilter((x: Foo) => { - return boolStream; + return boolStream; }); barStream = fooStream.flatMap((x: Foo) => { - return barStream; + return barStream; }); barStream = fooStream.flatMap((x: Foo) => { - return bar; + return bar; }); barStream = barArrStream.flatten(); diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index b52dbf010a..bf81580f79 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -149,7 +149,7 @@ interface HighlandStatic { // UTILS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** + /** * Returns true if `x` is the end of stream marker. * * @id isNil @@ -158,7 +158,7 @@ interface HighlandStatic { * @param x - the object to test * @api public */ - isNil(x: R | Highland.Nil): x is Highland.Nil; + isNil(x: R | Highland.Nil): x is Highland.Nil; /** * Returns true if `x` is a Highland Stream. @@ -1088,27 +1088,27 @@ declare namespace Highland { */ throttle(ms: number): Stream; - /** - * Filters out all duplicate values from the stream and keeps only the first - * occurence of each value, using === to define equality. - * - * @id uniq - * @section Streams - * @name Stream.uniq() - * @api public - */ - uniq(): Stream; + /** + * Filters out all duplicate values from the stream and keeps only the first + * occurence of each value, using === to define equality. + * + * @id uniq + * @section Streams + * @name Stream.uniq() + * @api public + */ + uniq(): Stream; - /** - * Filters out all duplicate values from the stream and keeps only the first - * occurence of each value, using the provided function to define equality. - * - * @id uniqBy - * @section Streams - * @name Stream.uniqBy() - * @api public - */ - uniqBy(f: (a: R, b: R) => boolean): Stream; + /** + * Filters out all duplicate values from the stream and keeps only the first + * occurence of each value, using the provided function to define equality. + * + * @id uniqBy + * @section Streams + * @name Stream.uniqBy() + * @api public + */ + uniqBy(f: (a: R, b: R) => boolean): Stream; /** * A convenient form of filter, which returns all objects from a Stream @@ -1161,7 +1161,7 @@ declare namespace Highland { * Creates a new Stream of values by applying each item in a Stream to an * iterator function which must return a (possibly empty) Stream. Each * item on these result Streams are then emitted on a single output Stream. - * + * * This transform is functionally equivalent to `.map(f).sequence()`. * * @id flatMap @@ -1219,7 +1219,7 @@ declare namespace Highland { * // => contents of foo.txt, bar.txt and baz.txt in the order they were read */ merge(this: Stream>): Stream; - + /** * Takes a Stream of Streams and merges their values and errors into a * single new Stream, limitting the number of unpaused streams that can @@ -1587,28 +1587,28 @@ declare namespace Highland { */ toNodeStream(options?: object): NodeJS.ReadableStream; - /** - * Converts the result of a stream to Promise. - * - * If the stream contains a single value, it will return - * with the single item emitted by the stream (if present). - * If the stream is empty, `undefined` will be returned. - * If an error is encountered in the stream, this function will stop - * consumption and call `cb` with the error. - * If the stream contains more than one item, it will stop consumption - * and reject with an error. - * - * @id toPromise - * @section Consumption - * @name Stream.toPromise(PromiseCtor) - * @param {Function} PromiseCtor - Promises/A+ compliant constructor - * @api public - * - * _([1, 2, 3, 4]).collect().toPromise(Promise).then(function (result) { - * // parameter result will be [1,2,3,4] - * }); - */ - toPromise

>(PromiseCtor: PConstructor): P; + /** + * Converts the result of a stream to Promise. + * + * If the stream contains a single value, it will return + * with the single item emitted by the stream (if present). + * If the stream is empty, `undefined` will be returned. + * If an error is encountered in the stream, this function will stop + * consumption and call `cb` with the error. + * If the stream contains more than one item, it will stop consumption + * and reject with an error. + * + * @id toPromise + * @section Consumption + * @name Stream.toPromise(PromiseCtor) + * @param {Function} PromiseCtor - Promises/A+ compliant constructor + * @api public + * + * _([1, 2, 3, 4]).collect().toPromise(Promise).then(function (result) { + * // parameter result will be [1,2,3,4] + * }); + */ + toPromise

>(PromiseCtor: PConstructor): P; } interface PipeableStream extends Stream {} @@ -1617,13 +1617,13 @@ declare namespace Highland { end: boolean } - type MappingHint = number | string[] | Function; + type MappingHint = number | string[] | Function; - interface CleanupObject { - onDestroy?: Function; - continueOnError?: boolean; - } - type OnFinished = (r: NodeJS.ReadableStream, cb: (...args: any[]) => void) => void | Function | CleanupObject; + interface CleanupObject { + onDestroy?: Function; + continueOnError?: boolean; + } + type OnFinished = (r: NodeJS.ReadableStream, cb: (...args: any[]) => void) => void | Function | CleanupObject; } declare var highland:HighlandStatic; diff --git a/types/highland/tslint.json b/types/highland/tslint.json index 3d59f55fda..c19509d425 100644 --- a/types/highland/tslint.json +++ b/types/highland/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "indent": [true, "tabs", 1], "npm-naming": false, "eofline": false, "export-just-namespace": false,