5 - https://leanpub.com/understandinges6/read/#leanpub-auto-generators
8 Enforces consistent spacing around the asterisk in generator functions.
10 (removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [generator-star-spacing](generator-star-spacing) rule.
12 Generators are a new type of function in ECMAScript 6 that can return multiple values over time.
13 These special functions are indicated by placing an `*` after the `function` keyword.
15 Here is an example of a generator function:
20 function* generator() {
31 function *generator() {
37 This is valid as well:
42 function * generator() {
48 To keep a sense of consistency when using generators this rule enforces a single position for the `*`.
52 This rule enforces that the `*` is either placed next to the `function` keyword or the name of the function. The single
53 option for this rule is a string specifying the placement of the asterisk. For this option you may pass
54 `"start"`, `"middle"` or `"end"`. The default is `"end"`.
56 You can set the style in configuration like this:
59 "generator-star": ["error", "start"]
62 When using `"start"` this placement will be enforced:
67 function* generator() {
71 When using `"middle"` this placement will be enforced:
76 function * generator() {
80 When using `"end"` this placement will be enforced:
85 function *generator() {
89 When using the expression syntax `"start"` will be enforced here:
94 var generator = function* () {
98 When using the expression syntax `"middle"` will be enforced here:
103 var generator = function * () {
107 When using the expression syntax `"end"` will be enforced here:
112 var generator = function *() {
116 When using the expression syntax this is valid for both `"start"` and `"end"`:
121 var generator = function*() {
125 The shortened object literal syntax for generators is not affected by this rule.
127 ## When Not To Use It
129 If your project will not be using generators you do not need this rule.