generator-star
在生成器函数中强制星号周围的间距一致。
(已删除)此规则在 ESLint v1.0 中已删除,并由 generator-star-spacing 规则替换。
生成器是 ECMAScript 6 中的一种新型函数,它可以随着时间的推移返回多个值。这些特殊功能通过在 function
关键字后放置 *
来表示。
以下是生成器函数的示例:
/*eslint-env es6*/
function* generator() {
yield "44";
yield "55";
}
这也是有效的:
/*eslint-env es6*/
function *generator() {
yield "44";
yield "55";
}
KEGdspusRg6THPgRA+qUz8aHONSa0WzSYzJlqmbvJbo=
/*eslint-env es6*/
function * generator() {
yield "44";
yield "55";
}
eCf2CYXKCvMkfkmSHVt3quPqUqB9WdoFnYpPpGlC8A87lD7id4fTVXGVJs+1hY8P3VLiyaw5vSYqc1ueuIHIlnQRWOP/HhqYumuccw2u734Duc371Zm9Wec1ZGjcN8Edb+Maxgwq4YK6uuSU2+kypw==
规则详情
kLd94pQFk66qylajN62yrmzlcc182NwLp9ZIXV9MEnyIEDOP/9ZwjGKlcsM6YImOw0Z5TDnPmB3Cb6dM/2pQ7A01t9Xy1DsTZie8bw8Lg7NFJx5UJ+/AETPp/NMwGFYqMloW1uia9zf+aPHzEVxj/8bktM9S9eKOSCpTaaNukKZEdKe8r0joedBgCaViob7OVxlGeeLc2gu435O93meipJOA/7AztV/csVEpEzIGDz5Vqln70E5UKd0p6uVNzskYI0SCFa4yp+L5sUY7CFyxijo8O11Gas72BlJVTcRvWOzPI2V/cWMLYSPdqIKzQVtvpxNgf+XSs8ZyOvJtFDHVWwCCVCZqMNUGncJBx9bsWkahmw0eVSByYT+FUNa0hAxqFEiTS1c8wf9Efov1yTzpyw==
X+0dRqYbJnmgpZp9duVvGvCn4nZUh9ypJg3vZCaiToY68UR0lvvHhLySrTQiPxTQ
"generator-star": ["error", "start"]
CsOwR0AGAR7EK9mD5pQ702jy1vBwovL7qvJmuEoB6H7uHhuSqws3b4hrbygEekc13I/2v3PN95BQjJTKL1hr6g==
/*eslint-env es6*/
function* generator() {
}
TKF8jdevwhJ8tdbZgJF3CFTxgqtbqmRqWiAEIv4CsxvH2KtJeSwPD823I26ebvN5xZNrmD/3VRgY9Aq0frVpIQ==
/*eslint-env es6*/
function * generator() {
}
q7LucoR54w9XRT6elmgyb0mMVjMvQbH25ET+8lJLxWg6WTHpduXw0PUe/34Az2ctFrVqxzp5N8qxmKWUz8UmEg==
/*eslint-env es6*/
function *generator() {
}
pQhz436l93MVoSwmtdj6XKL95+QMWFXqTWSWK7zHMnunc4QptO9GXISlAVjOSDR501E/etc4fBcin9ydpkpHKSlRXxXTCRIXnhZJmvEDx80=
/*eslint-env es6*/
var generator = function* () {
}
pQhz436l93MVoSwmtdj6XKL95+QMWFXqTWSWK7zHMnu9chx9U/xInV69h+m22RS9U/1ms9jnOGDQUD2cpWSFbv9Dh1a3TnLaOqcDkaN72Uo=
/*eslint-env es6*/
var generator = function * () {
}
pQhz436l93MVoSwmtdj6XKL95+QMWFXqTWSWK7zHMnt5opoB8Ry0dFddqT7DkNeZ/Wq05CPk4OvcorXTVn4avi3fuRmTAWfWGSRV4v03p/0=
/*eslint-env es6*/
var generator = function *() {
}
pQhz436l93MVoSwmtdj6XJXl7fDSfJGwvwOQbE4LhqtbgzkiWT0x15OzQ0rrNVa/i/TzdqljlTVNyaQTrodl+HI7JWNCADVu6TvkieiqTDADOa/ZY1Z2S0/7gslI5UXJ
/*eslint-env es6*/
var generator = function*() {
}
4MBlrD+LbcKbZwbO/dua+ea6MNWTAC3RE4IYb9i8mm5OQkkEr1oMw6sWe49BeEpJgFmQ3P88OttPrU8b63QZpD3iZSV5X1vLsk2rbFgjeik=
何时不使用
BCB4dKgx18Vx+cbC8/YJfJyFKuKHypCAqxfyKkTJ6rD+e3OWJIQlTWULhKXaqIJoDe4wU+G5vP1bJsrv8ntsqg==