Fix eslint warnings

This commit is contained in:
Penar Musaraj 2019-06-14 12:10:11 -04:00
parent 8c3fe62e90
commit 203e14b639
12 changed files with 16 additions and 27 deletions

View File

@ -1,8 +1,6 @@
import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component"; import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
const currentUser = Discourse.User.current();
const data = { const data = {
"topic-list-top": {}, "topic-list-top": {},
"topic-above-post-stream": {}, "topic-above-post-stream": {},

View File

@ -1,22 +1,19 @@
import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component"; import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
import { import {
default as computed, default as computed
observes
} from "ember-addons/ember-computed-decorators"; } from "ember-addons/ember-computed-decorators";
const currentUser = Discourse.User.current(), const serve_id = Discourse.SiteSettings.carbonads_serve_id,
serve_id = Discourse.SiteSettings.carbonads_serve_id,
placement = Discourse.SiteSettings.carbonads_placement; placement = Discourse.SiteSettings.carbonads_placement;
export default AdComponent.extend({ export default AdComponent.extend({
init() { init() {
this.set("serve_id", serve_id); this.set("serve_id", serve_id);
this.set("placement", placement);
this._super(); this._super();
}, },
@computed("serve_id", "placement") @computed("serve_id")
url(serveId, placement) { url(serveId) {
return `//cdn.carbonads.com/carbon.js?serve=${serveId}&placement=${placement}`.htmlSafe(); return `//cdn.carbonads.com/carbon.js?serve=${serveId}&placement=${placement}`.htmlSafe();
}, },

View File

@ -7,8 +7,7 @@ import {
let _loaded = false, let _loaded = false,
_promise = null; _promise = null;
const currentUser = Discourse.User.current(), const propertyId = Discourse.SiteSettings.codefund_property_id;
propertyId = Discourse.SiteSettings.codefund_property_id;
function loadCodeFund() { function loadCodeFund() {
if (_loaded) { if (_loaded) {
@ -78,7 +77,10 @@ export default AdComponent.extend({
this.set("adDetails", data); this.set("adDetails", data);
this.set("adRequested", false); this.set("adRequested", false);
}) })
.catch(error => console.log(error)); .catch(error => {
// eslint-disable-next-line no-console
console.log(error);
});
}, },
didInsertElement() { didInsertElement() {

View File

@ -7,7 +7,6 @@ import loadScript from "discourse/lib/load-script";
let _loaded = false, let _loaded = false,
_promise = null, _promise = null,
currentUser = Discourse.User.current(),
publisher_id = Discourse.SiteSettings.adsense_publisher_code; publisher_id = Discourse.SiteSettings.adsense_publisher_code;
const mobileView = Discourse.Site.currentProp("mobileView"); const mobileView = Discourse.Site.currentProp("mobileView");

View File

@ -1,7 +1,6 @@
import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component"; import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
import { import {
default as computed, default as computed,
observes,
on on
} from "ember-addons/ember-computed-decorators"; } from "ember-addons/ember-computed-decorators";
import loadScript from "discourse/lib/load-script"; import loadScript from "discourse/lib/load-script";
@ -48,7 +47,7 @@ function custom_targeting(key_array, value_array, adSlot) {
adSlot.setTargeting( adSlot.setTargeting(
key_array[i], key_array[i],
valueParse(value_array[i]) valueParse(value_array[i])
) );
} }
} }
} }
@ -191,6 +190,7 @@ function loadGoogle() {
_promise = loadScript(dfpSrc, { scriptTag: true }).then(function() { _promise = loadScript(dfpSrc, { scriptTag: true }).then(function() {
_loaded = true; _loaded = true;
if (window.googletag === undefined) { if (window.googletag === undefined) {
// eslint-disable-next-line no-console
console.log("googletag is undefined!"); console.log("googletag is undefined!");
} }

View File

@ -1,8 +1,7 @@
import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component"; import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
import { import {
default as computed, default as computed,
observes, observes
on
} from "ember-addons/ember-computed-decorators"; } from "ember-addons/ember-computed-decorators";
const adIndex = { const adIndex = {

View File

@ -1,5 +1,4 @@
import MultiSelectComponent from "select-kit/components/multi-select"; import MultiSelectComponent from "select-kit/components/multi-select";
import computed from "ember-addons/ember-computed-decorators";
const { makeArray } = Ember; const { makeArray } = Ember;
export default MultiSelectComponent.extend({ export default MultiSelectComponent.extend({

View File

@ -1,6 +1,3 @@
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import computed from "ember-addons/ember-computed-decorators";
import HouseAdsSetting from "discourse/plugins/discourse-adplugin/discourse/components/house-ads-setting"; import HouseAdsSetting from "discourse/plugins/discourse-adplugin/discourse/components/house-ads-setting";
export default HouseAdsSetting.extend({ export default HouseAdsSetting.extend({

View File

@ -1,7 +1,6 @@
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n, propertyNotEqual } from "discourse/lib/computed"; import { i18n, propertyNotEqual } from "discourse/lib/computed";
import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({ export default Ember.Component.extend({
classNames: "house-ads-setting", classNames: "house-ads-setting",
@ -32,7 +31,7 @@ export default Ember.Component.extend({
data: { value: this.get("adValue") } data: { value: this.get("adValue") }
} }
) )
.then(data => { .then(() => {
const adSettings = this.get("adSettings"); const adSettings = this.get("adSettings");
adSettings.set(this.get("name"), this.get("adValue")); adSettings.set(this.get("name"), this.get("adValue"));
this.setProperties({ this.setProperties({

View File

@ -41,12 +41,12 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
data data
} }
) )
.then(data => { .then(ajaxData => {
this.commitBuffer(); this.commitBuffer();
this.set("savingStatus", I18n.t("saved")); this.set("savingStatus", I18n.t("saved"));
if (newRecord) { if (newRecord) {
const model = this.get("model"); const model = this.get("model");
model.set("id", data.house_ad.id); model.set("id", ajaxData.house_ad.id);
const houseAds = this.get("adminPluginsHouseAds.model"); const houseAds = this.get("adminPluginsHouseAds.model");
if (!houseAds.includes(model)) { if (!houseAds.includes(model)) {
houseAds.pushObject(model); houseAds.pushObject(model);

View File

@ -3,7 +3,7 @@ import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({ export default Discourse.Route.extend({
settings: null, settings: null,
model(params) { model() {
return ajax("/admin/plugins/adplugin/house_ads.json").then(data => { return ajax("/admin/plugins/adplugin/house_ads.json").then(data => {
this.set("settings", Ember.Object.create(data.settings)); this.set("settings", Ember.Object.create(data.settings));
return data.house_ads.map(ad => Ember.Object.create(ad)); return data.house_ads.map(ad => Ember.Object.create(ad));

View File

@ -1,4 +1,3 @@
import PostModel from "discourse/models/post";
import { withPluginApi } from "discourse/lib/plugin-api"; import { withPluginApi } from "discourse/lib/plugin-api";
export default { export default {