File tree 1 file changed +7
-1
lines changed
crates/oxc_linter/src/rules/eslint
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,8 @@ impl Rule for NoCondAssign {
77
77
}
78
78
AstKind :: Function ( _)
79
79
| AstKind :: ArrowFunctionExpression ( _)
80
- | AstKind :: Program ( _) => break ,
80
+ | AstKind :: Program ( _)
81
+ | AstKind :: BlockStatement ( _) => break ,
81
82
_ => { }
82
83
}
83
84
}
@@ -159,6 +160,11 @@ fn test() {
159
160
( "switch (foo) { case a = b: bar(); }" , Some ( serde_json:: json!( [ "except-parens" ] ) ) ) ,
160
161
( "switch (foo) { case a = b: bar(); }" , Some ( serde_json:: json!( [ "always" ] ) ) ) ,
161
162
( "switch (foo) { case baz + (a = b): bar(); }" , Some ( serde_json:: json!( [ "always" ] ) ) ) ,
163
+ // not in condition
164
+ ( "if (obj.key) { (obj.key=false) }" , Some ( serde_json:: json!( [ "always" ] ) ) ) ,
165
+ ( "for (;;) { (obj.key=false) }" , Some ( serde_json:: json!( [ "always" ] ) ) ) ,
166
+ ( "while (obj.key) { (obj.key=false) }" , Some ( serde_json:: json!( [ "always" ] ) ) ) ,
167
+ ( "do { (obj.key=false) } while (obj.key)" , Some ( serde_json:: json!( [ "always" ] ) ) ) ,
162
168
] ;
163
169
164
170
let fail = vec ! [
You can’t perform that action at this time.
0 commit comments