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 computed from "ember-addons/ember-computed-decorators";
const currentUser = Discourse.User.current();
const data = {
"topic-list-top": {},
"topic-above-post-stream": {},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,12 +41,12 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
data
}
)
.then(data => {
.then(ajaxData => {
this.commitBuffer();
this.set("savingStatus", I18n.t("saved"));
if (newRecord) {
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");
if (!houseAds.includes(model)) {
houseAds.pushObject(model);

View File

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