Skip to content

Commit

Permalink
Merge pull request #5849 from platinumazure/no-console
Browse files Browse the repository at this point in the history
Fix: Enable no-console rule in eslint-config-eslint (refs #5188)
  • Loading branch information
gyandeeps committed Apr 23, 2016
2 parents cfe562d + e7c0737 commit 0c0159b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile.js
Expand Up @@ -4,7 +4,7 @@
*/

/* global cat, cd, cp, echo, exec, exit, find, ls, mkdir, pwd, rm, target, test*/
/* eslint no-use-before-define: 0*/
/* eslint no-use-before-define: "off", no-console: "off" */
"use strict";

//------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions lib/logging.js
Expand Up @@ -5,6 +5,8 @@

"use strict";

/* eslint no-console: "off" */

/* istanbul ignore next */
module.exports = {

Expand Down
2 changes: 1 addition & 1 deletion lib/timing.js
Expand Up @@ -101,7 +101,7 @@ function display(data) {
return ALIGN[index](":", w + 1, "-");
}).join("|"));

console.log(table.join("\n"));
console.log(table.join("\n")); // eslint-disable-line no-console
}

/* istanbul ignore next */
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-eslint/default.yml
Expand Up @@ -32,7 +32,7 @@ rules:
no-alert: "error"
no-array-constructor: "error"
no-caller: "error"
no-console: 0
no-console: "error"
no-delete-var: "error"
no-eval: "error"
no-extend-native: "error"
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/cli-engine.js
Expand Up @@ -1833,13 +1833,15 @@ describe("CLIEngine", function() {
});

describe("isPathIgnored", function() {
var sandbox;

beforeEach(function() {
sinon.stub(console, "info").returns(void 0);
sandbox = sinon.sandbox.create();
sandbox.stub(console, "info").returns(void 0);
});

afterEach(function() {
console.info.restore();
sandbox.restore();
});

it("should check if the given path is ignored", function() {
Expand Down
20 changes: 10 additions & 10 deletions tests/lib/config/config-initializer.js
Expand Up @@ -219,8 +219,8 @@ describe("configInitializer", function() {

describe("auto", function() {
var config,
origLog,
completeSpy = sinon.spy();
completeSpy = sinon.spy(),
sandbox;

before(function() {
var patterns = [
Expand All @@ -238,25 +238,25 @@ describe("configInitializer", function() {
format: "JSON",
commonjs: false
};
origLog = console.log;
console.log = function() {}; // necessary to replace, because of progress bar

sandbox = sinon.sandbox.create();
sandbox.stub(console, "log"); // necessary to replace, because of progress bar

process.chdir(fixtureDir);

try {
config = init.processAnswers(answers);
process.chdir(originalDir);
} catch (err) {

// if processAnswers crashes, we need to be sure to restore cwd and console.log
console.log = origLog;
// if processAnswers crashes, we need to be sure to restore cwd
process.chdir(originalDir);
throw err;
} finally {
sandbox.restore(); // restore console.log()
}
});

beforeEach(function() {
console.log = origLog;
});

it("should create a config", function() {
assert.isTrue(completeSpy.notCalled);
assert.ok(config);
Expand Down

0 comments on commit 0c0159b

Please sign in to comment.