From 5c0f315a2259a0a6fb78b50a3b93cd4bd4874a31 Mon Sep 17 00:00:00 2001 From: Sj-Si Date: Tue, 26 Mar 2024 14:11:01 -0400 Subject: [PATCH] silence eslint undefined function errors --- javascript/extraNetworks.js | 9 +++++++- javascript/extraNetworksClusterizeList.js | 26 +++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/javascript/extraNetworks.js b/javascript/extraNetworks.js index 7015a6a2a..4b6559822 100644 --- a/javascript/extraNetworks.js +++ b/javascript/extraNetworks.js @@ -1,3 +1,10 @@ +// Prevent eslint errors on functions defined in other files. +/*global + ExtraNetworksClusterizeTreeList, + ExtraNetworksClusterizeCardsList, +*/ +/*eslint no-undef: "error"*/ + const SEARCH_INPUT_DEBOUNCE_TIME_MS = 250; const re_extranet = /<([^:^>]+:[^:]+):[\d.]+>(.*)/; @@ -23,7 +30,7 @@ const isStringLogError = x => { console.error("expected string, got:", typeof x); return false; }; -const isNull = x => typeof x === "null" || x === null; +const isNull = x => x === null; const isUndefined = x => typeof x === "undefined" || x === undefined; // checks both null and undefined for simplicity sake. const isNullOrUndefined = x => isNull(x) || isUndefined(x); diff --git a/javascript/extraNetworksClusterizeList.js b/javascript/extraNetworksClusterizeList.js index 9cc6f372e..2a2846055 100644 --- a/javascript/extraNetworksClusterizeList.js +++ b/javascript/extraNetworksClusterizeList.js @@ -1,3 +1,20 @@ +// Prevent eslint errors on functions defined in other files. +/*global + isString, + isStringLogError, + isNull, + isUndefined, + isNullOrUndefined, + isNullOrUndefinedLogError, + isElement, + isElementLogError, + getElementByIdLogError, + querySelectorLogError, + waitForElement, + Clusterize +*/ +/*eslint no-undef: "error"*/ + const JSON_UPDATE_DEBOUNCE_TIME_MS = 250; const RESIZE_DEBOUNCE_TIME_MS = 250; // Collators used for sorting. @@ -89,15 +106,6 @@ const htmlStringToElement = function(str) { return tmp.body.firstElementChild; }; -const getComputedValue = function(container, css_property) { - /** Gets a property value for the computed style of an element. */ - return parseInt( - window.getComputedStyle(container, null) - .getPropertyValue(css_property) - .split("px")[0] - ); -}; - const calcColsPerRow = function(parent, child) { /** Calculates the number of columns of children that can fit in a parent's visible width. */ const parent_inner_width = parent.offsetWidth - getComputedPaddingDims(parent).width;