Skip to content

Commit

Permalink
Fix: Do not show ignore messages for default ignored files (fixes #4931)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyandeeps committed Jan 13, 2016
1 parent c01016a commit b3de8f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 0 additions & 4 deletions lib/cli-engine.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ var defaultOptions = {
cacheFile: ".eslintcache", cacheFile: ".eslintcache",
fix: false, fix: false,
allowInlineConfig: true, allowInlineConfig: true,
warnIgnoredByDefault: true,
cwd: process.cwd() cwd: process.cwd()
}, },
loadedPlugins = Object.create(null); loadedPlugins = Object.create(null);
Expand Down Expand Up @@ -605,9 +604,6 @@ CLIEngine.prototype = {
} }


if (ignoredPaths.contains(filename, "default")) { if (ignoredPaths.contains(filename, "default")) {
if (options.warnIgnoredByDefault || warnIgnored) {
results.push(createIgnoreResult(filename));
}
return; return;
} }


Expand Down
2 changes: 0 additions & 2 deletions lib/ignored-paths.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ function IgnoredPaths(options) {
* @returns {array} raw ignore rules * @returns {array} raw ignore rules
*/ */
function addIgnoreFile(ig, filepath) { function addIgnoreFile(ig, filepath) {
var fileContent = fs.readFileSync(filepath, "utf8");
fileContent = fileContent.replace(/\*\*/g, "*");
return ig.addIgnoreFile(filepath); return ig.addIgnoreFile(filepath);
} }


Expand Down
13 changes: 11 additions & 2 deletions tests/lib/cli-engine.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -338,15 +338,24 @@ describe("CLIEngine", function() {
assert.equal(report.results[1].messages.length, 0); assert.equal(report.results[1].messages.length, 0);
}); });


it("should not check default ignored files without --no-ignore flag", function() {

engine = new CLIEngine({
cwd: path.join(fixtureDir, "..")
});

var report = engine.executeOnFiles(["fixtures/files/node_modules/.bar.js"]);
assert.equal(report.results.length, 0);
});

it("should not check .hidden files if they are passed explicitly without --no-ignore flag", function() { it("should not check .hidden files if they are passed explicitly without --no-ignore flag", function() {


engine = new CLIEngine({ engine = new CLIEngine({
cwd: path.join(fixtureDir, "..") cwd: path.join(fixtureDir, "..")
}); });


var report = engine.executeOnFiles(["fixtures/files/.bar.js"]); var report = engine.executeOnFiles(["fixtures/files/.bar.js"]);
assert.equal(report.results.length, 1); assert.equal(report.results.length, 0);
assert.equal(report.results[0].warningCount, 1);
}); });


it("should check .hidden files if they are passed explicitly with --no-ignore flag", function() { it("should check .hidden files if they are passed explicitly with --no-ignore flag", function() {
Expand Down

0 comments on commit b3de8f7

Please sign in to comment.