Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/prefer-number-is-safe-integer.
Anders Kaseorg7f7814b2c4ba
diff --git a/web/server/katex_server.ts b/web/server/katex_server.tsindex fc94826e27f..1323c4406f5 100644--- a/web/server/katex_server.ts+++ b/web/server/katex_server.ts@@ -7,7 +7,7 @@ import * as Prometheus from "prom-client";const host = "localhost";const port = Number(process.argv[2] ?? "9700");-if (!Number.isInteger(port)) {+if (!Number.isSafeInteger(port)) {throw new TypeError("Invalid port");}diff --git a/web/src/filter.ts b/web/src/filter.tsindex e04758c6001..35def640eca 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -672,7 +672,7 @@ export class Filter {if (term.negated) {return false;}- return Number.isInteger(Number(term.operand));+ return Number.isSafeInteger(Number(term.operand));case "channel":return stream_data.get_sub_by_id_string(term.operand) !== undefined;case "channels":diff --git a/web/src/information_density.ts b/web/src/information_density.tsindex 1c718f902b6..bf6bd69ac1c 100644--- a/web/src/information_density.ts+++ b/web/src/information_density.ts@@ -290,7 +290,7 @@ export function get_string_display_value_for_line_height(setting_value: number):INFO_DENSITY_VALUES_DICT.web_line_height_percent.step_value;let display_value;- if (step_count % 1 === 0) {+ if (Number.isSafeInteger(step_count)) {// If value is an integer, we just return here to avoid showing// 1.0 for 1.display_value = step_count.toString();diff --git a/web/src/local_message.ts b/web/src/local_message.tsindex 566210008dc..d2c18ee85c2 100644--- a/web/src/local_message.ts+++ b/web/src/local_message.ts@@ -29,7 +29,7 @@ export const get_next_id_float = (function () {return undefined;}- if (local_id_float % 1 === 0) {+ if (Number.isSafeInteger(local_id_float)) {// The logic to stop at 0.05 should prevent us from ever wrapping around// to the next integer.blueslip.error("Programming error");diff --git a/web/tests/lib/zblueslip.cjs b/web/tests/lib/zblueslip.cjsindex 55f1dae3ae8..d4c0444f198 100644--- a/web/tests/lib/zblueslip.cjs+++ b/web/tests/lib/zblueslip.cjs@@ -34,7 +34,7 @@ function make_zblueslip() {lib.expect = (name, message, expected_count = 1) => {assert.notEqual(opts[name], undefined, `unexpected arg for expect: ${name}`);assert.ok(- expected_count > 0 && Number.isInteger(expected_count),+ expected_count > 0 && Number.isSafeInteger(expected_count),"expected count should be a positive integer",);const obj = {message, count: 0, expected_count};