sbdchd / eslint-plugin-cake

:cake: Sweet rules for ESLint
MIT License
1 stars 0 forks source link

new rule: no-pointless-nullish-coalescing #24

Open sbdchd opened 3 years ago

sbdchd commented 3 years ago
// err
declare const bar: string | undefined
const foo = bar ?? undefined

// err
declare const bar: string | null | undefined
const foo = bar ?? null

// err
declare const bar: string | null | undefined
const foo = bar ?? undefined

// err
declare const bar: string | null
const foo = bar ?? null

// ok
declare const bar: string | null
const foo = bar ?? undefined

// ok
declare const bar: string | undefined
const foo = bar ?? null