1
0
Fork 0

fix(lint): selectively allow null types

This commit is contained in:
ssube 2020-02-19 23:05:40 -06:00
parent bb993466b7
commit 899dac262e
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,7 @@ export async function writeSource(path: string, data: string, stream = process.s
export function writeStream(stream: NodeJS.WriteStream, data: string): Promise<void> {
return new Promise((res, rej) => {
/* eslint-disable-next-line @typescript-eslint/ban-types */
stream.write(data, (err: Error | null | undefined) => {
if (isNil(err)) {
res();

View File

@ -1,5 +1,7 @@
import { isNil } from 'lodash';
/* eslint-disable @typescript-eslint/ban-types */
export function doesExist<T>(val: T | null | undefined): val is T {
return !isNil(val);
}

View File

@ -8,6 +8,7 @@ const filterStack = stackTraceFilter();
type AsyncMochaTest = (this: Mocha.Context | void) => Promise<void>;
type AsyncMochaSuite = (this: Mocha.Suite) => Promise<void>;
/* eslint-disable-next-line @typescript-eslint/ban-types */
function isNil<T>(val: T | null | undefined): val is null | undefined {
/* eslint-disable-next-line no-null/no-null */
return val === null || val === undefined;