You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/eslint-plugin-plus/rules/indent-binary-ops/README.md
+13-3
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
## Rule Details
2
2
3
3
Indentation for binary operators in multiline expressions.
4
-
This is a supplement to the [`indent`](https://eslint.style/rules/default/indent) rule.
4
+
This is a supplement to the [`indent`](https://eslint.style/rules/default/indent) rule. They are supposed to be used together with the same indentation size.
5
5
6
6
## Options
7
7
@@ -11,18 +11,28 @@ For example, for 2-space indentation:
11
11
12
12
```json
13
13
{
14
-
"indent-binary-ops": ["error", 2]
14
+
"@stylistic/indent": ["error", 2],
15
+
"@stylistic/indent-binary-ops": ["error", 2]
15
16
}
16
17
```
17
18
18
19
Or for tabbed indentation:
19
20
20
21
```json
21
22
{
22
-
"indent-binary-ops": ["error", "tab"]
23
+
"@stylistic/indent": ["error", "tab"],
24
+
"@stylistic/indent-binary-ops": ["error", "tab"]
23
25
}
24
26
```
25
27
28
+
This rule works by:
29
+
30
+
- Only check for binary operations that are multiline.
31
+
- Align the indentation of the second line with the same indentation of the first line (handled by the `indent` rule)
32
+
- In some conditions (e.g. last line ends with an open bracket), the indentation of the second line will be one level increased to the first line's indentation.
0 commit comments