1
0
Fork 0

lint: fix nulls

This commit is contained in:
ssube 2020-03-02 18:33:48 -06:00 committed by Sean Sube
parent 7d39c206d1
commit 78fb9afda5
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,8 @@
import { AsyncHook, createHook } from 'async_hooks'; import { AsyncHook, createHook } from 'async_hooks';
/* eslint-disable-next-line @typescript-eslint/ban-types */
export type Maybe<TValue> = TValue | null | undefined;
// this will pull Mocha internals out of the stacks // this will pull Mocha internals out of the stacks
/* eslint-disable-next-line @typescript-eslint/no-var-requires */ /* eslint-disable-next-line @typescript-eslint/no-var-requires */
const { stackTraceFilter } = require('mocha/lib/utils'); const { stackTraceFilter } = require('mocha/lib/utils');
@ -8,7 +11,8 @@ const filterStack = stackTraceFilter();
type AsyncMochaTest = (this: Mocha.Context | void) => Promise<void>; type AsyncMochaTest = (this: Mocha.Context | void) => Promise<void>;
type AsyncMochaSuite = (this: Mocha.Suite) => Promise<void>; type AsyncMochaSuite = (this: Mocha.Suite) => Promise<void>;
function isNil<T>(val: T | null | undefined): val is null | undefined { /* eslint-disable-next-line @typescript-eslint/ban-types */
function isNil<T>(val: Maybe<T>): val is null | undefined {
/* eslint-disable-next-line no-null/no-null */ /* eslint-disable-next-line no-null/no-null */
return val === null || val === undefined; return val === null || val === undefined;
} }