Skip to content

Commit 388d6f8

Browse files
mysticateabtmills
authored andcommitted
Fix: no-sequences false negative at arrow expressions (fixes #6082) (#6083)
1 parent 8e96064 commit 388d6f8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/rules/no-sequences.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module.exports = {
3131
IfStatement: "test",
3232
SwitchStatement: "discriminant",
3333
WhileStatement: "test",
34-
WithStatement: "object"
34+
WithStatement: "object",
35+
ArrowFunctionExpression: "body"
3536

3637
// Omitting CallExpression - commas are parsed as argument separators
3738
// Omitting NewExpression - commas are parsed as argument separators

tests/lib/rules/no-sequences.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ ruleTester.run("no-sequences", rule, {
4848
"if ((doSomething(), !!test));",
4949
"switch ((doSomething(), !!test)) {}",
5050
"while ((doSomething(), !!test));",
51-
"with ((doSomething(), val)) {}"
51+
"with ((doSomething(), val)) {}",
52+
{ code: "a => ((doSomething(), a))", env: {es6: true} }
5253
],
5354

5455
// Examples of code that should trigger the rule
@@ -59,6 +60,7 @@ ruleTester.run("no-sequences", rule, {
5960
{ code: "if (doSomething(), !!test);", errors: errors(18) },
6061
{ code: "switch (doSomething(), val) {}", errors: errors(22) },
6162
{ code: "while (doSomething(), !!test);", errors: errors(21) },
62-
{ code: "with (doSomething(), val) {}", errors: errors(20) }
63+
{ code: "with (doSomething(), val) {}", errors: errors(20) },
64+
{ code: "a => (doSomething(), a)", env: {es6: true}, errors: errors(20)}
6365
]
6466
});

0 commit comments

Comments
 (0)