Skip to content

Commit

Permalink
Chore: Enable no-console rule in eslint-config-eslint (refs #5188)
Browse files Browse the repository at this point in the history
  • Loading branch information
platinumazure committed Apr 23, 2016
1 parent 31bfe5f commit e7c0737
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author nzakas
*/
/* 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -1851,13 +1851,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
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ describe("configInitializer", function() {

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

before(function() {
var patterns = [
Expand All @@ -232,25 +232,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 e7c0737

Please sign in to comment.