yield
(require-yield)The "extends": "eslint:recommended"
property in a configuration file enables this rule.
This rule generates warnings for generator functions that do not have the yield
keyword.
Examples of incorrect code for this rule:
/*eslint require-yield: "error"*/ /*eslint-env es6*/ function* foo() { return 10; }
Examples of correct code for this rule:
/*eslint require-yield: "error"*/ /*eslint-env es6*/ function* foo() { yield 5; return 10; } function foo() { return 10; } // This rule does not warn on empty generator functions. function* foo() { }
If you don’t want to notify generator functions that have no yield
expression, then it’s safe to disable this rule.
This rule was introduced in ESLint 1.0.0-rc-1.
© JS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/rules/require-yield