Skip to content

Commit 2dbe2b9

Browse files
authored
fix: consider negated patterns universal (eslint#220)
1 parent 3089754 commit 2dbe2b9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/config-array/src/config-array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ export class ConfigArray extends Array {
979979

980980
const matchingConfigIndices = [];
981981
let matchFound = false;
982-
const universalPattern = /^\*$|\/\*{1,2}$/u;
982+
const universalPattern = /^\*$|^!|\/\*{1,2}$/u;
983983

984984
this.forEach((config, index) => {
985985
if (!config.files) {

packages/config-array/tests/config-array.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,12 +1525,12 @@ describe("ConfigArray", () => {
15251525
);
15261526
});
15271527

1528-
it('should return "matched" when passed docx filename', () => {
1528+
it('should return "unconfigured" when passed docx filename', () => {
15291529
const filename = "sss.docx";
15301530

15311531
assert.strictEqual(
15321532
configs.getConfigStatus(filename),
1533-
"matched",
1533+
"unconfigured",
15341534
);
15351535
});
15361536

@@ -1869,6 +1869,8 @@ describe("ConfigArray", () => {
18691869
[["foo/**", "**/*.js"], "bar/**"],
18701870
[["bar/**"], "foo/*.js"],
18711871
[[], "foo/*.js"],
1872+
[["bar/**", "!bar/b.js"], "foo/*.js"],
1873+
["!b.js", "foo/*.js"],
18721874
].forEach(files => {
18731875
configs = new ConfigArray(
18741876
[

0 commit comments

Comments
 (0)