@@ -47,25 +47,25 @@ ruleTester.run("no-cond-assign", rule, {
4747 { code : "switch (foo) { case baz + (a = b): bar(); }" , options : [ "always" ] }
4848 ] ,
4949 invalid : [
50- { code : "var x; if (x = 0) { var b = 1; }" , errors : [ { messageId : "missing" , type : "IfStatement " , line : 1 , column : 12 } ] } ,
51- { code : "var x; while (x = 0) { var b = 1; }" , errors : [ { messageId : "missing" , type : "WhileStatement " } ] } ,
52- { code : "var x = 0, y; do { y = x; } while (x = x + 1);" , errors : [ { messageId : "missing" , type : "DoWhileStatement " } ] } ,
53- { code : "var x; for(; x+=1 ;){};" , errors : [ { messageId : "missing" , type : "ForStatement " } ] } ,
54- { code : "var x; if ((x) = (0));" , errors : [ { messageId : "missing" , type : "IfStatement " } ] } ,
55- { code : "if (someNode || (someNode = parentNode)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "an 'if' statement" } , type : "IfStatement" } ] } ,
56- { code : "while (someNode || (someNode = parentNode)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'while' statement" } , type : "WhileStatement " } ] } ,
57- { code : "do { } while (someNode || (someNode = parentNode));" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'do...while' statement" } , type : "DoWhileStatement " } ] } ,
58- { code : "for (; (typeof l === 'undefined' ? (l = 0) : l); i++) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'for' statement" } , type : "ForStatement " } ] } ,
59- { code : "if (x = 0) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "an 'if' statement" } , type : "IfStatement " } ] } ,
60- { code : "while (x = 0) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'while' statement" } , type : "WhileStatement " } ] } ,
61- { code : "do { } while (x = x + 1);" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'do...while' statement" } , type : "DoWhileStatement " } ] } ,
62- { code : "for(; x = y; ) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'for' statement" } , type : "ForStatement " } ] } ,
63- { code : "if ((x = 0)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "an 'if' statement" } , type : "IfStatement " } ] } ,
64- { code : "while ((x = 0)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'while' statement" } , type : "WhileStatement " } ] } ,
65- { code : "do { } while ((x = x + 1));" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'do...while' statement" } , type : "DoWhileStatement " } ] } ,
66- { code : "for(; (x = y); ) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'for' statement" } , type : "ForStatement " } ] } ,
67- { code : "var x; var b = (x = 0) ? 1 : 0;" , errors : [ { messageId : "missing" , type : "ConditionalExpression " } ] } ,
68- { code : "var x; var b = x && (y = 0) ? 1 : 0;" , options : [ "always" ] , errors : [ { messageId : "unexpected" , type : "ConditionalExpression " } ] } ,
69- { code : "(((3496.29)).bkufyydt = 2e308) ? foo : bar;" , errors : [ { messageId : "missing" , type : "ConditionalExpression " } ] }
50+ { code : "var x; if (x = 0) { var b = 1; }" , errors : [ { messageId : "missing" , type : "AssignmentExpression " , line : 1 , column : 12 , endLine : 1 , endColumn : 17 } ] } ,
51+ { code : "var x; while (x = 0) { var b = 1; }" , errors : [ { messageId : "missing" , type : "AssignmentExpression " } ] } ,
52+ { code : "var x = 0, y; do { y = x; } while (x = x + 1);" , errors : [ { messageId : "missing" , type : "AssignmentExpression " } ] } ,
53+ { code : "var x; for(; x+=1 ;){};" , errors : [ { messageId : "missing" , type : "AssignmentExpression " } ] } ,
54+ { code : "var x; if ((x) = (0));" , errors : [ { messageId : "missing" , type : "AssignmentExpression " } ] } ,
55+ { code : "if (someNode || (someNode = parentNode)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "an 'if' statement" } , type : "AssignmentExpression" , column : 18 , endColumn : 39 } ] } ,
56+ { code : "while (someNode || (someNode = parentNode)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'while' statement" } , type : "AssignmentExpression " } ] } ,
57+ { code : "do { } while (someNode || (someNode = parentNode));" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'do...while' statement" } , type : "AssignmentExpression " } ] } ,
58+ { code : "for (; (typeof l === 'undefined' ? (l = 0) : l); i++) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'for' statement" } , type : "AssignmentExpression " } ] } ,
59+ { code : "if (x = 0) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "an 'if' statement" } , type : "AssignmentExpression " } ] } ,
60+ { code : "while (x = 0) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'while' statement" } , type : "AssignmentExpression " } ] } ,
61+ { code : "do { } while (x = x + 1);" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'do...while' statement" } , type : "AssignmentExpression " } ] } ,
62+ { code : "for(; x = y; ) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'for' statement" } , type : "AssignmentExpression " } ] } ,
63+ { code : "if ((x = 0)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "an 'if' statement" } , type : "AssignmentExpression " } ] } ,
64+ { code : "while ((x = 0)) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'while' statement" } , type : "AssignmentExpression " } ] } ,
65+ { code : "do { } while ((x = x + 1));" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'do...while' statement" } , type : "AssignmentExpression " } ] } ,
66+ { code : "for(; (x = y); ) { }" , options : [ "always" ] , errors : [ { messageId : "unexpected" , data : { type : "a 'for' statement" } , type : "AssignmentExpression " } ] } ,
67+ { code : "var x; var b = (x = 0) ? 1 : 0;" , errors : [ { messageId : "missing" , type : "AssignmentExpression " } ] } ,
68+ { code : "var x; var b = x && (y = 0) ? 1 : 0;" , options : [ "always" ] , errors : [ { messageId : "unexpected" , type : "AssignmentExpression " } ] } ,
69+ { code : "(((3496.29)).bkufyydt = 2e308) ? foo : bar;" , errors : [ { messageId : "missing" , type : "AssignmentExpression " } ] }
7070 ]
7171} ) ;
0 commit comments