[eslint config] [base] Enables eslint rule for operator-linebreak

Requiring operators at the beginning of the line makes code more readable. When operators are on the left hand side they mirror the syntax of method chaining and it is easy to see the build of logic in a statement. This also updates the readme and fixes a style violation as a result of adding this rule in eslint-config-airbnb/test/test-base.js and eslint-config-airbnb-base/test/test-base.js.
This commit is contained in:
Sharmila
2017-10-18 11:42:26 -07:00
parent f2a65c6898
commit cd4ec29ed3

View File

@@ -2000,7 +2000,7 @@ Other Style Guides
<a name="control-statements"></a>
- [17.1](#control-statements) In case your control statement (`if`, `while` etc.) gets too long or exceeds the maximum line length, each (grouped) condition could be put into a new line. The logical operator should begin the line.
> Why? Having operators at the beginning of the line keeps the operators aligned and follows a pattern similar to method chaining. This also improves readability by making it easier to visually follow complex logic.
> Why? Requiring operators at the beginning of the line keeps the operators aligned and follows a pattern similar to method chaining. This also improves readability by making it easier to visually follow complex logic.
```javascript
// bad