ESlint no-use-before-define

v1.18.x
Peter Jaszkowiak 8 years ago
parent 93f38d4f30
commit b227297ef3

@ -28,6 +28,9 @@
"camelcase": "off",
"no-new": "off",
"no-shadow": "off",
"no-use-before-define": ["error", "nofunc"],
"no-prototype-builtins": "off",
"new-cap": "off",
// ES6
"prefer-rest-params": "off",
@ -36,6 +39,7 @@
"prefer-template": "off",
"no-var": "off",
"object-shorthand": "off",
"vars-on-top": "off",
// TODO
"import/no-unresolved": "off",
@ -46,13 +50,9 @@
"global-require": "off",
"max-len": "off",
"no-param-reassign": "off",
"no-prototype-builtins": "off",
"vars-on-top": "off",
"no-restricted-syntax": "off",
"no-script-url": "off",
"no-use-before-define": "off",
"default-case": "off",
"new-cap": "off",
// "no-multi-assign": "off",
// "linebreak-style": "off",

@ -24,6 +24,8 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
realtimeInterval: 1500,
};
var usedTopicColors = [];
$(window).on('action:ajaxify.start', function () {
clearInterval(intervals.rooms);
clearInterval(intervals.graphs);
@ -127,8 +129,8 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
};
var topicColors = ['#bf616a', '#5B90BF', '#d08770', '#ebcb8b', '#a3be8c', '#96b5b4', '#8fa1b3', '#b48ead', '#ab7967', '#46BFBD'];
var usedTopicColors = [];
/* eslint-disable */
// from chartjs.org
function lighten(col, amt) {
var usePound = false;
@ -157,6 +159,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
return (usePound ? '#' : '') + (g | (b << 8) | (r << 16)).toString(16);
}
/* eslint-enable */
function setupGraphs() {
var trafficCanvas = document.getElementById('analytics-traffic');

@ -42,16 +42,6 @@ define('admin/manage/categories', ['vendor/jquery/serializeObject/jquery.ba-seri
templates.parse('admin/partials/categories/create', {
categories: categories,
}, function (html) {
function submit() {
var formData = modal.find('form').serializeObject();
formData.description = '';
formData.icon = 'fa-comments';
Categories.create(formData);
modal.modal('hide');
return false;
}
var modal = bootbox.dialog({
title: '[[admin/manage/categories:alert.create]]',
message: html,
@ -64,6 +54,16 @@ define('admin/manage/categories', ['vendor/jquery/serializeObject/jquery.ba-seri
},
});
function submit() {
var formData = modal.find('form').serializeObject();
formData.description = '';
formData.icon = 'fa-comments';
Categories.create(formData);
modal.modal('hide');
return false;
}
modal.find('form').on('submit', submit);
});
});

@ -221,7 +221,7 @@ define('admin/manage/category', [
if (confirm) {
Category.setPrivilege(member, privilege, state, checkboxEl);
} else {
checkboxEl.prop('checked', checkboxEl.prop('checked') ^ 1);
checkboxEl.prop('checked', !checkboxEl.prop('checked'));
}
});
} else {
@ -427,13 +427,6 @@ define('admin/manage/category', [
categories: categories,
}, function (html) {
translator.translate(html, function (html) {
function submit() {
var formData = modal.find('form').serializeObject();
callback(formData['select-cid']);
modal.modal('hide');
return false;
}
var modal = bootbox.dialog({
title: 'Select a Category',
message: html,
@ -446,6 +439,13 @@ define('admin/manage/category', [
},
});
function submit() {
var formData = modal.find('form').serializeObject();
callback(formData['select-cid']);
modal.modal('hide');
return false;
}
modal.find('form').on('submit', submit);
});
});

@ -76,6 +76,8 @@ define('admin/manage/groups', ['translator'], function (translator) {
};
function handleSearch() {
var queryEl = $('#group-search');
function doSearch() {
if (!queryEl.val()) {
return ajaxify.refresh();
@ -103,8 +105,6 @@ define('admin/manage/groups', ['translator'], function (translator) {
});
}
var queryEl = $('#group-search');
queryEl.on('keyup', function () {
if (intervalId) {
clearTimeout(intervalId);

@ -1,7 +1,7 @@
'use strict';
var ajaxify = ajaxify || {};
var ajaxify = window.ajaxify || {};
$(document).ready(function () {
var location = document.location || window.location;
@ -193,14 +193,14 @@ $(document).ready(function () {
}
ajaxify.end = function (url, tpl_url) {
var count = 2;
function done() {
count -= 1;
if (count === 0) {
$(window).trigger('action:ajaxify.end', { url: url, tpl_url: tpl_url, title: ajaxify.data.title });
}
}
var count = 2;
ajaxify.loadScript(tpl_url, done);
ajaxify.widgets.render(tpl_url, url, done);
@ -343,6 +343,12 @@ $(document).ready(function () {
// Enhancing all anchors to ajaxify...
$(document.body).on('click', 'a', function (e) {
var _self = this;
if (this.target !== '' || (this.protocol !== 'http:' && this.protocol !== 'https:')) {
return;
}
var internalLink = utils.isInternalURI(this, window.location, RELATIVE_PATH);
var process = function () {
if (!e.ctrlKey && !e.shiftKey && !e.metaKey && e.which === 1) {
if (internalLink) {
@ -366,12 +372,6 @@ $(document).ready(function () {
}
};
if (this.target !== '' || (this.protocol !== 'http:' && this.protocol !== 'https:')) {
return;
}
var internalLink = utils.isInternalURI(this, window.location, RELATIVE_PATH);
if ($(this).attr('data-ajaxify') === 'false') {
if (!internalLink) {
return;

@ -1,7 +1,7 @@
'use strict';
var app = app || {};
var app = window.app || {};
app.isFocused = true;
app.currentRoom = null;

@ -230,6 +230,9 @@ define('forum/topic/postTools', [
var selectedNode = getSelectedNode();
showStaleWarning(function () {
var username = getUserName(button);
var toPid = getData(button, 'data-pid');
function quote(text) {
$(window).trigger('action:composer.addQuote', {
tid: tid,
@ -240,9 +243,6 @@ define('forum/topic/postTools', [
});
}
var username = getUserName(button);
var toPid = getData(button, 'data-pid');
if (selectedNode.text && toPid && toPid === selectedNode.pid) {
return quote(selectedNode.text);
}

@ -1,7 +1,7 @@
'use strict';
var overrides = overrides || {};
var overrides = window.overrides || {};
if (typeof window !== 'undefined') {
(function ($) {

@ -1,7 +1,7 @@
'use strict';
var app = app || {};
var app = window.app || {};
var socket;
app.isConnected = false;

@ -148,6 +148,8 @@ module.exports = function (Plugins) {
}
function mapStaticDirectories(pluginData, pluginPath, callback) {
var validMappedPath = /^[\w\-_]+$/;
function mapStaticDirs(mappedPath, callback) {
if (Plugins.staticDirs[mappedPath]) {
winston.warn('[plugins/' + pluginData.id + '] Mapped path (' + mappedPath + ') already specified!');
@ -170,8 +172,6 @@ module.exports = function (Plugins) {
}
}
var validMappedPath = /^[\w\-_]+$/;
pluginData.staticDirs = pluginData.staticDirs || {};
var dirs = Object.keys(pluginData.staticDirs);

Loading…
Cancel
Save