mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-23 17:00:24 +01:00
ESlint n-loop-func, yoda
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
"no-restricted-syntax": "off",
|
||||
"no-shadow": "off",
|
||||
"no-script-url": "off",
|
||||
"no-use-before-define": "off",
|
||||
|
||||
// "linebreak-style": "off",
|
||||
// "one-var": "off",
|
||||
@@ -74,9 +75,8 @@
|
||||
"block-scoped-var": "off",
|
||||
"operator-assignment": "off",
|
||||
"default-case": "off",
|
||||
"yoda": "off",
|
||||
"no-use-before-define": "off",
|
||||
"no-loop-func": "off",
|
||||
// "yoda": "off",
|
||||
// "no-loop-func": "off",
|
||||
// "no-void": "off",
|
||||
// "valid-jsdoc": "off",
|
||||
// "no-cond-assign": "off",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
var overrides = overrides || {};
|
||||
|
||||
if ('undefined' !== typeof window) {
|
||||
if (typeof window !== 'undefined') {
|
||||
(function ($) {
|
||||
require(['translator'], function (translator) {
|
||||
$.fn.getCursorPosition = function () {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
var fs;
|
||||
var XRegExp;
|
||||
|
||||
if ('undefined' === typeof window) {
|
||||
if (typeof window === 'undefined') {
|
||||
fs = require('fs');
|
||||
XRegExp = require('xregexp');
|
||||
|
||||
@@ -448,7 +448,7 @@
|
||||
},
|
||||
};
|
||||
|
||||
if ('undefined' !== typeof window) {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.utils = module.exports;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@
|
||||
return this.replace(/\s+$/g, '');
|
||||
};
|
||||
}
|
||||
}('undefined' === typeof module ? {
|
||||
}(typeof module === 'undefined' ? {
|
||||
module: {
|
||||
exports: {},
|
||||
},
|
||||
|
||||
@@ -75,10 +75,10 @@ settingsController.get = function (req, res, callback) {
|
||||
}
|
||||
|
||||
userData.dailyDigestFreqOptions = [
|
||||
{ value: 'off', name: '[[user:digest_off]]', selected: 'off' === userData.settings.dailyDigestFreq },
|
||||
{ value: 'day', name: '[[user:digest_daily]]', selected: 'day' === userData.settings.dailyDigestFreq },
|
||||
{ value: 'week', name: '[[user:digest_weekly]]', selected: 'week' === userData.settings.dailyDigestFreq },
|
||||
{ value: 'month', name: '[[user:digest_monthly]]', selected: 'month' === userData.settings.dailyDigestFreq },
|
||||
{ value: 'off', name: '[[user:digest_off]]', selected: userData.settings.dailyDigestFreq === 'off' },
|
||||
{ value: 'day', name: '[[user:digest_daily]]', selected: userData.settings.dailyDigestFreq === 'day' },
|
||||
{ value: 'week', name: '[[user:digest_weekly]]', selected: userData.settings.dailyDigestFreq === 'week' },
|
||||
{ value: 'month', name: '[[user:digest_monthly]]', selected: userData.settings.dailyDigestFreq === 'month' },
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ module.exports = function (middleware) {
|
||||
};
|
||||
|
||||
options = options || {};
|
||||
if ('function' === typeof options) {
|
||||
if (typeof options === 'function') {
|
||||
fn = options;
|
||||
options = {};
|
||||
}
|
||||
if ('function' !== typeof fn) {
|
||||
if (typeof fn !== 'function') {
|
||||
fn = defaultFn;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,16 +204,15 @@ function ignoreOrWatch(fn, socket, cid, callback) {
|
||||
|
||||
// filter to subcategories of cid
|
||||
|
||||
var any = true;
|
||||
while (any) {
|
||||
any = false;
|
||||
categoryData.forEach(function (c) {
|
||||
if (cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1) {
|
||||
cids.push(c.cid);
|
||||
any = true;
|
||||
}
|
||||
var cat;
|
||||
do {
|
||||
cat = categoryData.find(function (c) {
|
||||
return cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1;
|
||||
});
|
||||
if (cat) {
|
||||
cids.push(cat.cid);
|
||||
}
|
||||
} while (cat);
|
||||
|
||||
async.each(cids, function (cid, next) {
|
||||
fn(socket.uid, cid, next);
|
||||
|
||||
Reference in New Issue
Block a user