Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix no-negated-condition linting issues (#22808)

Jarek Radosz92d2ea008ed4
diff --git a/.template-lintrc.js b/.template-lintrc.js
index 18ffe7b89b2..2c70a9c5068 100644
--- a/.template-lintrc.js
+++ b/.template-lintrc.js
@@ -22,7 +22,6 @@ module.exports = {
"no-implicit-this": {
allow: ["loading-spinner"],
},
- "no-negated-condition": false,
"no-obscure-array-access": false,
"require-mandatory-role-attributes": false,
"require-media-caption": false,
diff --git a/app/assets/javascripts/discourse/app/components/modal/history/topic-footer.hbs b/app/assets/javascripts/discourse/app/components/modal/history/topic-footer.hbs
index 85c13c89a4f..fc2f24c0675 100644
--- a/app/assets/javascripts/discourse/app/components/modal/history/topic-footer.hbs
+++ b/app/assets/javascripts/discourse/app/components/modal/history/topic-footer.hbs
@@ -53,15 +53,7 @@
@disabled={{@loading}}
/>
- {{#if (not @model.previous_hidden)}}
- <DButton
- @action={{@hideVersion}}
- @icon="far-eye-slash"
- @label="post.revisions.controls.hide"
- class="btn-danger hide-revision"
- @disabled={{@loading}}
- />
- {{else}}
+ {{#if @model.previous_hidden}}
<DButton
@action={{@showVersion}}
@icon="far-eye"
@@ -69,6 +61,14 @@
class="btn-default show-revision"
@disabled={{@loading}}
/>
+ {{else}}
+ <DButton
+ @action={{@hideVersion}}
+ @icon="far-eye-slash"
+ @label="post.revisions.controls.hide"
+ class="btn-danger hide-revision"
+ @disabled={{@loading}}
+ />
{{/if}}
{{#if (and @canPermanentlyDelete @model.previous_hidden)}}
diff --git a/app/assets/javascripts/discourse/app/templates/preferences.hbs b/app/assets/javascripts/discourse/app/templates/preferences.hbs
index cc8cfd4da26..16435e6cb84 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences.hbs
+++ b/app/assets/javascripts/discourse/app/templates/preferences.hbs
@@ -76,7 +76,7 @@
<span>{{i18n "user.preferences_nav.interface"}}</span>
</DNavigationItem>
- {{#if (not (eq this.siteSettings.navigation_menu "legacy"))}}
+ {{#if (not-eq this.siteSettings.navigation_menu "legacy")}}
<DNavigationItem
@route="preferences.navigation-menu"
@ariaCurrentContext="subNav"
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-emoji-picker.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-emoji-picker.hbs
index 06e3902e0d9..f8589e43640 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-emoji-picker.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-emoji-picker.hbs
@@ -40,9 +40,7 @@
{{#each this.fitzpatrickModifiers as |fitzpatrick|}}
{{#if
- (not
- (eq fitzpatrick.scale this.chatEmojiReactionStore.diversity)
- )
+ (not-eq fitzpatrick.scale this.chatEmojiReactionStore.diversity)
}}
<button
type="button"
@@ -82,7 +80,7 @@
</div>
{{#if this.chatEmojiPickerManager.sections.length}}
- {{#if (not (gte this.filteredEmojis.length 0))}}
+ {{#if (eq this.filteredEmojis null)}}
<div class="chat-emoji-picker__sections-nav">
<div
class="chat-emoji-picker__sections-nav__indicator"
@@ -129,7 +127,7 @@
{{on "keydown" this.onSectionsKeyDown}}
role="button"
>
- {{#if (gte this.filteredEmojis.length 0)}}
+ {{#if (not-eq this.filteredEmojis null)}}
<div class="chat-emoji-picker__section filtered">
{{#each this.filteredEmojis as |emoji|}}
<img
@@ -162,7 +160,7 @@
<div
class={{concat-class
"chat-emoji-picker__section"
- (if (gte this.filteredEmojis.length 0) "hidden")
+ (if (not-eq this.filteredEmojis null) "hidden")
}}
data-section={{section}}
role="region"