eslint: Fix unicorn/prefer-includes.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prefer-includes.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-10-07 01:48:54 -07:00 committed by Tim Abbott
parent b178fc6069
commit fd11c9c666
3 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,7 @@
"use strict"; "use strict";
const path = require("path");
const _ = require("lodash"); const _ = require("lodash");
const requires = []; const requires = [];
@ -50,11 +52,10 @@ exports.clear_zulip_refs = function () {
correctly, but it will fail if we correctly, but it will fail if we
run it standalone. run it standalone.
*/ */
const staticPath = path.resolve(__dirname, "../../static") + path.sep;
_.each(require.cache, (_, fn) => { _.each(require.cache, (_, fn) => {
if (fn.indexOf("static/") >= 0) { if (fn.startsWith(staticPath) && !fn.startsWith(staticPath + "templates" + path.sep)) {
if (fn.indexOf("static/templates") < 0) { delete require.cache[fn];
delete require.cache[fn];
}
} }
}); });
}; };

View File

@ -85,7 +85,7 @@ exports.set_up_muted_topics_ui = function () {
filter: { filter: {
element: $search_input, element: $search_input,
predicate(item, value) { predicate(item, value) {
return item.topic.toLocaleLowerCase().indexOf(value) >= 0; return item.topic.toLocaleLowerCase().includes(value);
}, },
onupdate() { onupdate() {
ui.reset_scrollbar(muted_topics_table.closest(".progressive-table-wrapper")); ui.reset_scrollbar(muted_topics_table.closest(".progressive-table-wrapper"));

View File

@ -34,7 +34,7 @@ exports.set_up = function (input, pills, opts) {
if (include_streams(query)) { if (include_streams(query)) {
query = query.trim().slice(1); query = query.trim().slice(1);
return item.name.toLowerCase().indexOf(query) !== -1; return item.name.toLowerCase().includes(query);
} }
if (!settings_data.show_email()) { if (!settings_data.show_email()) {