diff --git a/src/rules/noLetUndefinedRule.ts b/src/rules/noLetUndefinedRule.ts index 804cba589f7..beb2d1f3fb6 100644 --- a/src/rules/noLetUndefinedRule.ts +++ b/src/rules/noLetUndefinedRule.ts @@ -24,6 +24,7 @@ export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { ruleName: "no-let-undefined", description: "Forbids a 'let' statement to be initialized to 'undefined'.", + hasFix: true, optionsDescription: "Not configurable.", options: null, optionExamples: ["true"], diff --git a/test/rules/no-let-undefined/test.ts.fix b/test/rules/no-let-undefined/test.ts.fix index e43e7f3ac9c..6a9080a8d3b 100644 --- a/test/rules/no-let-undefined/test.ts.fix +++ b/test/rules/no-let-undefined/test.ts.fix @@ -4,3 +4,7 @@ for (let y: number | undefined; y < 2; y++) {} let z; +const x = undefined; + +function f(x: string | undefined = undefined) {} + diff --git a/test/rules/no-let-undefined/test.ts.lint b/test/rules/no-let-undefined/test.ts.lint index 39e9adca953..676e899f224 100644 --- a/test/rules/no-let-undefined/test.ts.lint +++ b/test/rules/no-let-undefined/test.ts.lint @@ -6,4 +6,8 @@ for (let y: number | undefined = undefined; y < 2; y++) {} let z; +const x = undefined; + +function f(x: string | undefined = undefined) {} + [0]: Unnecessary initialization to 'undefined'.