Skip to content

Commit

Permalink
Fix: make overrides[].files matching dotfiles (fixes #11201) (#11225)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored and not-an-aardvark committed Apr 1, 2019
1 parent 0fb5fd4 commit 19248e0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/config/config-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ module.exports = {
}
});

const opts = { matchBase: true };
const opts = { dot: true, matchBase: true };

return patternList.some(pattern => minimatch(filePath, pattern, opts)) &&
!excludedPatternList.some(excludedPattern => minimatch(filePath, excludedPattern, opts));
Expand Down
6 changes: 6 additions & 0 deletions tests/fixtures/cli-engine/overrides-with-dot/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root: true

overrides:
- files: "*.js"
rules:
no-unused-vars: error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var a = 0
17 changes: 17 additions & 0 deletions tests/lib/cli-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,23 @@ describe("CLIEngine", () => {
}, "No files matching 'non-exist.js' were found.");
});
});

describe("overrides", () => {
beforeEach(() => {
engine = new CLIEngine({
cwd: getFixturePath("cli-engine/overrides-with-dot"),
ignore: false
});
});

it("should recognize dotfiles", () => {
const ret = engine.executeOnFiles([".test-target.js"]);

assert.strictEqual(ret.results.length, 1);
assert.strictEqual(ret.results[0].messages.length, 1);
assert.strictEqual(ret.results[0].messages[0].ruleId, "no-unused-vars");
});
});
});

describe("getConfigForFile", () => {
Expand Down

0 comments on commit 19248e0

Please sign in to comment.