mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
chore: eslint no-bitwise
This commit is contained in:
committed by
Julian Lam
parent
58528d1a3e
commit
dad01e3051
@@ -116,7 +116,6 @@
|
||||
"vars-on-top": "off",
|
||||
"no-script-url": "off",
|
||||
"import/newline-after-import": "off",
|
||||
"no-bitwise": "off",
|
||||
|
||||
// TODO
|
||||
"consistent-return": "off",
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user