ESlint no-use-before-define

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

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

@ -24,6 +24,8 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
realtimeInterval: 1500, realtimeInterval: 1500,
}; };
var usedTopicColors = [];
$(window).on('action:ajaxify.start', function () { $(window).on('action:ajaxify.start', function () {
clearInterval(intervals.rooms); clearInterval(intervals.rooms);
clearInterval(intervals.graphs); 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 topicColors = ['#bf616a', '#5B90BF', '#d08770', '#ebcb8b', '#a3be8c', '#96b5b4', '#8fa1b3', '#b48ead', '#ab7967', '#46BFBD'];
var usedTopicColors = [];
/* eslint-disable */
// from chartjs.org // from chartjs.org
function lighten(col, amt) { function lighten(col, amt) {
var usePound = false; 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); return (usePound ? '#' : '') + (g | (b << 8) | (r << 16)).toString(16);
} }
/* eslint-enable */
function setupGraphs() { function setupGraphs() {
var trafficCanvas = document.getElementById('analytics-traffic'); 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', { templates.parse('admin/partials/categories/create', {
categories: categories, categories: categories,
}, function (html) { }, 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({ var modal = bootbox.dialog({
title: '[[admin/manage/categories:alert.create]]', title: '[[admin/manage/categories:alert.create]]',
message: html, 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); modal.find('form').on('submit', submit);
}); });
}); });

@ -221,7 +221,7 @@ define('admin/manage/category', [
if (confirm) { if (confirm) {
Category.setPrivilege(member, privilege, state, checkboxEl); Category.setPrivilege(member, privilege, state, checkboxEl);
} else { } else {
checkboxEl.prop('checked', checkboxEl.prop('checked') ^ 1); checkboxEl.prop('checked', !checkboxEl.prop('checked'));
} }
}); });
} else { } else {
@ -427,13 +427,6 @@ define('admin/manage/category', [
categories: categories, categories: categories,
}, function (html) { }, function (html) {
translator.translate(html, 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({ var modal = bootbox.dialog({
title: 'Select a Category', title: 'Select a Category',
message: html, 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); modal.find('form').on('submit', submit);
}); });
}); });

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

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

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

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

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

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

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

Loading…
Cancel
Save