no-return-assign
Configuration
rslint.config.ts
Rule Details
This rule aims to eliminate assignments from return statements, because it is difficult to tell whether the author intended an assignment or a mistyped comparison.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
This rule takes a single string option:
"except-parens"(default) — disallow assignments inreturnstatements unless they are enclosed in parentheses."always"— disallow all assignments inreturnstatements, even when parenthesised.
Examples of incorrect code for this rule with "always":
Examples of correct code for this rule with "always":