2 title: yield-star-spacing
6 - https://leanpub.com/understandinges6/read/#leanpub-auto-generators
13 This rule enforces spacing around the `*` in `yield*` expressions.
17 The rule takes one option, an object, which has two keys `before` and `after` having boolean values `true` or `false`.
19 * `before` enforces spacing between the `yield` and the `*`.
20 If `true`, a space is required, otherwise spaces are disallowed.
22 * `after` enforces spacing between the `*` and the argument.
23 If it is `true`, a space is required, otherwise spaces are disallowed.
25 The default is `{"before": false, "after": true}`.
28 "yield-star-spacing": ["error", {"before": true, "after": false}]
31 The option also has a string shorthand:
33 * `{"before": false, "after": true}` → `"after"`
34 * `{"before": true, "after": false}` → `"before"`
35 * `{"before": true, "after": true}` → `"both"`
36 * `{"before": false, "after": false}` → `"neither"`
39 "yield-star-spacing": ["error", "after"]
46 Examples of **correct** code for this rule with the default `"after"` option:
51 /*eslint yield-star-spacing: ["error", "after"]*/
54 function* generator() {
63 Examples of **correct** code for this rule with the `"before"` option:
68 /*eslint yield-star-spacing: ["error", "before"]*/
71 function *generator() {
80 Examples of **correct** code for this rule with the `"both"` option:
85 /*eslint yield-star-spacing: ["error", "both"]*/
88 function * generator() {
97 Examples of **correct** code for this rule with the `"neither"` option:
102 /*eslint yield-star-spacing: ["error", "neither"]*/
105 function*generator() {
112 ## When Not To Use It
114 If your project will not be using generators or you are not concerned with spacing consistency, you do not need this rule.