Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 913 Bytes

File metadata and controls

45 lines (32 loc) · 913 Bytes

ember/template-no-negated-condition

✅ The extends: 'plugin:ember/strict-gjs' or extends: 'plugin:ember/strict-gts' property in a configuration file enables this rule.

Disallow negated conditions in {{#if}} blocks. Use {{#unless}} instead or rewrite the condition.

Rule Details

This rule discourages the use of {{#if (not condition)}} in favor of {{#unless condition}} for better readability.

Examples

Examples of incorrect code for this rule:

<template>
  {{#if (not isValid)}}
    Invalid
  {{/if}}
</template>

Examples of correct code for this rule:

<template>
  {{#unless isValid}}
    Invalid
  {{/unless}}
</template>

<template>
  {{#if isValid}}
    Valid
  {{/if}}
</template>
  • strictGjs: true
  • strictGts: true