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",
|
"vars-on-top": "off",
|
||||||
"no-script-url": "off",
|
"no-script-url": "off",
|
||||||
"import/newline-after-import": "off",
|
"import/newline-after-import": "off",
|
||||||
"no-bitwise": "off",
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
"consistent-return": "off",
|
"consistent-return": "off",
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ async function copyCSS() {
|
|||||||
async function loadDefaults() {
|
async function loadDefaults() {
|
||||||
const setupDefaultsPath = path.join(__dirname, '../setup.json');
|
const setupDefaultsPath = path.join(__dirname, '../setup.json');
|
||||||
try {
|
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) {
|
} catch (err) {
|
||||||
// setup.json not found or inaccessible, proceed with no defaults
|
// setup.json not found or inaccessible, proceed with no defaults
|
||||||
if (err.code !== 'ENOENT') {
|
if (err.code !== 'ENOENT') {
|
||||||
|
|||||||
@@ -294,11 +294,13 @@
|
|||||||
|
|
||||||
var utils = {
|
var utils = {
|
||||||
generateUUID: function () {
|
generateUUID: function () {
|
||||||
|
/* eslint-disable no-bitwise */
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
var r = Math.random() * 16 | 0;
|
var r = Math.random() * 16 | 0;
|
||||||
var v = c === 'x' ? r : ((r & 0x3) | 0x8);
|
var v = c === 'x' ? r : ((r & 0x3) | 0x8);
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
});
|
});
|
||||||
|
/* eslint-enable no-bitwise */
|
||||||
},
|
},
|
||||||
// https://github.com/substack/node-ent/blob/master/index.js
|
// https://github.com/substack/node-ent/blob/master/index.js
|
||||||
decodeHTMLEntities: function (html) {
|
decodeHTMLEntities: function (html) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function expandObjBy(obj1, obj2) {
|
|||||||
if (obj2.hasOwnProperty(key)) {
|
if (obj2.hasOwnProperty(key)) {
|
||||||
val2 = obj2[key];
|
val2 = obj2[key];
|
||||||
val1 = obj1[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) {
|
if (xorValIsArray || !obj1.hasOwnProperty(key) || typeof val2 !== typeof val1) {
|
||||||
obj1[key] = val2;
|
obj1[key] = val2;
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user