useYield
Summary
Section titled “Summary”- Rule available since: 
v1.0.0 - Diagnostic Category: 
lint/correctness/useYield - This rule is recommended, which means is enabled by default.
 - This rule doesn’t have a fix.
 - The default severity of this rule is error.
 - Sources:
- Same as 
require-yield 
 - Same as 
 
How to configure
Section titled “How to configure”{  "linter": {    "rules": {      "correctness": {        "useYield": "error"      }    }  }}Description
Section titled “Description”Require generator functions to contain yield.
This rule generates warnings for generator functions that do not have the yield keyword.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”function* foo() {  return 10;}code-block.js:1:1 lint/correctness/useYield ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ This generator function doesn’t contain yield.
  
  > 1 │ function* foo() {
      │ ^^^^^^^^^^^^^^^^^
  > 2 │   return 10;
  > 3 │ }
      │ ^
    4 │ 
  
function* foo() {  yield 5;  return 10;}
function foo() {  return 10;}
// This rule does not warn on empty generator functions.function* foo() { }Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.