Skip to content

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

DEV: Fix linting issues in core plugins (#14916)

Jarek Radosz906a71a60728
diff --git a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js
index f3b3a54dacf..1f092621040 100644
--- a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js
+++ b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js
@@ -7,6 +7,7 @@ import I18n from "I18n";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { test } from "qunit";
+import { click, fillIn, visit } from "@ember/test-helpers";
acceptance("Details Button", function (needs) {
needs.user();
diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js
index 2fdfa3f6690..f1a95cfaa33 100644
--- a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js
+++ b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js
@@ -12,6 +12,7 @@ import loadScript from "discourse/lib/load-script";
import { notEmpty } from "@ember/object/computed";
import { propertyNotEqual } from "discourse/lib/computed";
import { schedule } from "@ember/runloop";
+import { getOwner } from "discourse-common/lib/get-owner";
export default Component.extend({
timeFormat: "HH:mm:ss",
@@ -435,7 +436,7 @@ export default Component.extend({
},
_closeModal() {
- const composer = Discourse.__container__.lookup("controller:composer");
+ const composer = getOwner(this).lookup("controller:composer");
composer.send("closeModal");
},
});
diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js
index e5502fc0f8f..b45d5e440f2 100644
--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js
+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js
@@ -1,5 +1,6 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
+import { click, fillIn, visit } from "@ember/test-helpers";
acceptance("Local Dates - composer", function (needs) {
needs.user();
diff --git a/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js b/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js
index 83782fd67f7..a419beee5e5 100644
--- a/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js
+++ b/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js
@@ -1,7 +1,7 @@
import I18n from "I18n";
import LocalDateBuilder from "./local-date-builder";
import sinon from "sinon";
-import { module, test } from "qunit";
+import QUnit, { module, test } from "qunit";
const UTC = "Etc/UTC";
const SYDNEY = "Australia/Sydney";
diff --git a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js
index 32c8f489794..3500f13a214 100644
--- a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js
+++ b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js
@@ -1,6 +1,7 @@
import {
acceptance,
count,
+ exists,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
diff --git a/plugins/poll/assets/javascripts/controllers/poll-breakdown.js b/plugins/poll/assets/javascripts/controllers/poll-breakdown.js
index 794efa0de3f..77d1c1e7a62 100644
--- a/plugins/poll/assets/javascripts/controllers/poll-breakdown.js
+++ b/plugins/poll/assets/javascripts/controllers/poll-breakdown.js
@@ -8,6 +8,7 @@ import discourseComputed from "discourse-common/utils/decorators";
import { htmlSafe } from "@ember/template";
import loadScript from "discourse/lib/load-script";
import { popupAjaxError } from "discourse/lib/ajax-error";
+import bootbox from "bootbox";
export default Controller.extend(ModalFunctionality, {
model: null,
diff --git a/plugins/poll/assets/javascripts/widgets/discourse-poll.js b/plugins/poll/assets/javascripts/widgets/discourse-poll.js
index 138f0b8b0c0..3b1dfa5bd3a 100644
--- a/plugins/poll/assets/javascripts/widgets/discourse-poll.js
+++ b/plugins/poll/assets/javascripts/widgets/discourse-poll.js
@@ -13,6 +13,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { relativeAge } from "discourse/lib/formatter";
import round from "discourse/lib/round";
import showModal from "discourse/lib/show-modal";
+import bootbox from "bootbox";
const FETCH_VOTERS_COUNT = 25;
diff --git a/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js b/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js
index c901fefc247..750a0530782 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js
@@ -6,7 +6,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
-import { visit } from "@ember/test-helpers";
+import { click, visit } from "@ember/test-helpers";
acceptance("Poll breakdown", function (needs) {
needs.user();
diff --git a/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js b/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js
index 7399ee3aac6..7e8e011e352 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js
@@ -1,7 +1,7 @@
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
-import { visit } from "@ember/test-helpers";
+import { click, visit } from "@ember/test-helpers";
acceptance("Poll in a post reply history", function (needs) {
needs.user();
diff --git a/plugins/poll/test/javascripts/acceptance/poll-quote-test.js b/plugins/poll/test/javascripts/acceptance/poll-quote-test.js
index 80034ed73d2..491aa00ecd8 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-quote-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-quote-test.js
@@ -1,7 +1,7 @@
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
-import { visit } from "@ember/test-helpers";
+import { click, visit } from "@ember/test-helpers";
acceptance("Poll quote", function (needs) {
needs.user();
diff --git a/plugins/poll/test/javascripts/acceptance/poll-results-test.js b/plugins/poll/test/javascripts/acceptance/poll-results-test.js
index 16fbe4f8a35..5a7e52da2ad 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-results-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-results-test.js
@@ -6,7 +6,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
-import { visit } from "@ember/test-helpers";
+import { click, visit } from "@ember/test-helpers";
acceptance("Poll results", function (needs) {
needs.user();
@@ -568,11 +568,11 @@ acceptance("Poll results", function (needs) {
await visit("/t/-/load-more-poll-voters");
assert.strictEqual(
- find(".poll-container .results li:nth-child(1) .poll-voters li").length,
+ count(".poll-container .results li:nth-child(1) .poll-voters li"),
1
);
assert.strictEqual(
- find(".poll-container .results li:nth-child(2) .poll-voters li").length,
+ count(".poll-container .results li:nth-child(2) .poll-voters li"),
0
);
@@ -627,11 +627,11 @@ acceptance("Poll results", function (needs) {
await visit("/t/-/load-more-poll-voters");
assert.strictEqual(
- find(".poll-container .results li:nth-child(1) .poll-voters li").length,
+ count(".poll-container .results li:nth-child(1) .poll-voters li"),
1
);
assert.strictEqual(
- find(".poll-container .results li:nth-child(2) .poll-voters li").length,
+ count(".poll-container .results li:nth-child(2) .poll-voters li"),
1
);
@@ -639,11 +639,11 @@ acceptance("Poll results", function (needs) {
await visit("/t/-/load-more-poll-voters");
assert.strictEqual(
- find(".poll-container .results li:nth-child(1) .poll-voters li").length,
+ count(".poll-container .results li:nth-child(1) .poll-voters li"),
2
);
assert.strictEqual(
- find(".poll-container .results li:nth-child(2) .poll-voters li").length,
+ count(".poll-container .results li:nth-child(2) .poll-voters li"),
0
);
});
diff --git a/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-desktop.js b/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-desktop.js
index 6dba78ed0ee..36363f9acf2 100644
--- a/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-desktop.js
+++ b/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-desktop.js
@@ -1,7 +1,7 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
-import { visit } from "@ember/test-helpers";
+import { click, visit } from "@ember/test-helpers";
acceptance("Rendering polls with bar charts - desktop", function (needs) {
needs.user();
diff --git a/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-mobile.js b/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-mobile.js
index ac31c45f72a..44c74c26856 100644
--- a/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-mobile.js
+++ b/plugins/poll/test/javascripts/acceptance/polls-bar-chart-test-mobile.js
@@ -1,7 +1,7 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
-import { visit } from "@ember/test-helpers";
+import { click, visit } from "@ember/test-helpers";
acceptance("Rendering polls with bar charts - mobile", function (needs) {
needs.user();
diff --git a/plugins/poll/test/javascripts/widgets/discourse-poll-test.js b/plugins/poll/test/javascripts/widgets/discourse-poll-test.js
index 572a564f19e..431c50de335 100644
--- a/plugins/poll/test/javascripts/widgets/discourse-poll-test.js
+++ b/plugins/poll/test/javascripts/widgets/discourse-poll-test.js
@@ -11,6 +11,7 @@ import EmberObject from "@ember/object";
import I18n from "I18n";
import pretender from "discourse/tests/helpers/create-pretender";
import hbs from "htmlbars-inline-precompile";
+import { click } from "@ember/test-helpers";
let requests = 0;