From dad01e305119b19e92f7f0cf95e33f269f8aed7b Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Wed, 3 Feb 2021 23:51:03 -0700
Subject: [PATCH] chore: eslint no-bitwise
---
.eslintrc | 1 -
install/web.js | 2 +-
public/src/utils.js | 2 ++
src/settings.js | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index f23a468a6b..2aed010487 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -116,7 +116,6 @@
"vars-on-top": "off",
"no-script-url": "off",
"import/newline-after-import": "off",
- "no-bitwise": "off",
// TODO
"consistent-return": "off",
diff --git a/install/web.js b/install/web.js
index 6589d8bc5a..da63173139 100644
--- a/install/web.js
+++ b/install/web.js
@@ -289,7 +289,7 @@ async function copyCSS() {
async function loadDefaults() {
const setupDefaultsPath = path.join(__dirname, '../setup.json');
try {
- await fs.promises.access(setupDefaultsPath, fs.constants.F_OK | fs.constants.R_OK);
+ await fs.promises.access(setupDefaultsPath, fs.constants.F_OK + fs.constants.R_OK);
} catch (err) {
// setup.json not found or inaccessible, proceed with no defaults
if (err.code !== 'ENOENT') {
diff --git a/public/src/utils.js b/public/src/utils.js
index cfae8d6ceb..43c2bc9bd4 100644
--- a/public/src/utils.js
+++ b/public/src/utils.js
@@ -294,11 +294,13 @@
var utils = {
generateUUID: function () {
+ /* eslint-disable no-bitwise */
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0;
var v = c === 'x' ? r : ((r & 0x3) | 0x8);
return v.toString(16);
});
+ /* eslint-enable no-bitwise */
},
// https://github.com/substack/node-ent/blob/master/index.js
decodeHTMLEntities: function (html) {
diff --git a/src/settings.js b/src/settings.js
index c235d7cc54..18460ab188 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -13,7 +13,7 @@ function expandObjBy(obj1, obj2) {
if (obj2.hasOwnProperty(key)) {
val2 = obj2[key];
val1 = obj1[key];
- xorValIsArray = Array.isArray(val1) ^ Array.isArray(val2);
+ xorValIsArray = Array.isArray(val1) === Array.isArray(val2);
if (xorValIsArray || !obj1.hasOwnProperty(key) || typeof val2 !== typeof val1) {
obj1[key] = val2;
changed = true;