ESlint n-loop-func, yoda

v1.18.x
Peter Jaszkowiak 8 years ago
parent 04bb6513b0
commit a0a50677da

@ -49,6 +49,7 @@
"no-restricted-syntax": "off", "no-restricted-syntax": "off",
"no-shadow": "off", "no-shadow": "off",
"no-script-url": "off", "no-script-url": "off",
"no-use-before-define": "off",
// "linebreak-style": "off", // "linebreak-style": "off",
// "one-var": "off", // "one-var": "off",
@ -74,9 +75,8 @@
"block-scoped-var": "off", "block-scoped-var": "off",
"operator-assignment": "off", "operator-assignment": "off",
"default-case": "off", "default-case": "off",
"yoda": "off", // "yoda": "off",
"no-use-before-define": "off", // "no-loop-func": "off",
"no-loop-func": "off",
// "no-void": "off", // "no-void": "off",
// "valid-jsdoc": "off", // "valid-jsdoc": "off",
// "no-cond-assign": "off", // "no-cond-assign": "off",

@ -3,7 +3,7 @@
var overrides = overrides || {}; var overrides = overrides || {};
if ('undefined' !== typeof window) { if (typeof window !== 'undefined') {
(function ($) { (function ($) {
require(['translator'], function (translator) { require(['translator'], function (translator) {
$.fn.getCursorPosition = function () { $.fn.getCursorPosition = function () {

@ -5,7 +5,7 @@
var fs; var fs;
var XRegExp; var XRegExp;
if ('undefined' === typeof window) { if (typeof window === 'undefined') {
fs = require('fs'); fs = require('fs');
XRegExp = require('xregexp'); XRegExp = require('xregexp');
@ -448,7 +448,7 @@
}, },
}; };
if ('undefined' !== typeof window) { if (typeof window !== 'undefined') {
window.utils = module.exports; window.utils = module.exports;
} }
@ -479,7 +479,7 @@
return this.replace(/\s+$/g, ''); return this.replace(/\s+$/g, '');
}; };
} }
}('undefined' === typeof module ? { }(typeof module === 'undefined' ? {
module: { module: {
exports: {}, exports: {},
}, },

@ -75,10 +75,10 @@ settingsController.get = function (req, res, callback) {
} }
userData.dailyDigestFreqOptions = [ userData.dailyDigestFreqOptions = [
{ value: 'off', name: '[[user:digest_off]]', selected: 'off' === userData.settings.dailyDigestFreq }, { value: 'off', name: '[[user:digest_off]]', selected: userData.settings.dailyDigestFreq === 'off' },
{ value: 'day', name: '[[user:digest_daily]]', selected: 'day' === userData.settings.dailyDigestFreq }, { value: 'day', name: '[[user:digest_daily]]', selected: userData.settings.dailyDigestFreq === 'day' },
{ value: 'week', name: '[[user:digest_weekly]]', selected: 'week' === userData.settings.dailyDigestFreq }, { value: 'week', name: '[[user:digest_weekly]]', selected: userData.settings.dailyDigestFreq === 'week' },
{ value: 'month', name: '[[user:digest_monthly]]', selected: 'month' === userData.settings.dailyDigestFreq }, { value: 'month', name: '[[user:digest_monthly]]', selected: userData.settings.dailyDigestFreq === 'month' },
]; ];

@ -23,11 +23,11 @@ module.exports = function (middleware) {
}; };
options = options || {}; options = options || {};
if ('function' === typeof options) { if (typeof options === 'function') {
fn = options; fn = options;
options = {}; options = {};
} }
if ('function' !== typeof fn) { if (typeof fn !== 'function') {
fn = defaultFn; fn = defaultFn;
} }

@ -204,16 +204,15 @@ function ignoreOrWatch(fn, socket, cid, callback) {
// filter to subcategories of cid // filter to subcategories of cid
var any = true; var cat;
while (any) { do {
any = false; cat = categoryData.find(function (c) {
categoryData.forEach(function (c) { return cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1;
if (cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1) {
cids.push(c.cid);
any = true;
}
}); });
if (cat) {
cids.push(cat.cid);
} }
} while (cat);
async.each(cids, function (cid, next) { async.each(cids, function (cid, next) {
fn(socket.uid, cid, next); fn(socket.uid, cid, next);

Loading…
Cancel
Save