mirror of https://github.com/zulip/zulip.git
eslint: Fix no-implicit-coercion.
https://eslint.org/docs/rules/no-implicit-coercion Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
4fe06a141e
commit
5c8117a426
|
@ -54,6 +54,7 @@
|
|||
"no-else-return": "error",
|
||||
"no-eq-null": "error",
|
||||
"no-eval": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-inner-declarations": "off",
|
||||
"no-iterator": "error",
|
||||
|
|
|
@ -145,7 +145,7 @@ run_test("snapshot_message", () => {
|
|||
return draft.type;
|
||||
};
|
||||
global.compose_state.composing = function () {
|
||||
return !!draft.type;
|
||||
return Boolean(draft.type);
|
||||
};
|
||||
global.compose_state.message_content = function () {
|
||||
return draft.content;
|
||||
|
|
|
@ -13,7 +13,7 @@ exports.get_message_type = function () {
|
|||
exports.composing = function () {
|
||||
// This is very similar to get_message_type(), but it returns
|
||||
// a boolean.
|
||||
return !!message_type;
|
||||
return Boolean(message_type);
|
||||
};
|
||||
|
||||
exports.focus_in_empty_compose = function () {
|
||||
|
|
|
@ -201,9 +201,9 @@ exports.parse_image_data = function (image) {
|
|||
|
||||
// if wrapped in the .youtube-video class, it will be length = 1, and therefore
|
||||
// cast to true.
|
||||
const is_youtube_video = !!$image.closest(".youtube-video").length;
|
||||
const is_vimeo_video = !!$image.closest(".vimeo-video").length;
|
||||
const is_embed_video = !!$image.closest(".embed-video").length;
|
||||
const is_youtube_video = Boolean($image.closest(".youtube-video").length);
|
||||
const is_vimeo_video = Boolean($image.closest(".vimeo-video").length);
|
||||
const is_embed_video = Boolean($image.closest(".embed-video").length);
|
||||
|
||||
// check if image is descendent of #preview_content
|
||||
const is_compose_preview_image = $image.closest("#preview_content").length === 1;
|
||||
|
|
|
@ -163,7 +163,7 @@ exports.redraw_title = function () {
|
|||
// Make sure we're working with a number, as a defensive programming
|
||||
// measure. And we don't have images above 99, so display those as
|
||||
// 'infinite'.
|
||||
n = +new_message_count;
|
||||
n = Number(new_message_count);
|
||||
if (n > 99) {
|
||||
n = "infinite";
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function reset_state() {
|
|||
}
|
||||
|
||||
exports.is_active = function () {
|
||||
return !!open_overlay_name;
|
||||
return Boolean(open_overlay_name);
|
||||
};
|
||||
|
||||
exports.is_modal_open = function () {
|
||||
|
|
|
@ -175,7 +175,7 @@ function format_topic(topic_data) {
|
|||
// We only supply the data to the topic rows and let jquery
|
||||
// display / hide them according to filters instead of
|
||||
// doing complete re-render.
|
||||
const topic_muted = !!muting.is_topic_muted(stream_id, topic);
|
||||
const topic_muted = Boolean(muting.is_topic_muted(stream_id, topic));
|
||||
const stream_muted = stream_data.is_muted(stream_id);
|
||||
const muted = topic_muted || stream_muted;
|
||||
const unread_count = unread.unread_topic_counter.get(stream_id, topic);
|
||||
|
@ -266,7 +266,7 @@ exports.filters_should_hide_topic = function (topic_data) {
|
|||
}
|
||||
|
||||
if (!filters.has("include_muted")) {
|
||||
const topic_muted = !!muting.is_topic_muted(msg.stream_id, msg.topic);
|
||||
const topic_muted = Boolean(muting.is_topic_muted(msg.stream_id, msg.topic));
|
||||
const stream_muted = stream_data.is_muted(msg.stream_id);
|
||||
if (topic_muted || stream_muted) {
|
||||
return true;
|
||||
|
|
|
@ -733,7 +733,7 @@ exports.build_page = function () {
|
|||
$("#id_realm_message_content_edit_limit_minutes"),
|
||||
);
|
||||
// Disable editing if the parsed time limit is 0 seconds
|
||||
data.allow_message_editing = !!data.message_content_edit_limit_seconds;
|
||||
data.allow_message_editing = Boolean(data.message_content_edit_limit_seconds);
|
||||
} else {
|
||||
data.allow_message_editing = true;
|
||||
data.message_content_edit_limit_seconds = settings_config.msg_edit_limit_dropdown_values.get(
|
||||
|
@ -748,7 +748,7 @@ exports.build_page = function () {
|
|||
$("#id_realm_message_content_delete_limit_minutes"),
|
||||
);
|
||||
// Disable deleting if the parsed time limit is 0 seconds
|
||||
data.allow_message_deleting = !!data.message_content_delete_limit_seconds;
|
||||
data.allow_message_deleting = Boolean(data.message_content_delete_limit_seconds);
|
||||
} else {
|
||||
data.allow_message_deleting = true;
|
||||
data.message_content_delete_limit_seconds = settings_config.msg_delete_limit_dropdown_values.get(
|
||||
|
|
Loading…
Reference in New Issue