@@ -177,6 +177,10 @@ ruleTester.run("no-unused-vars", rule, {
177177 { code : "(function(obj) { for ( const name in obj ) { return true } })({})" , parserOptions : { ecmaVersion : 6 } } ,
178178 { code : "(function(obj) { for ( const name in obj ) return true })({})" , parserOptions : { ecmaVersion : 6 } } ,
179179
180+ // Sequence Expressions (See https://github.com/eslint/eslint/issues/14325)
181+ { code : "let x = 0; foo = (0, x++);" , parserOptions : { ecmaVersion : 6 } } ,
182+ { code : "let x = 0; foo = (0, x += 1);" , parserOptions : { ecmaVersion : 6 } } ,
183+
180184 // caughtErrors
181185 {
182186 code : "try{}catch(err){console.error(err);}" ,
@@ -995,6 +999,71 @@ ruleTester.run("no-unused-vars", rule, {
995999 definedError ( "c" )
9961000 ]
9971001 } ,
1002+
1003+ // https://github.com/eslint/eslint/issues/14325
1004+ {
1005+ code : `let x = 0;
1006+ x++, x = 0;` ,
1007+ parserOptions : { ecmaVersion : 2015 } ,
1008+ errors : [ { ...assignedError ( "x" ) , line : 2 , column : 18 } ]
1009+ } ,
1010+ {
1011+ code : `let x = 0;
1012+ x++, x = 0;
1013+ x=3;` ,
1014+ parserOptions : { ecmaVersion : 2015 } ,
1015+ errors : [ { ...assignedError ( "x" ) , line : 3 , column : 13 } ]
1016+ } ,
1017+ {
1018+ code : "let x = 0; x++, 0;" ,
1019+ parserOptions : { ecmaVersion : 2015 } ,
1020+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 12 } ]
1021+ } ,
1022+ {
1023+ code : "let x = 0; 0, x++;" ,
1024+ parserOptions : { ecmaVersion : 2015 } ,
1025+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 15 } ]
1026+ } ,
1027+ {
1028+ code : "let x = 0; 0, (1, x++);" ,
1029+ parserOptions : { ecmaVersion : 2015 } ,
1030+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 19 } ]
1031+ } ,
1032+ {
1033+ code : "let x = 0; foo = (x++, 0);" ,
1034+ parserOptions : { ecmaVersion : 2015 } ,
1035+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 19 } ]
1036+ } ,
1037+ {
1038+ code : "let x = 0; foo = ((0, x++), 0);" ,
1039+ parserOptions : { ecmaVersion : 2015 } ,
1040+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 23 } ]
1041+ } ,
1042+ {
1043+ code : "let x = 0; x += 1, 0;" ,
1044+ parserOptions : { ecmaVersion : 2015 } ,
1045+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 12 } ]
1046+ } ,
1047+ {
1048+ code : "let x = 0; 0, x += 1;" ,
1049+ parserOptions : { ecmaVersion : 2015 } ,
1050+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 15 } ]
1051+ } ,
1052+ {
1053+ code : "let x = 0; 0, (1, x += 1);" ,
1054+ parserOptions : { ecmaVersion : 2015 } ,
1055+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 19 } ]
1056+ } ,
1057+ {
1058+ code : "let x = 0; foo = (x += 1, 0);" ,
1059+ parserOptions : { ecmaVersion : 2015 } ,
1060+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 19 } ]
1061+ } ,
1062+ {
1063+ code : "let x = 0; foo = ((0, x += 1), 0);" ,
1064+ parserOptions : { ecmaVersion : 2015 } ,
1065+ errors : [ { ...assignedError ( "x" ) , line : 1 , column : 23 } ]
1066+ } ,
9981067 {
9991068 code : "(function ({ a, b }, { c } ) { return b; })();" ,
10001069 parserOptions : { ecmaVersion : 2015 } ,
0 commit comments