require-yield
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"require-yield": "error",
},
},
];function* foo() {
return 10;
}function* foo() {
yield 5;
return 10;
}
function bar() {
return 10;
}
// This rule does not warn on empty generator functions.
function* baz() { }Examples from the ESLint documentation.
require-yield
eslint
export default [
{
rules: {
"require-yield": "error",
},
},
];require-yield
eslint plugin · correctness
{
"rules": {
"require-yield": "error"
}
}correctness/useYield
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"useYield": "error"
}
}
}
}Disallow unnecessary catch clauses
Disallow control flow statements in finally blocks
Disallow literal numbers that lose precision
Disallow characters which are made with multiple code points in character class syntax
Disallow constant expressions in conditions