Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.02 KB

File metadata and controls

53 lines (39 loc) · 1.02 KB

ember/template-no-negated-comparison

💼 This rule is enabled in the following configs: strict-gjs, strict-gts.

Disallows negated comparison operators in templates.

Rule Details

Use positive comparison operators with {{unless}} instead of negated comparison operators like not-eq or ne.

Examples

Examples of incorrect code for this rule:

<template>
  {{#if (not-eq this.value 5)}}
    Not equal
  {{/if}}
</template>
<template>
  {{#if (ne this.a this.b)}}
    Not equal
  {{/if}}
</template>

Examples of correct code for this rule:

<template>
  {{#unless (eq this.value 5)}}
    Not equal
  {{/unless}}
</template>
<template>
  {{#if (eq this.value 5)}}
    Equal
  {{/if}}
</template>

References