eslint-config-love icon indicating copy to clipboard operation
eslint-config-love copied to clipboard

Rule clash between @typescript-eslint/init-declarations and no-undef-init

Open xandris opened this issue 6 months ago • 3 comments

Given a stock config, local variables that may be undefined are impossible to lint:

// Variable 'x' should be initialized on declaration
// @typescript-eslint/init-declarations
let x: number | undefined

// It's not necessary to initialize 'x: number | undefined' to undefined
// no-undef-init
let x: number | undefined = undefined

The safer route is probably to turn off no-undef-init and allow superfluous initialization with undefined? At least in Typescript.

xandris avatar Aug 13 '24 23:08 xandris