From 623087346a23041694f8c0e5abf37262b46db758 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 16 May 2020 14:45:12 +0300 Subject: [PATCH] Enable `no-zero-fractions` rule Signed-off-by: XhmikosR --- package.json | 1 - scripts/pi-hole/js/db_graph.js | 4 ++-- scripts/pi-hole/js/db_lists.js | 6 +++--- scripts/pi-hole/js/db_queries.js | 4 ++-- scripts/pi-hole/js/index.js | 4 ++-- scripts/pi-hole/js/network.js | 6 +++--- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index aa2d0c43..297e5633 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "unicorn/filename-case": "off", "unicorn/no-fn-reference-in-iterator": "off", "unicorn/no-for-loop": "off", - "unicorn/no-zero-fractions": "off", "unicorn/prefer-includes": "off", "unicorn/prefer-node-append": "off", "unicorn/prefer-number-properties": "off", diff --git a/scripts/pi-hole/js/db_graph.js b/scripts/pi-hole/js/db_graph.js index ac80360f..d4141a18 100644 --- a/scripts/pi-hole/js/db_graph.js +++ b/scripts/pi-hole/js/db_graph.js @@ -269,11 +269,11 @@ $(document).ready(function () { }, label: function (tooltipItems, data) { if (tooltipItems.datasetIndex === 0) { - var percentage = 0.0; + var percentage = 0; var permitted = parseInt(data.datasets[1].data[tooltipItems.index]); var blocked = parseInt(data.datasets[0].data[tooltipItems.index]); if (permitted + blocked > 0) { - percentage = (100.0 * blocked) / (permitted + blocked); + percentage = (100 * blocked) / (permitted + blocked); } return ( diff --git a/scripts/pi-hole/js/db_lists.js b/scripts/pi-hole/js/db_lists.js index dc641d39..6cd643fb 100644 --- a/scripts/pi-hole/js/db_lists.js +++ b/scripts/pi-hole/js/db_lists.js @@ -97,7 +97,7 @@ function updateTopClientsChart() { clientname = client; } - percentage = (data.top_sources[client] / sum) * 100.0; + percentage = (data.top_sources[client] / sum) * 100; clienttable.append( " " + clientname + @@ -144,7 +144,7 @@ function updateTopDomainsChart() { data.top_domains[escapeHtml(domain)] = data.top_domains[domain]; } - percentage = (data.top_domains[domain] / sum) * 100.0; + percentage = (data.top_domains[domain] / sum) * 100; domaintable.append( " " + domain + @@ -191,7 +191,7 @@ function updateTopAdsChart() { data.top_ads[escapeHtml(ad)] = data.top_ads[ad]; } - percentage = (data.top_ads[ad] / sum) * 100.0; + percentage = (data.top_ads[ad] / sum) * 100; adtable.append( " " + ad + diff --git a/scripts/pi-hole/js/db_queries.js b/scripts/pi-hole/js/db_queries.js index ffe772a6..b0ee076d 100644 --- a/scripts/pi-hole/js/db_queries.js +++ b/scripts/pi-hole/js/db_queries.js @@ -209,9 +209,9 @@ var reloadCallback = function () { $("h3#ads_blocked_exact").text(statistics[2].toLocaleString()); $("h3#ads_wildcard_blocked").text(statistics[3].toLocaleString()); - var percent = 0.0; + var percent = 0; if (statistics[2] + statistics[3] > 0) { - percent = (100.0 * (statistics[2] + statistics[3])) / statistics[0]; + percent = (100 * (statistics[2] + statistics[3])) / statistics[0]; } $("h3#ads_percentage_today").text(parseFloat(percent).toFixed(1).toLocaleString() + " %"); diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index a6a383dc..e696b3e7 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -877,12 +877,12 @@ $(document).ready(function () { }, label: function (tooltipItems, data) { if (tooltipItems.datasetIndex === 0) { - var percentage = 0.0; + var percentage = 0; var permitted = parseInt(data.datasets[1].data[tooltipItems.index]); var blocked = parseInt(data.datasets[0].data[tooltipItems.index]); var total = permitted + blocked; if (total > 0) { - percentage = (100.0 * blocked) / total; + percentage = (100 * blocked) / total; } return ( diff --git a/scripts/pi-hole/js/network.js b/scripts/pi-hole/js/network.js index d4370ce8..4ddafbe6 100644 --- a/scripts/pi-hole/js/network.js +++ b/scripts/pi-hole/js/network.js @@ -49,9 +49,9 @@ function rgbToHex(values) { function mixColors(ratio, rgb1, rgb2) { return [ - (1.0 - ratio) * rgb1[0] + ratio * rgb2[0], - (1.0 - ratio) * rgb1[1] + ratio * rgb2[1], - (1.0 - ratio) * rgb1[2] + ratio * rgb2[2] + (1 - ratio) * rgb1[0] + ratio * rgb2[0], + (1 - ratio) * rgb1[1] + ratio * rgb2[1], + (1 - ratio) * rgb1[2] + ratio * rgb2[2] ]; }