This rule checks that the value of an expression is assigned to a variable and thus helps promote side-effect free (pure) functions.
When you call a function and don’t use it’s return value, chances are high that it is being called for its side effect. e.g.
Examples of incorrect code for this rule:
/* eslint functional/no-expression-statement: "error" */
console.log("Hello world!");
/* eslint functional/no-expression-statement: "error" */
array.push(3);
/* eslint functional/no-expression-statement: "error" */
foo(bar);
Examples of correct code for this rule:
/* eslint functional/no-expression-statement: "error" */
const baz = foo(bar);
This rule accepts an options object of the following type:
{
ignorePattern?: string | Array<string>;
}
The default options:
{
}
Patterns will be matched against the line(s) of code. See the ignorePattern docs for more information.