Open
Description
We working on converting graphql
and express-graphql
package to TS and want to use no-unnecessary-condition
since we had this lint rule in Flow.
The problem is that both libraries are used in a lot of JS projects so we need to check arguments of public API functions for popular mistakes.
So we created devCheck
function for this purpose:
function devAssert(condition: unknown, message: string): asserts condition {
const booleanCondition = Boolean(condition);
if (!booleanCondition) {
throw new Error(message);
}
}
Problem is that we get this error:
190:13 error Unnecessary conditional, the types have no overlap @typescript-eslint/no-unnecessary-condition
for this code
export function graphqlHTTP(options: Options): Middleware {
devAssert(options != null, 'GraphQL middleware requires options.');
It would be ideal if we can pass devAssert
as an option for the no-unnecessary-condition
rule and expressions inside arguments would be ignored.