sequences
Reports using the comma operator in expressions.
✅ This rule is included in the ts untyped
preset.
The comma operator evaluates each of its operands and returns the value of the last operand. It can hide side effects and make code harder to read. Prefer writing separate expressions or statements instead.
Examples
Section titled “Examples”const result = (doSideEffect(), computeValue());
doSideEffect();const result = computeValue();
Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”Some developers prefer the succinct style of sequences and find it more readable. If you explicitly prefer sequences then you can disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noCommaOperator
- ESLint:
no-sequences
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.