DEV: Respect radix rule in eslint-config-discourse 1.0.6

This commit is contained in:
Penar Musaraj 2019-11-18 10:07:55 -05:00
parent a3e3dbf24b
commit b59f841944
6 changed files with 44 additions and 26 deletions

View File

@ -142,6 +142,6 @@ export default AdComponent.extend({
if (!postNumber) {
return true;
}
return this.isNthPost(parseInt(this.siteSettings.adbutler_nth_post));
return this.isNthPost(parseInt(this.siteSettings.adbutler_nth_post, 10));
}
});

View File

@ -15,10 +15,12 @@ if (
data["topic-list-top"]["user_input"] =
Discourse.SiteSettings.amazon_topic_list_top_src_code;
data["topic-list-top"]["amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_topic_list_top_ad_width_code
Discourse.SiteSettings.amazon_topic_list_top_ad_width_code,
10
);
data["topic-list-top"]["amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_topic_list_top_ad_height_code
Discourse.SiteSettings.amazon_topic_list_top_ad_height_code,
10
);
}
@ -29,10 +31,12 @@ if (
data["topic-list-top"]["user_input_mobile"] =
Discourse.SiteSettings.amazon_mobile_topic_list_top_src_code;
data["topic-list-top"]["mobile_amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_mobile_topic_list_top_ad_width_code
Discourse.SiteSettings.amazon_mobile_topic_list_top_ad_width_code,
10
);
data["topic-list-top"]["mobile_amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_mobile_topic_list_top_ad_height_code
Discourse.SiteSettings.amazon_mobile_topic_list_top_ad_height_code,
10
);
}
@ -43,10 +47,12 @@ if (
data["topic-above-post-stream"]["user_input"] =
Discourse.SiteSettings.amazon_topic_above_post_stream_src_code;
data["topic-above-post-stream"]["amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_topic_above_post_stream_ad_width_code
Discourse.SiteSettings.amazon_topic_above_post_stream_ad_width_code,
10
);
data["topic-above-post-stream"]["amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_topic_above_post_stream_ad_height_code
Discourse.SiteSettings.amazon_topic_above_post_stream_ad_height_code,
10
);
}
@ -57,10 +63,12 @@ if (
data["topic-above-post-stream"]["user_input_mobile"] =
Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_src_code;
data["topic-above-post-stream"]["mobile_amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_ad_width_code
Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_ad_width_code,
10
);
data["topic-above-post-stream"]["mobile_amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_ad_height_code
Discourse.SiteSettings.amazon_mobile_topic_above_post_stream_ad_height_code,
10
);
}
@ -71,10 +79,12 @@ if (
data["topic-above-suggested"]["user_input"] =
Discourse.SiteSettings.amazon_topic_above_suggested_src_code;
data["topic-above-suggested"]["amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_topic_above_suggested_ad_width_code
Discourse.SiteSettings.amazon_topic_above_suggested_ad_width_code,
10
);
data["topic-above-suggested"]["amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_topic_above_suggested_ad_height_code
Discourse.SiteSettings.amazon_topic_above_suggested_ad_height_code,
10
);
}
@ -85,10 +95,12 @@ if (
data["topic-above-suggested"]["user_input_mobile"] =
Discourse.SiteSettings.amazon_mobile_topic_above_suggested_src_code;
data["topic-above-suggested"]["mobile_amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_mobile_topic_above_suggested_ad_width_code
Discourse.SiteSettings.amazon_mobile_topic_above_suggested_ad_width_code,
10
);
data["topic-above-suggested"]["mobile_amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_mobile_topic_above_suggested_ad_height_code
Discourse.SiteSettings.amazon_mobile_topic_above_suggested_ad_height_code,
10
);
}
@ -99,10 +111,12 @@ if (
data["post-bottom"]["user_input"] =
Discourse.SiteSettings.amazon_post_bottom_src_code;
data["post-bottom"]["amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_post_bottom_ad_width_code
Discourse.SiteSettings.amazon_post_bottom_ad_width_code,
10
);
data["post-bottom"]["amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_post_bottom_ad_height_code
Discourse.SiteSettings.amazon_post_bottom_ad_height_code,
10
);
}
@ -113,10 +127,12 @@ if (
data["post-bottom"]["user_input_mobile"] =
Discourse.SiteSettings.amazon_mobile_post_bottom_src_code;
data["post-bottom"]["mobile_amazon_width"] = parseInt(
Discourse.SiteSettings.amazon_mobile_post_bottom_ad_width_code
Discourse.SiteSettings.amazon_mobile_post_bottom_ad_width_code,
10
);
data["post-bottom"]["mobile_amazon_height"] = parseInt(
Discourse.SiteSettings.amazon_mobile_post_bottom_ad_height_code
Discourse.SiteSettings.amazon_mobile_post_bottom_ad_height_code,
10
);
}
@ -180,6 +196,6 @@ export default AdComponent.extend({
return true;
}
return this.isNthPost(parseInt(this.siteSettings.amazon_nth_post_code));
return this.isNthPost(parseInt(this.siteSettings.amazon_nth_post_code, 10));
}
});

View File

@ -136,6 +136,6 @@ export default AdComponent.extend({
return true;
}
return this.isNthPost(parseInt(this.siteSettings.codefund_nth_post));
return this.isNthPost(parseInt(this.siteSettings.codefund_nth_post, 10));
}
});

View File

@ -14,7 +14,7 @@ function parseAdWidth(value) {
if (value === "responsive") {
return "auto";
}
const w = parseInt(value.substring(0, 3).trim());
const w = parseInt(value.substring(0, 3).trim(), 10);
if (isNaN(w)) {
return "auto";
} else {
@ -26,7 +26,7 @@ function parseAdHeight(value) {
if (value === "responsive") {
return "auto";
}
const h = parseInt(value.substring(4, 7).trim());
const h = parseInt(value.substring(4, 7).trim(), 10);
if (isNaN(h)) {
return "auto";
} else {
@ -225,6 +225,8 @@ export default AdComponent.extend({
return true;
}
return this.isNthPost(parseInt(this.siteSettings.adsense_nth_post_code));
return this.isNthPost(
parseInt(this.siteSettings.adsense_nth_post_code, 10)
);
}
});

View File

@ -127,8 +127,8 @@ function getWidthAndHeight(placement, settings, isMobile) {
}
const sizeObj = {
width: parseInt(splitWidthInt(size)),
height: parseInt(splitHeightInt(size))
width: parseInt(splitWidthInt(size), 10),
height: parseInt(splitHeightInt(size), 10)
};
if (!isNaN(sizeObj.width) && !isNaN(sizeObj.height)) {
@ -328,7 +328,7 @@ export default AdComponent.extend({
return true;
}
return this.isNthPost(parseInt(this.siteSettings.dfp_nth_post_code));
return this.isNthPost(parseInt(this.siteSettings.dfp_nth_post_code, 10));
},
// 3 second delay between calls to refresh ads in a component.

View File

@ -33,7 +33,7 @@ export default AdComponent.extend({
}
return this.isNthPost(
parseInt(this.site.get("house_creatives.settings.after_nth_post"))
parseInt(this.site.get("house_creatives.settings.after_nth_post"), 10)
);
},