highland: convert spaces to tabs and add tslint rule (#41717)

This commit is contained in:
Jack Wearden
2020-01-21 09:30:49 -08:00
committed by Ben Lichtman
parent 8189cbe230
commit 96dfce7a5d
3 changed files with 103 additions and 102 deletions
+50 -50
View File
@@ -47,28 +47,28 @@ var anyArrStream: Highland.Stream<any[]>;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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<T> implements PromiseLike<T> {
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (err: any) => void) => void);
then<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (err: any) => void) => void);
then<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -144,24 +144,24 @@ fooStream = streamRedirect.to;
fooStream = _<Foo>();
fooStream = _(fooArr);
fooStream = _<Foo>((push, next) => {
push(null, foo);
push(err);
next();
push(null, foo);
push(err);
next();
});
fooStream = _(fooStream);
fooStream = _<Foo>(readable);
fooStream = _<Foo>(readable, (r, cb) => {
return;
return;
});
fooStream = _<Foo>(readable, (r, cb) => {
return () => { return; }
return () => { return; }
});
fooStream = _<Foo>(readable, (r, cb) => {
return { continueOnError: true };
return { continueOnError: true };
});
fooStream = _<Foo>(readable, (r, cb) => {
return { onDestroy: () => { return; } };
return { onDestroy: () => { return; } };
});
fooStream = _<Foo>(str, emitter);
fooStream = _<Foo>(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<Bar>((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<number>
@@ -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<Pick<Baz, "foo" | "bar">>
@@ -299,30 +299,30 @@ fooStream = fooStream.ratelimit(3, 1000);
// $ExpectType Stream<Foo>
fooStream = fooStream.reduce1((memo: Foo, x: Foo) => {
return memo;
return memo;
});
// $ExpectType Stream<Bar>
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<Foo>
fooStream = fooStream.scan1((memo: Foo, x: Foo) => {
return memo;
return memo;
});
// $ExpectType Stream<Bar>
barStream = fooStream.scan1((memo: Foo | Bar, x: Foo) => {
return bar;
return bar;
});
// $ExpectType Stream<Foo>
@@ -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<Bar>();
+52 -52
View File
@@ -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<R>(x: R | Highland.Nil): x is Highland.Nil;
isNil<R>(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<R>;
/**
* 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<R>;
/**
* 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<R>;
/**
* 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<R>;
/**
* 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<R>;
/**
* 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<U>(this: Stream<Stream<U>>): Stream<U>;
/**
* 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<P extends PromiseLike<R>>(PromiseCtor: PConstructor<R, P>): 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<P extends PromiseLike<R>>(PromiseCtor: PConstructor<R, P>): P;
}
interface PipeableStream<T, R> extends Stream<R> {}
@@ -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;
+1
View File
@@ -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,