useYield
诊断类别:lint/correctness/useYield
¥Diagnostic Category: lint/correctness/useYield
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
require-yield
¥Same as:
require-yield
要求生成器函数包含 yield
。
¥Require generator functions to contain yield
.
此规则会为没有 yield
关键字的生成器函数生成警告。
¥This rule generates warnings for generator functions that do not have the yield
keyword.
¥Examples
¥Invalid
code-block.js:1:1 lint/correctness/useYield ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This generator function doesn’t contain yield.
> 1 │ function* foo() {
│ ^^^^^^^^^^^^^^^^^
> 2 │ return 10;
> 3 │ }
│ ^
4 │
¥Valid
¥Related links