Skip to main content

no-unused-expressions

Disallow unused expressions.

Examples

This rule extends the base eslint/no-unused-expressions rule. It adds support for optional call expressions x?.(), and directive in module declarations.

Options

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "error"
}
};
Try this rule in the playground ↗

See eslint/no-unused-expressions options.

How to Use

Resources

Taken with ❤️ from ESLint core