mirror of https://github.com/zulip/zulip.git
eslint: Expand no-unused-vars check to all function parameters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
95f8ab1626
commit
407c16fc77
|
@ -93,7 +93,10 @@
|
||||||
"no-undef-init": "error",
|
"no-undef-init": "error",
|
||||||
"no-unneeded-ternary": ["error", {"defaultAssignment": false}],
|
"no-unneeded-ternary": ["error", {"defaultAssignment": false}],
|
||||||
"no-unused-expressions": "error",
|
"no-unused-expressions": "error",
|
||||||
"no-unused-vars": ["error", {"ignoreRestSiblings": true}],
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{"args": "all", "argsIgnorePattern": "^_", "ignoreRestSiblings": true}
|
||||||
|
],
|
||||||
"no-use-before-define": ["error", {"functions": false}],
|
"no-use-before-define": ["error", {"functions": false}],
|
||||||
"no-useless-concat": "error",
|
"no-useless-concat": "error",
|
||||||
"no-useless-constructor": "error",
|
"no-useless-constructor": "error",
|
||||||
|
@ -186,7 +189,10 @@
|
||||||
"@typescript-eslint/no-unsafe-call": "off",
|
"@typescript-eslint/no-unsafe-call": "off",
|
||||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||||
"@typescript-eslint/no-unsafe-return": "off",
|
"@typescript-eslint/no-unsafe-return": "off",
|
||||||
"@typescript-eslint/no-unused-vars": ["error", {"ignoreRestSiblings": true}],
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{"args": "all", "argsIgnorePattern": "^_", "ignoreRestSiblings": true}
|
||||||
|
],
|
||||||
"@typescript-eslint/no-use-before-define": ["error", {"functions": false}],
|
"@typescript-eslint/no-use-before-define": ["error", {"functions": false}],
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
"@typescript-eslint/promise-function-async": "error",
|
||||||
"import/no-cycle": "error",
|
"import/no-cycle": "error",
|
||||||
|
|
|
@ -43,7 +43,7 @@ async function checkFile(file) {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
visit(doc, {
|
visit(doc, {
|
||||||
Map(key, node) {
|
Map(_key, node) {
|
||||||
if (node.has("$ref") && node.items.length !== 1) {
|
if (node.has("$ref") && node.items.length !== 1) {
|
||||||
const {line, col} = lineCounter.linePos(node.range[0]);
|
const {line, col} = lineCounter.linePos(node.range[0]);
|
||||||
console.error("%s:%d:%d: Siblings of $ref have no effect", file, line, col);
|
console.error("%s:%d:%d: Siblings of $ref have no effect", file, line, col);
|
||||||
|
@ -51,7 +51,7 @@ async function checkFile(file) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Pair(key, node) {
|
Pair(_key, node) {
|
||||||
if (
|
if (
|
||||||
node.key instanceof Scalar &&
|
node.key instanceof Scalar &&
|
||||||
node.key.value === "allOf" &&
|
node.key.value === "allOf" &&
|
||||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
||||||
"formatjs",
|
"formatjs",
|
||||||
{
|
{
|
||||||
additionalFunctionNames: ["$t", "$t_html"],
|
additionalFunctionNames: ["$t", "$t_html"],
|
||||||
overrideIdFn: (id, defaultMessage) => defaultMessage,
|
overrideIdFn: (_id, defaultMessage) => defaultMessage,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
@ -102,7 +102,7 @@ export class BuddyList extends BuddyListConf {
|
||||||
|
|
||||||
get_items() {
|
get_items() {
|
||||||
const $obj = this.$container.find(`${this.item_sel}`);
|
const $obj = this.$container.find(`${this.item_sel}`);
|
||||||
return $obj.map((i, elem) => $(elem));
|
return $obj.map((_i, elem) => $(elem));
|
||||||
}
|
}
|
||||||
|
|
||||||
first_key() {
|
first_key() {
|
||||||
|
|
|
@ -327,7 +327,7 @@ export function handle_keydown(event, $textarea) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handle_keyup(event, $textarea) {
|
export function handle_keyup(_event, $textarea) {
|
||||||
// Set the rtl class if the text has an rtl direction, remove it otherwise
|
// Set the rtl class if the text has an rtl direction, remove it otherwise
|
||||||
rtl.set_rtl_class_for_textarea($textarea);
|
rtl.set_rtl_class_for_textarea($textarea);
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ function select_div($div, selection) {
|
||||||
selection.selectAllChildren($div[0]);
|
selection.selectAllChildren($div[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_div(div, ranges, selection) {
|
function remove_div(_div, ranges, selection) {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
selection = window.getSelection();
|
selection = window.getSelection();
|
||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
|
|
|
@ -30,7 +30,7 @@ export function show_flatpickr(element, callback, default_timestamp, options = {
|
||||||
disableMobile: true,
|
disableMobile: true,
|
||||||
time_24hr: user_settings.twenty_four_hour_time,
|
time_24hr: user_settings.twenty_four_hour_time,
|
||||||
minuteIncrement: 1,
|
minuteIncrement: 1,
|
||||||
onKeyDown(selectedDates, dateStr, instance, event) {
|
onKeyDown(_selectedDates, _dateStr, instance, event) {
|
||||||
// See also the keydown handler below.
|
// See also the keydown handler below.
|
||||||
//
|
//
|
||||||
// TODO: Add a clear explanation of exactly how key
|
// TODO: Add a clear explanation of exactly how key
|
||||||
|
|
|
@ -117,7 +117,7 @@ async function renderGIPHYGrid(targetEl) {
|
||||||
);
|
);
|
||||||
hide_giphy_popover();
|
hide_giphy_popover();
|
||||||
},
|
},
|
||||||
onGifVisible(gif, e) {
|
onGifVisible(_gif, e) {
|
||||||
// Set tabindex for all the GIFs that
|
// Set tabindex for all the GIFs that
|
||||||
// are visible to the user. This allows
|
// are visible to the user. This allows
|
||||||
// user to navigate the GIFs using tab.
|
// user to navigate the GIFs using tab.
|
||||||
|
|
|
@ -820,7 +820,7 @@ export function process_hotkey(e, hotkey) {
|
||||||
// Shortcuts that don't require a message
|
// Shortcuts that don't require a message
|
||||||
switch (event_name) {
|
switch (event_name) {
|
||||||
case "narrow_private":
|
case "narrow_private":
|
||||||
return do_narrow_action((target, opts) => {
|
return do_narrow_action((_target, opts) => {
|
||||||
narrow.by("is", "dm", opts);
|
narrow.by("is", "dm", opts);
|
||||||
});
|
});
|
||||||
case "query_streams":
|
case "query_streams":
|
||||||
|
|
|
@ -217,7 +217,7 @@ export function set_up_toggler() {
|
||||||
{label: $t({defaultMessage: "Message formatting"}), key: "message-formatting"},
|
{label: $t({defaultMessage: "Message formatting"}), key: "message-formatting"},
|
||||||
{label: $t({defaultMessage: "Search filters"}), key: "search-operators"},
|
{label: $t({defaultMessage: "Search filters"}), key: "search-operators"},
|
||||||
],
|
],
|
||||||
callback(name, key) {
|
callback(_name, key) {
|
||||||
$(".overlay-modal").hide();
|
$(".overlay-modal").hide();
|
||||||
$(`#${CSS.escape(key)}`).show();
|
$(`#${CSS.escape(key)}`).show();
|
||||||
scroll_util
|
scroll_util
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function translate_emoticons_to_names({src, get_emoticon_translations}) {
|
||||||
const terminal_symbols = ",.;?!()[] \"'\n\t"; // From composebox_typeahead
|
const terminal_symbols = ",.;?!()[] \"'\n\t"; // From composebox_typeahead
|
||||||
const symbols_except_space = terminal_symbols.replace(" ", "");
|
const symbols_except_space = terminal_symbols.replace(" ", "");
|
||||||
|
|
||||||
const emoticon_replacer = function (match, g1, offset, str) {
|
const emoticon_replacer = function (match, _g1, offset, str) {
|
||||||
const prev_char = str[offset - 1];
|
const prev_char = str[offset - 1];
|
||||||
const next_char = str[offset + match.length];
|
const next_char = str[offset + match.length];
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ export function maybe_load_newer_messages(opts) {
|
||||||
|
|
||||||
const anchor = get_frontfill_anchor(msg_list);
|
const anchor = get_frontfill_anchor(msg_list);
|
||||||
|
|
||||||
function load_more(data, args) {
|
function load_more(_data, args) {
|
||||||
if (args.fetch_again && args.msg_list === message_lists.current) {
|
if (args.fetch_again && args.msg_list === message_lists.current) {
|
||||||
maybe_load_newer_messages({msg_list: message_lists.current});
|
maybe_load_newer_messages({msg_list: message_lists.current});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1621,7 +1621,7 @@ export class MessageListView {
|
||||||
|
|
||||||
show_messages_as_unread(message_ids) {
|
show_messages_as_unread(message_ids) {
|
||||||
const $table = rows.get_table(this.table_name);
|
const $table = rows.get_table(this.table_name);
|
||||||
const $rows_to_show_as_unread = $table.find(".message_row").filter((index, $row) => {
|
const $rows_to_show_as_unread = $table.find(".message_row").filter((_index, $row) => {
|
||||||
const message_id = Number.parseFloat($row.getAttribute("zid"));
|
const message_id = Number.parseFloat($row.getAttribute("zid"));
|
||||||
return message_ids.includes(message_id);
|
return message_ids.includes(message_id);
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ export function focus_on_sibling_element(context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modals_handle_events(e, event_key, context) {
|
export function modals_handle_events(_e, event_key, context) {
|
||||||
initialize_focus(event_key, context);
|
initialize_focus(event_key, context);
|
||||||
|
|
||||||
// This detects up arrow key presses when the overlay
|
// This detects up arrow key presses when the overlay
|
||||||
|
|
|
@ -705,7 +705,7 @@ class Attacher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function get_search_result(base_query, query) {
|
export function get_search_result(_base_query, query) {
|
||||||
let suggestion;
|
let suggestion;
|
||||||
|
|
||||||
// search_operators correspond to the operators for the query in the input.
|
// search_operators correspond to the operators for the query in the input.
|
||||||
|
|
|
@ -19,7 +19,7 @@ export function initialize() {
|
||||||
{label: $t({defaultMessage: "Personal"}), key: "settings"},
|
{label: $t({defaultMessage: "Personal"}), key: "settings"},
|
||||||
{label: $t({defaultMessage: "Organization"}), key: "organization"},
|
{label: $t({defaultMessage: "Organization"}), key: "organization"},
|
||||||
],
|
],
|
||||||
callback(name, key) {
|
callback(_name, key) {
|
||||||
if (key === "organization") {
|
if (key === "organization") {
|
||||||
settings_panel_menu.show_org_settings();
|
settings_panel_menu.show_org_settings();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -267,7 +267,7 @@ export function setup_stream_settings(node) {
|
||||||
{label: $t({defaultMessage: "Personal"}), key: "personal_settings"},
|
{label: $t({defaultMessage: "Personal"}), key: "personal_settings"},
|
||||||
{label: $t({defaultMessage: "Subscribers"}), key: "subscriber_settings"},
|
{label: $t({defaultMessage: "Subscribers"}), key: "subscriber_settings"},
|
||||||
],
|
],
|
||||||
callback(name, key) {
|
callback(_name, key) {
|
||||||
$(".stream_section").hide();
|
$(".stream_section").hide();
|
||||||
$(`.${CSS.escape(key)}`).show();
|
$(`.${CSS.escape(key)}`).show();
|
||||||
select_tab = key;
|
select_tab = key;
|
||||||
|
|
|
@ -628,7 +628,7 @@ export function setup_page(callback) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
html_class: "stream_sorter_toggle",
|
html_class: "stream_sorter_toggle",
|
||||||
callback(value, key) {
|
callback(_value, key) {
|
||||||
switch_stream_sort(key);
|
switch_stream_sort(key);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -644,7 +644,7 @@ export function setup_page(callback) {
|
||||||
{label: $t({defaultMessage: "Subscribed"}), key: "subscribed"},
|
{label: $t({defaultMessage: "Subscribed"}), key: "subscribed"},
|
||||||
{label: $t({defaultMessage: "All streams"}), key: "all-streams"},
|
{label: $t({defaultMessage: "All streams"}), key: "all-streams"},
|
||||||
],
|
],
|
||||||
callback(value, key) {
|
callback(_value, key) {
|
||||||
switch_stream_tab(key);
|
switch_stream_tab(key);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -952,7 +952,7 @@ function ajaxSubscribe(stream, color, $stream_row) {
|
||||||
return channel.post({
|
return channel.post({
|
||||||
url: "/json/users/me/subscriptions",
|
url: "/json/users/me/subscriptions",
|
||||||
data: {subscriptions: JSON.stringify([{name: stream, color}])},
|
data: {subscriptions: JSON.stringify([{name: stream, color}])},
|
||||||
success(resp, statusText, xhr) {
|
success(_resp, _statusText, xhr) {
|
||||||
if (overlays.streams_open()) {
|
if (overlays.streams_open()) {
|
||||||
$("#create_stream_name").val("");
|
$("#create_stream_name").val("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ export class TaskData {
|
||||||
return event;
|
return event;
|
||||||
},
|
},
|
||||||
|
|
||||||
inbound: (sender_id, data) => {
|
inbound: (_sender_id, data) => {
|
||||||
// All message readers may strike/unstrike todo tasks.
|
// All message readers may strike/unstrike todo tasks.
|
||||||
const key = data.key;
|
const key = data.key;
|
||||||
if (typeof key !== "string") {
|
if (typeof key !== "string") {
|
||||||
|
|
|
@ -253,7 +253,7 @@ export function initialize_kitchen_sink_stuff() {
|
||||||
// the code here can probably be moved to more
|
// the code here can probably be moved to more
|
||||||
// specific-purpose modules like message_viewport.js.
|
// specific-purpose modules like message_viewport.js.
|
||||||
|
|
||||||
const throttled_mousewheelhandler = _.throttle((e, delta) => {
|
const throttled_mousewheelhandler = _.throttle((_e, delta) => {
|
||||||
// Most of the mouse wheel's work will be handled by the
|
// Most of the mouse wheel's work will be handled by the
|
||||||
// scroll handler, but when we're at the top or bottom of the
|
// scroll handler, but when we're at the top or bottom of the
|
||||||
// page, the pointer may still need to move.
|
// page, the pointer may still need to move.
|
||||||
|
|
|
@ -364,7 +364,7 @@ export function setup_upload(config) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
uppy.on("upload-error", (file, error, response) => {
|
uppy.on("upload-error", (file, _error, response) => {
|
||||||
const message = response ? response.body.msg : undefined;
|
const message = response ? response.body.msg : undefined;
|
||||||
show_error_message(config, message, file.id);
|
show_error_message(config, message, file.id);
|
||||||
compose_ui.replace_syntax(get_translated_status(file), "", get_item("textarea", config));
|
compose_ui.replace_syntax(get_translated_status(file), "", get_item("textarea", config));
|
||||||
|
|
|
@ -153,7 +153,7 @@ export function setup_group_settings(node) {
|
||||||
{label: $t({defaultMessage: "General"}), key: "group_general_settings"},
|
{label: $t({defaultMessage: "General"}), key: "group_general_settings"},
|
||||||
{label: $t({defaultMessage: "Members"}), key: "group_member_settings"},
|
{label: $t({defaultMessage: "Members"}), key: "group_member_settings"},
|
||||||
],
|
],
|
||||||
callback(name, key) {
|
callback(_name, key) {
|
||||||
$(".group_setting_section").hide();
|
$(".group_setting_section").hide();
|
||||||
$(`.${CSS.escape(key)}`).show();
|
$(`.${CSS.escape(key)}`).show();
|
||||||
select_tab = key;
|
select_tab = key;
|
||||||
|
|
|
@ -239,7 +239,7 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {
|
||||||
{label: $t({defaultMessage: "Streams"}), key: "user-profile-streams-tab"},
|
{label: $t({defaultMessage: "Streams"}), key: "user-profile-streams-tab"},
|
||||||
{label: $t({defaultMessage: "User groups"}), key: "user-profile-groups-tab"},
|
{label: $t({defaultMessage: "User groups"}), key: "user-profile-groups-tab"},
|
||||||
],
|
],
|
||||||
callback(name, key) {
|
callback(_name, key) {
|
||||||
$(".tabcontent").hide();
|
$(".tabcontent").hide();
|
||||||
$(`#${CSS.escape(key)}`).show();
|
$(`#${CSS.escape(key)}`).show();
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -291,7 +291,7 @@ test("handlers", ({override, mock_template}) => {
|
||||||
|
|
||||||
let narrowed;
|
let narrowed;
|
||||||
|
|
||||||
override(narrow, "by", (method, email) => {
|
override(narrow, "by", (_method, email) => {
|
||||||
assert.equal(email, "alice@zulip.com");
|
assert.equal(email, "alice@zulip.com");
|
||||||
narrowed = true;
|
narrowed = true;
|
||||||
});
|
});
|
||||||
|
@ -482,7 +482,7 @@ test("insert_one_user_into_empty_list", ({override, mock_template}) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("insert_alice_then_fred", ({override, mock_template}) => {
|
test("insert_alice_then_fred", ({override, mock_template}) => {
|
||||||
mock_template("presence_row.hbs", true, (data, html) => html);
|
mock_template("presence_row.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
let appended_html;
|
let appended_html;
|
||||||
override(buddy_list.$container, "append", (html) => {
|
override(buddy_list.$container, "append", (html) => {
|
||||||
|
@ -500,7 +500,7 @@ test("insert_alice_then_fred", ({override, mock_template}) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("insert_fred_then_alice_then_rename", ({override, mock_template}) => {
|
test("insert_fred_then_alice_then_rename", ({override, mock_template}) => {
|
||||||
mock_template("presence_row.hbs", true, (data, html) => html);
|
mock_template("presence_row.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
let appended_html;
|
let appended_html;
|
||||||
override(buddy_list.$container, "append", (html) => {
|
override(buddy_list.$container, "append", (html) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ run_test("rerender_alert_words_ui", ({mock_template}) => {
|
||||||
alert_words_ui.reset();
|
alert_words_ui.reset();
|
||||||
const ListWidget = mock_esm("../src/list_widget", {
|
const ListWidget = mock_esm("../src/list_widget", {
|
||||||
modifier: noop,
|
modifier: noop,
|
||||||
create(container, words, opts) {
|
create(_container, words, opts) {
|
||||||
const alert_words = [];
|
const alert_words = [];
|
||||||
ListWidget.modifier = opts.modifier;
|
ListWidget.modifier = opts.modifier;
|
||||||
for (const word of words) {
|
for (const word of words) {
|
||||||
|
|
|
@ -242,7 +242,7 @@ test_ui("send_message", ({override, override_rewire, mock_template}) => {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// This is the additional setup which is common to both the tests below.
|
// This is the additional setup which is common to both the tests below.
|
||||||
override(transmit, "send_message", (payload, success, error) => {
|
override(transmit, "send_message", (_payload, _success, error) => {
|
||||||
stub_state.send_msg_called += 1;
|
stub_state.send_msg_called += 1;
|
||||||
error("Error sending message: Server says 408");
|
error("Error sending message: Server says 408");
|
||||||
});
|
});
|
||||||
|
|
|
@ -393,7 +393,7 @@ test("quote_and_reply", ({disallow, override, override_rewire}) => {
|
||||||
|
|
||||||
override(message_lists.current, "selected_id", () => 100);
|
override(message_lists.current, "selected_id", () => 100);
|
||||||
|
|
||||||
override(compose_ui, "insert_syntax_and_focus", (syntax, $textarea, mode) => {
|
override(compose_ui, "insert_syntax_and_focus", (syntax, _$textarea, mode) => {
|
||||||
assert.equal(syntax, "translated: [Quoting…]");
|
assert.equal(syntax, "translated: [Quoting…]");
|
||||||
assert.equal(mode, "block");
|
assert.equal(mode, "block");
|
||||||
});
|
});
|
||||||
|
|
|
@ -475,10 +475,10 @@ run_test("format_text", ({override}) => {
|
||||||
let wrap_selection_called = false;
|
let wrap_selection_called = false;
|
||||||
let wrap_syntax = "";
|
let wrap_syntax = "";
|
||||||
|
|
||||||
override(text_field_edit, "set", (field, text) => {
|
override(text_field_edit, "set", (_field, text) => {
|
||||||
set_text = text;
|
set_text = text;
|
||||||
});
|
});
|
||||||
override(text_field_edit, "wrapSelection", (field, syntax) => {
|
override(text_field_edit, "wrapSelection", (_field, syntax) => {
|
||||||
wrap_selection_called = true;
|
wrap_selection_called = true;
|
||||||
wrap_syntax = syntax;
|
wrap_syntax = syntax;
|
||||||
});
|
});
|
||||||
|
@ -627,7 +627,7 @@ run_test("format_text", ({override}) => {
|
||||||
|
|
||||||
run_test("markdown_shortcuts", ({override_rewire}) => {
|
run_test("markdown_shortcuts", ({override_rewire}) => {
|
||||||
let format_text_type;
|
let format_text_type;
|
||||||
override_rewire(compose_ui, "format_text", ($textarea, type) => {
|
override_rewire(compose_ui, "format_text", (_$textarea, type) => {
|
||||||
format_text_type = type;
|
format_text_type = type;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ run_test("typing_events.render_notifications_for_narrow", ({override, mock_templ
|
||||||
// can be helpful in testing conditionals inside the template.
|
// can be helpful in testing conditionals inside the template.
|
||||||
|
|
||||||
// Let's set the mock to just return the rendered html.
|
// Let's set the mock to just return the rendered html.
|
||||||
mock_template("typing_notifications.hbs", true, (args, rendered_html) => rendered_html);
|
mock_template("typing_notifications.hbs", true, (_args, rendered_html) => rendered_html);
|
||||||
|
|
||||||
// Since we only have two(<MAX_USERS_TO_DISPLAY_NAME) typists, both of them
|
// Since we only have two(<MAX_USERS_TO_DISPLAY_NAME) typists, both of them
|
||||||
// should be rendered but not 'Several people are typing…'
|
// should be rendered but not 'Several people are typing…'
|
||||||
|
|
|
@ -346,7 +346,7 @@ run_test("save_narrow", ({override}) => {
|
||||||
assert.equal(window.location.hash, "#narrow/is/dm");
|
assert.equal(window.location.hash, "#narrow/is/dm");
|
||||||
|
|
||||||
let url_pushed;
|
let url_pushed;
|
||||||
override(history, "pushState", (state, title, url) => {
|
override(history, "pushState", (_state, _title, url) => {
|
||||||
url_pushed = url;
|
url_pushed = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ assert.notEqual(files.length, 0, "No tests found");
|
||||||
|
|
||||||
// Set up our namespace helpers.
|
// Set up our namespace helpers.
|
||||||
const window = new Proxy(global, {
|
const window = new Proxy(global, {
|
||||||
set(obj, prop, value) {
|
set(_obj, prop, value) {
|
||||||
namespace.set_global(prop, value);
|
namespace.set_global(prop, value);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -194,7 +194,7 @@ run_test("not_scrolling", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let get_min_load_count_called = false;
|
let get_min_load_count_called = false;
|
||||||
const get_min_load_count = (offset, load_count) => {
|
const get_min_load_count = (_offset, load_count) => {
|
||||||
get_min_load_count_called = true;
|
get_min_load_count_called = true;
|
||||||
return load_count;
|
return load_count;
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,7 +70,7 @@ const bot = {
|
||||||
};
|
};
|
||||||
|
|
||||||
run_test("empty_narrow_html", ({mock_template}) => {
|
run_test("empty_narrow_html", ({mock_template}) => {
|
||||||
mock_template("empty_feed_notice.hbs", true, (data, html) => html);
|
mock_template("empty_feed_notice.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
let actual_html = empty_narrow_html("This is a title", "<h1> This is the html </h1>");
|
let actual_html = empty_narrow_html("This is a title", "<h1> This is the html </h1>");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -197,7 +197,7 @@ run_test("urls", () => {
|
||||||
run_test("show_empty_narrow_message", ({mock_template}) => {
|
run_test("show_empty_narrow_message", ({mock_template}) => {
|
||||||
page_params.stop_words = [];
|
page_params.stop_words = [];
|
||||||
|
|
||||||
mock_template("empty_feed_notice.hbs", true, (data, html) => html);
|
mock_template("empty_feed_notice.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
narrow_state.reset_current_filter();
|
narrow_state.reset_current_filter();
|
||||||
narrow_banner.show_empty_narrow_message();
|
narrow_banner.show_empty_narrow_message();
|
||||||
|
@ -523,7 +523,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
|
||||||
run_test("show_empty_narrow_message_with_search", ({mock_template}) => {
|
run_test("show_empty_narrow_message_with_search", ({mock_template}) => {
|
||||||
page_params.stop_words = [];
|
page_params.stop_words = [];
|
||||||
|
|
||||||
mock_template("empty_feed_notice.hbs", true, (data, html) => html);
|
mock_template("empty_feed_notice.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
narrow_state.reset_current_filter();
|
narrow_state.reset_current_filter();
|
||||||
set_filter([["search", "grail"]]);
|
set_filter([["search", "grail"]]);
|
||||||
|
@ -539,7 +539,7 @@ run_test("hide_empty_narrow_message", () => {
|
||||||
run_test("show_search_stopwords", ({mock_template}) => {
|
run_test("show_search_stopwords", ({mock_template}) => {
|
||||||
page_params.stop_words = ["what", "about"];
|
page_params.stop_words = ["what", "about"];
|
||||||
|
|
||||||
mock_template("empty_feed_notice.hbs", true, (data, html) => html);
|
mock_template("empty_feed_notice.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
const expected_search_data = {
|
const expected_search_data = {
|
||||||
has_stop_word: true,
|
has_stop_word: true,
|
||||||
|
@ -604,7 +604,7 @@ run_test("show_search_stopwords", ({mock_template}) => {
|
||||||
|
|
||||||
run_test("show_invalid_narrow_message", ({mock_template}) => {
|
run_test("show_invalid_narrow_message", ({mock_template}) => {
|
||||||
narrow_state.reset_current_filter();
|
narrow_state.reset_current_filter();
|
||||||
mock_template("empty_feed_notice.hbs", true, (data, html) => html);
|
mock_template("empty_feed_notice.hbs", true, (_data, html) => html);
|
||||||
|
|
||||||
stream_data.add_sub({name: "streamA", stream_id: 88});
|
stream_data.add_sub({name: "streamA", stream_id: 88});
|
||||||
stream_data.add_sub({name: "streamB", stream_id: 77});
|
stream_data.add_sub({name: "streamB", stream_id: 77});
|
||||||
|
|
|
@ -281,7 +281,7 @@ test("basic_notifications", () => {
|
||||||
|
|
||||||
// Notifications API stub
|
// Notifications API stub
|
||||||
class StubNotification {
|
class StubNotification {
|
||||||
constructor(title, {icon, body, tag}) {
|
constructor(_title, {icon, body, tag}) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
this.body = body;
|
this.body = body;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
|
|
|
@ -44,7 +44,7 @@ let expected_data_to_replace_in_list_widget;
|
||||||
const ListWidget = mock_esm("../src/list_widget", {
|
const ListWidget = mock_esm("../src/list_widget", {
|
||||||
modifier: noop,
|
modifier: noop,
|
||||||
|
|
||||||
create(container, mapped_topic_values, opts) {
|
create(_container, mapped_topic_values, opts) {
|
||||||
const formatted_topics = [];
|
const formatted_topics = [];
|
||||||
ListWidget.modifier = opts.modifier;
|
ListWidget.modifier = opts.modifier;
|
||||||
for (const item of mapped_topic_values) {
|
for (const item of mapped_topic_values) {
|
||||||
|
@ -522,7 +522,7 @@ test("test_filter_pm", ({mock_template}) => {
|
||||||
i += 1;
|
i += 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
mock_template("recent_topic_row.hbs", true, (data, html) => {
|
mock_template("recent_topic_row.hbs", true, (_data, html) => {
|
||||||
assert.ok(html.startsWith('<tr id="recent_conversation'));
|
assert.ok(html.startsWith('<tr id="recent_conversation'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -805,7 +805,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {
|
||||||
rt.clear_for_tests();
|
rt.clear_for_tests();
|
||||||
|
|
||||||
mock_template("recent_topics_table.hbs", false, () => {});
|
mock_template("recent_topics_table.hbs", false, () => {});
|
||||||
mock_template("recent_topic_row.hbs", true, (data, html) => {
|
mock_template("recent_topic_row.hbs", true, (_data, html) => {
|
||||||
assert.ok(html.startsWith('<tr id="recent_conversation'));
|
assert.ok(html.startsWith('<tr id="recent_conversation'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Clipboard {
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
clipboard_args = args;
|
clipboard_args = args;
|
||||||
}
|
}
|
||||||
on(success, show_copied_confirmation) {
|
on(_success, show_copied_confirmation) {
|
||||||
show_copied_confirmation();
|
show_copied_confirmation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ run_test("settings", ({override}) => {
|
||||||
people.add_active_user({user_id: 5, email: "five@zulip.com", full_name: "Feivel Fiverson"});
|
people.add_active_user({user_id: 5, email: "five@zulip.com", full_name: "Feivel Fiverson"});
|
||||||
muted_users.add_muted_user(5, 1577836800);
|
muted_users.add_muted_user(5, 1577836800);
|
||||||
let populate_list_called = false;
|
let populate_list_called = false;
|
||||||
override(list_widget, "create", ($container, list) => {
|
override(list_widget, "create", (_$container, list) => {
|
||||||
assert.deepEqual(list, [
|
assert.deepEqual(list, [
|
||||||
{
|
{
|
||||||
date_muted_str: "Jan 1, 2020",
|
date_muted_str: "Jan 1, 2020",
|
||||||
|
|
|
@ -13,7 +13,7 @@ mock_esm("../src/ui_report", {
|
||||||
elem.val(msg);
|
elem.val(msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
error(msg, xhr, elem) {
|
error(msg, _xhr, elem) {
|
||||||
elem.val(msg);
|
elem.val(msg);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,7 @@ run_test("settings", ({override}) => {
|
||||||
1577836800,
|
1577836800,
|
||||||
);
|
);
|
||||||
let populate_list_called = false;
|
let populate_list_called = false;
|
||||||
override(list_widget, "create", ($container, list) => {
|
override(list_widget, "create", (_$container, list) => {
|
||||||
assert.deepEqual(list, [
|
assert.deepEqual(list, [
|
||||||
{
|
{
|
||||||
date_updated: 1577836800000,
|
date_updated: 1577836800000,
|
||||||
|
|
|
@ -49,7 +49,7 @@ run_test("topics", ({override}) => {
|
||||||
[4, ["4a"]],
|
[4, ["4a"]],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function has_unread_messages(stream, topic) {
|
function has_unread_messages(_stream, topic) {
|
||||||
return topic !== "read";
|
return topic !== "read";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ run_test("topics", ({override}) => {
|
||||||
[devel_stream_id, muted_stream_id].includes(stream_id),
|
[devel_stream_id, muted_stream_id].includes(stream_id),
|
||||||
);
|
);
|
||||||
|
|
||||||
override(user_topics, "is_topic_muted", (stream_name, topic) => topic === "muted");
|
override(user_topics, "is_topic_muted", (_stream_name, topic) => topic === "muted");
|
||||||
|
|
||||||
let next_item = tg.get_next_topic("announce", "whatever");
|
let next_item = tg.get_next_topic("announce", "whatever");
|
||||||
assert.deepEqual(next_item, {
|
assert.deepEqual(next_item, {
|
||||||
|
|
|
@ -50,7 +50,7 @@ run_test("render_notifications_for_narrow", ({override, mock_template}) => {
|
||||||
|
|
||||||
const $typing_notifications = $("#typing_notifications");
|
const $typing_notifications = $("#typing_notifications");
|
||||||
|
|
||||||
mock_template("typing_notifications.hbs", true, (args, rendered_html) => rendered_html);
|
mock_template("typing_notifications.hbs", true, (_args, rendered_html) => rendered_html);
|
||||||
|
|
||||||
// Having only two(<MAX_USERS_TO_DISPLAY_NAME) typists, both of them
|
// Having only two(<MAX_USERS_TO_DISPLAY_NAME) typists, both of them
|
||||||
// should be rendered but not 'Several people are typing…'
|
// should be rendered but not 'Several people are typing…'
|
||||||
|
|
|
@ -215,7 +215,7 @@ test("upload_files", async ({mock_template, override_rewire}) => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let hide_upload_banner_called = false;
|
let hide_upload_banner_called = false;
|
||||||
override_rewire(upload, "hide_upload_banner", (uppy, config) => {
|
override_rewire(upload, "hide_upload_banner", (_uppy, config) => {
|
||||||
hide_upload_banner_called = true;
|
hide_upload_banner_called = true;
|
||||||
assert.equal(config.mode, "compose");
|
assert.equal(config.mode, "compose");
|
||||||
});
|
});
|
||||||
|
@ -380,7 +380,7 @@ test("file_input", ({override_rewire}) => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let upload_files_called = false;
|
let upload_files_called = false;
|
||||||
override_rewire(upload, "upload_files", (uppy, config, files) => {
|
override_rewire(upload, "upload_files", (_uppy, config, files) => {
|
||||||
assert.equal(config.mode, "compose");
|
assert.equal(config.mode, "compose");
|
||||||
assert.equal(files, files);
|
assert.equal(files, files);
|
||||||
upload_files_called = true;
|
upload_files_called = true;
|
||||||
|
|
Loading…
Reference in New Issue