Skip to content

Commit b0a1ce8

Browse files
committed
Ignore = for operator-linebreak
The Airbnb default of "never" is problematic in cases where the variable+method is longer than the remaining space on the line. I think adding parentheses in this case just adds noise. "before" is consistent with other operators, but I think the alignment is wrong when more operators are present and = is a special case where the first operand should be farther left so the operation being assigned stands alone. Signed-off-by: Kevin Locke <[email protected]>
1 parent b00e8ff commit b0a1ce8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.eslintrc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ rules:
8383
one-var-declaration-per-line: [2, "initializations"]
8484
## Requires operator at the beginning of the line in multiline statements
8585
# Airbnb prevents breaks around =, suggesting (). I don't see the advantage.
86-
operator-linebreak: [2, "before"]
86+
# Break after = looks better to me, so first assigned operand is farther left.
87+
operator-linebreak: [2, "before", { "overrides": { "=": "after" } }]
8788
## no space before function, eg. 'function()'
8889
space-before-function-paren: [2, "never"]
8990

0 commit comments

Comments
 (0)