Skip to content

Commit

Permalink
Disallow the use of console in JavaScript files
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Jun 7, 2019
1 parent 0a16b56 commit c63356d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion .eslintrc.json
Expand Up @@ -29,7 +29,6 @@
"keyword-spacing": "error",
"new-cap": "error",
"no-array-constructor": "error",
"no-console": "warn",
"no-eval": "error",
"no-fallthrough": "warn",
"no-loop-func": "error",
Expand Down
6 changes: 6 additions & 0 deletions js/ajax.js
Expand Up @@ -76,6 +76,7 @@ var AJAX = {
var eventName = 'onload_' + AJAX.hash(file);
$(document).on(eventName, func);
if (this.debug) {
// eslint-disable-next-line no-console
console.log(
// no need to translate
'Registered event ' + eventName + ' for file ' + file
Expand All @@ -97,6 +98,7 @@ var AJAX = {
var eventName = 'teardown_' + AJAX.hash(file);
$(document).on(eventName, func);
if (this.debug) {
// eslint-disable-next-line no-console
console.log(
// no need to translate
'Registered event ' + eventName + ' for file ' + file
Expand All @@ -116,6 +118,7 @@ var AJAX = {
var eventName = 'onload_' + AJAX.hash(file);
$(document).trigger(eventName);
if (this.debug) {
// eslint-disable-next-line no-console
console.log(
// no need to translate
'Fired event ' + eventName + ' for file ' + file
Expand All @@ -134,6 +137,7 @@ var AJAX = {
var eventName = 'teardown_' + AJAX.hash(file);
$(document).triggerHandler(eventName);
if (this.debug) {
// eslint-disable-next-line no-console
console.log(
// no need to translate
'Fired event ' + eventName + ' for file ' + file
Expand Down Expand Up @@ -310,6 +314,7 @@ var AJAX = {
}

if (AJAX.debug) {
// eslint-disable-next-line no-console
console.log('Loading: ' + url); // no need to translate
}

Expand Down Expand Up @@ -933,6 +938,7 @@ $(document).on('submit', 'form', AJAX.requestHandler);
*/
$(document).ajaxError(function (event, request) {
if (AJAX.debug) {
// eslint-disable-next-line no-console
console.log('AJAX error: status=' + request.status + ', text=' + request.statusText);
}
// Don't handle aborted requests
Expand Down
2 changes: 2 additions & 0 deletions js/console.js
Expand Up @@ -182,7 +182,9 @@ var Console = {
var data = JSON.parse(xhr.responseText);
Console.ajaxCallback(data);
} catch (e) {
// eslint-disable-next-line no-console
console.trace();
// eslint-disable-next-line no-console
console.log('Failed to parse JSON: ' + e.message);
}
});
Expand Down
1 change: 1 addition & 0 deletions js/designer/database.js
Expand Up @@ -140,6 +140,7 @@ var DesignerOfflineDB = (function () {
};

designerDB.onerror = function (e) {
// eslint-disable-next-line no-console
console.log(e);
};

Expand Down

0 comments on commit c63356d

Please sign in to comment.