no-sequences
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-sequences": "error",
},
},
];foo = doSomething(), val;
0, eval("doSomething();");
do {} while (doSomething(), !!test);
for (; doSomething(), !!test; );
if (doSomething(), !!test);
switch (val = foo(), val) {}
while (val = foo(), val < 42);
with (doSomething(), val) {}const foo = (val) => (console.log('bar'), val);
const baz = () => ((bar = 123), 10);
const qux = () => { return (bar = 123), 10 }foo = (doSomething(), val);
(0, eval)("doSomething();");
do {} while ((doSomething(), !!test));
for (i = 0, j = 10; i < j; i++, j--);
if ((doSomething(), !!test));
switch ((val = foo(), val)) {}
while ((val = foo(), val < 42));
with ((doSomething(), val)) {}const foo = (val) => ((console.log('bar'), val));
const baz = () => (((bar = 123), 10));
const qux = () => { return ((bar = 123), 10) }Examples from the ESLint documentation.
no-sequences
eslint
export default [
{
rules: {
"no-sequences": "error",
},
},
];no-sequences
eslint plugin · restriction
{
"rules": {
"no-sequences": "error"
}
}complexity/noCommaOperator
complexity · since 1.0.0
{
"linter": {
"rules": {
"complexity": {
"noCommaOperator": "error"
}
}
}
}Disallow comparisons where both sides are exactly the same
Disallow octal escape sequences in string literals
Disallow the use of eval()-like methods