@@ -500,9 +500,11 @@ ruleTester.run("prefer-const", rule, {
500500 { message : "'b' is never reassigned. Use 'const' instead." , type : "Identifier" }
501501 ]
502502 } ,
503+
504+ // The inner `let` will be auto-fixed in the second pass
503505 {
504506 code : "let someFunc = () => { let a = 1, b = 2; foo(a, b) }" ,
505- output : "const someFunc = () => { const a = 1, b = 2; foo(a, b) }" ,
507+ output : "const someFunc = () => { let a = 1, b = 2; foo(a, b) }" ,
506508 errors : [
507509 { message : "'someFunc' is never reassigned. Use 'const' instead." , type : "Identifier" } ,
508510 { message : "'a' is never reassigned. Use 'const' instead." , type : "Identifier" } ,
@@ -546,6 +548,13 @@ ruleTester.run("prefer-const", rule, {
546548 { message : "'bar' is never reassigned. Use 'const' instead." , type : "Identifier" } ,
547549 { message : "'bar' is never reassigned. Use 'const' instead." , type : "Identifier" }
548550 ]
551+ } ,
552+
553+ // https://github.com/eslint/eslint/issues/13899
554+ {
555+ code : "/*eslint no-undef-init:error*/ let foo = undefined;" ,
556+ output : "/*eslint no-undef-init:error*/ const foo = undefined;" ,
557+ errors : 2
549558 }
550559 ]
551560} ) ;
0 commit comments