no-unused-expressions
Configuration
rslint.config.ts
Rule Details
Disallow expression statements that do not affect program state.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
This rule has an object option:
allowShortCircuit(default:false): allow short-circuit expressions when the right-hand side has an accepted side effect.allowTernary(default:false): allow ternary expressions when both branches have accepted side effects.allowTaggedTemplates(default:false): allow tagged template expression statements.enforceForJSX(default:false): report unused JSX expression statements.ignoreDirectives(default:false): accepted for ESLint config compatibility; directive prologues are always allowed in rslint.
Examples of correct code for this rule with { "allowShortCircuit": true }:
Examples of correct code for this rule with { "allowTernary": true }:
Examples of correct code for this rule with { "allowTaggedTemplates": true }:
Examples of incorrect code for this rule with { "enforceForJSX": true }: