yield-star-spacing
在 yield*
表达式中要求或不允许在 *
周围有空格
一些该规则报告的问题可以通过 --fix 命令行选项 自动修复
规则详情
此规则在 yield*
表达式中强制 *
周围的间距。
选项
该规则采用一个选项,一个对象,它有两个键 before
和 after
,其布尔值 true
或 false
。
ZaIZm2crr/3mf0nYPFIBYcl34Z+WfvFekYdhttVLEws0xv9mX+j+2CNf1xwZ+WH48kj2rcxUEZECUop2uqJ2/eO962QksiIntUSuNeKVPEz+/h7eVrLPGF7eZPlyCHSE3/uqzxmuLIM5Z+E4cUU7e84/DBeHCVuf0QrtNnr33qdfQFqjVVG2+KA/cIfdNuycpaQuME4plNhAxj1aORsZHg==
4NqQu6MWjHTmoNeDVTmJz9L0LPcWonN3CwMh1AbQJCiRMIpQqG5N19JwNX+FwF5/3UoK29sOzOJ+InaeLFHzouNeDBp0KiDX/lC+QkX++T65b8rh7Jpnj9tNVcewAUfFDndop3GhvfxdliENvNU9K6GQv0cKz4dycGnMCZy2UYWiCsRs20K8hvwyVTv2jEMT
41tIH+4d2HEviEiophKRINgUNhYtpqHFlIVHA8Q2ejf5VVZXNn6lX4W+HzrXlrqy4lYydtNik3b5X0WrcVTC6Q==
"yield-star-spacing": ["error", {"before": true, "after": false}]
u7OlVMfRvrjvjXwTrMAwfdi2cW/pSNxliGCMe5Dats/cznyFMfdiFlH0U+o6Msnm
- OEldfFHhEl2OZsEiaR2qNfDIREEbpum3K/2owxpC0sgxaOavp2ITi0dcI+Ck0nhXndZNMBGCvWTPFfPLC/HcEWi6MnNeIQhkYGhxAwUpY1qn36M7qraqoa44QaACjSwggrYTzkgF47WIIddcTpydl3+VRdcWQYSzWm7+V5Ibr/1d2CAbVOKNac0CxemxhOKiiPq6nOr1uy2yQDdceT8nTTjolClMgaE5NvzFFWdbg0dUpHGqcso5f9i26GEl+JrkPxAHQKa4eXNp2cmNieTIrSt3wTDPnqsgDX/5HwCgfFcdTJqBZpNoR2fNrIfTs/U8nUB6/7BC2va8eaakAmtAuSBRFdbfnGNWqFr1GPeH8hqj2Y77qml/k7if43tU7N84COMzTHdG7XVelCXLEuvL30rqUtIyNDo12YkXF3R7RBGJtZdMRWkeNNbMyUSBF3R/
"yield-star-spacing": ["error", "after"]
示例
after
L+G0pIYY6HS+68htOSqeL28y5hlfvDHE/jKyKCbX4Xmuy2ESLC2XRSlXeN8Ndy16XpCA3wvwm+bwTYjoiBx9YDDT4EzbUSUvYcbAR62MMZE=
/*eslint yield-star-spacing: ["error", "after"]*/
/*eslint-env es6*/
function* generator() {
yield* other();
}
before
1tb+eDg9lr3kv3DONP/OOQ9YvX9pDbGr05sVsXRFUSHU25O5HmsOq+q78PIU1fpxP0z1bt7/ZbiSS471WP1mmh1X9F7yWOf5CFNLwlPDqfk=
/*eslint yield-star-spacing: ["error", "before"]*/
/*eslint-env es6*/
function *generator() {
yield *other();
}
both
1tb+eDg9lr3kv3DONP/OOXmDqd3Q28pfrIq19EZg/aNaR9xY0u4ZERLbhu+1NvrP1Iq7FLlifuZRY5t5PLWKdb56zYiBqy5ib91eA/dnuXc=
/*eslint yield-star-spacing: ["error", "both"]*/
/*eslint-env es6*/
function * generator() {
yield * other();
}
neither
1tb+eDg9lr3kv3DONP/OOesDNr6DvX0ccB6gAPd+TqHKdE/OoHDstFVHhCCQfz2m6OHhSsIDQBSWBO0ax7d3X4JCcA3RHNeK5UUVKyeowqc=
/*eslint yield-star-spacing: ["error", "neither"]*/
/*eslint-env es6*/
function*generator() {
yield*other();
}
何时不使用
bXwn3C5b/3ZiP/zBB3b+PalxSFTa+xn4QnZpNDurBnSsL1VqZDOWqQEhvz/r7/vXpseN3XGz74d4dlbMHZn4rhBVM7X3/cc4GW4FG6v9qmN1a2m3y/Ran2EPq0nrlcHpEmSB7MXV8Bw8hhbqFKNkxg==