## Rule Details
-This rule aims to eliminate variable declarations that initialize to `undefined`.
+This rule aims to eliminate `var` and `let` variable declarations that initialize to `undefined`.
Examples of **incorrect** code for this rule:
```js
/*eslint no-undef-init: "error"*/
-/*eslint-env es6*/
var foo = undefined;
let bar = undefined;
```js
/*eslint no-undef-init: "error"*/
-/*eslint-env es6*/
var foo;
let bar;
-const baz = undefined;
+```
+
+Please note that this rule does not check `const` declarations, destructuring patterns, function parameters, and class fields.
+
+Examples of additional **correct** code for this rule:
+
+```js
+/*eslint no-undef-init: "error"*/
+
+const foo = undefined;
+
+let { bar = undefined } = baz;
+
+[quux = undefined] = quuux;
+
+(foo = undefined) => {};
+
+class Foo {
+ bar = undefined;
+}
```
## When Not To Use It