2 title: yield-star-spacing
5 - https://leanpub.com/understandinges6/read/#leanpub-auto-generators
12 This rule enforces spacing around the `*` in `yield*` expressions.
16 The rule takes one option, an object, which has two keys `before` and `after` having boolean values `true` or `false`.
18 * `before` enforces spacing between the `yield` and the `*`.
19 If `true`, a space is required, otherwise spaces are disallowed.
21 * `after` enforces spacing between the `*` and the argument.
22 If it is `true`, a space is required, otherwise spaces are disallowed.
24 The default is `{"before": false, "after": true}`.
27 "yield-star-spacing": ["error", {"before": true, "after": false}]
30 The option also has a string shorthand:
32 * `{"before": false, "after": true}` → `"after"`
33 * `{"before": true, "after": false}` → `"before"`
34 * `{"before": true, "after": true}` → `"both"`
35 * `{"before": false, "after": false}` → `"neither"`
38 "yield-star-spacing": ["error", "after"]
45 Examples of **correct** code for this rule with the default `"after"` option:
50 /*eslint yield-star-spacing: ["error", "after"]*/
53 function* generator() {
62 Examples of **correct** code for this rule with the `"before"` option:
67 /*eslint yield-star-spacing: ["error", "before"]*/
70 function *generator() {
79 Examples of **correct** code for this rule with the `"both"` option:
84 /*eslint yield-star-spacing: ["error", "both"]*/
87 function * generator() {
96 Examples of **correct** code for this rule with the `"neither"` option:
101 /*eslint yield-star-spacing: ["error", "neither"]*/
104 function*generator() {
111 ## When Not To Use It
113 If your project will not be using generators or you are not concerned with spacing consistency, you do not need this rule.