useYield
此内容尚不支持你的语言。
Diagnostic Category: lint/correctness/useYield
Since: v1.0.0
Sources:
- Same as:
require-yield
Require generator functions to contain yield
.
This rule generates warnings for generator functions that do not have the yield
keyword.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:1:1 lint/correctness/useYield ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This generator function doesn’t contain yield.
> 1 │ function* foo() {
│ ^^^^^^^^^^^^^^^^^
> 2 │ return 10;
> 3 │ }
│ ^
4 │