From b8399471b330209d246bc416248e05a8ddc8ec99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sun, 17 Sep 2017 21:50:21 -0400 Subject: [PATCH] Enable ESLint `no-console` rule to avoid future mistakes --- .eslintrc.yml | 1 - client/js/socket.js | 2 -- index.js | 2 ++ scripts/build-fontawesome.js | 1 + src/command-line/utils.js | 2 +- src/log.js | 2 ++ test/fixtures/env.js | 2 +- webpack.config.js | 2 -- 8 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 4127a442..eb14e6de 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -28,7 +28,6 @@ rules: linebreak-style: [2, unix] no-catch-shadow: 2 no-confusing-arrow: 2 - no-console: 0 no-control-regex: 0 no-duplicate-imports: 2 no-else-return: 2 diff --git a/client/js/socket.js b/client/js/socket.js index 6f702fb1..b7ba0e70 100644 --- a/client/js/socket.js +++ b/client/js/socket.js @@ -35,8 +35,6 @@ const socket = io({ }); // Hides the "Send Message" button $("#submit").remove(); - - console.error(data); }); }); diff --git a/index.js b/index.js index f9ed254a..d1f292a3 100755 --- a/index.js +++ b/index.js @@ -8,9 +8,11 @@ process.chdir(__dirname); // Doing this check as soon as possible allows us to avoid ES6 parser errors or other issues var pkg = require("./package.json"); if (!require("semver").satisfies(process.version, pkg.engines.node)) { + /* eslint-disable no-console */ console.error("=== WARNING!"); console.error("=== The oldest supported Node.js version is", pkg.engines.node); console.error("=== We strongly encourage you to upgrade, see https://nodejs.org/en/download/package-manager/ for more details\n"); + /* eslint-enable no-console */ } require("./src/command-line"); diff --git a/scripts/build-fontawesome.js b/scripts/build-fontawesome.js index 6c55863a..79688fa3 100644 --- a/scripts/build-fontawesome.js +++ b/scripts/build-fontawesome.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ "use strict"; var fs = require("fs-extra"); diff --git a/src/command-line/utils.js b/src/command-line/utils.js index 8f5676af..12de6d84 100644 --- a/src/command-line/utils.js +++ b/src/command-line/utils.js @@ -15,7 +15,7 @@ class Utils { "", ` LOUNGE_HOME Path for all configuration files and folders. Defaults to ${colors.green(Utils.defaultLoungeHome())}.`, "", - ].forEach((e) => console.log(e)); + ].forEach((e) => console.log(e)); // eslint-disable-line no-console } static defaultLoungeHome() { diff --git a/src/log.js b/src/log.js index 9a5ded3b..584d4e4f 100644 --- a/src/log.js +++ b/src/log.js @@ -16,6 +16,7 @@ function timestamp(type, messageArgs) { return messageArgs; } +/* eslint-disable no-console */ exports.error = function() { console.error.apply(console, timestamp(colors.red("[ERROR]"), arguments)); }; @@ -31,6 +32,7 @@ exports.info = function() { exports.debug = function() { console.log.apply(console, timestamp(colors.green("[DEBUG]"), arguments)); }; +/* eslint-enable no-console */ exports.prompt = (options, callback) => { options.prompt = timestamp(colors.cyan("[PROMPT]"), [options.text]).join(" "); diff --git a/test/fixtures/env.js b/test/fixtures/env.js index f561eafd..6e4dffba 100644 --- a/test/fixtures/env.js +++ b/test/fixtures/env.js @@ -1,7 +1,7 @@ "use strict"; global.log = { - error: () => console.error.apply(console, arguments), + error: () => console.error.apply(console, arguments), // eslint-disable-line no-console warn: () => {}, info: () => {}, debug: () => {}, diff --git a/webpack.config.js b/webpack.config.js index e1888588..afacb60d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -79,8 +79,6 @@ if (process.env.NODE_ENV === "production") { sourceMap: true, comments: false })); -} else { - console.log("Building in development mode, bundles will not be minified."); } module.exports = config;