Skip to content
Permalink
Browse files

Fix: Do not show ignore messages for default ignored files (fixes #4931)

  • Loading branch information...
gyandeeps committed Jan 13, 2016
1 parent c01016a commit b3de8f798ea282b2a49466466cb1be636d22f2fd
Showing with 11 additions and 8 deletions.
  1. +0 −4 lib/cli-engine.js
  2. +0 −2 lib/ignored-paths.js
  3. +11 −2 tests/lib/cli-engine.js
@@ -97,7 +97,6 @@ var defaultOptions = {
cacheFile: ".eslintcache",
fix: false,
allowInlineConfig: true,
warnIgnoredByDefault: true,
cwd: process.cwd()
},
loadedPlugins = Object.create(null);
@@ -605,9 +604,6 @@ CLIEngine.prototype = {
}

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

@@ -146,8 +146,6 @@ function IgnoredPaths(options) {
* @returns {array} raw ignore rules
*/
function addIgnoreFile(ig, filepath) {
var fileContent = fs.readFileSync(filepath, "utf8");
fileContent = fileContent.replace(/\*\*/g, "*");
return ig.addIgnoreFile(filepath);
}

@@ -338,15 +338,24 @@ describe("CLIEngine", function() {
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() {

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

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

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

0 comments on commit b3de8f7

Please sign in to comment.
You can’t perform that action at this time.