Skip to content

Commit

Permalink
Upgrade config-array to fix globbing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Oct 21, 2022
1 parent fb0f35e commit f93bb26
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -56,7 +56,7 @@
"bugs": "https://github.com/eslint/eslint/issues/",
"dependencies": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.11.5",
"@humanwhocodes/config-array": "^0.11.6",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
Expand Down
18 changes: 15 additions & 3 deletions tests/lib/eslint/flat-eslint.js
Expand Up @@ -808,6 +808,20 @@ describe("FlatESLint", () => {
assert.strictEqual(results[0].suppressedMessages.length, 0);
});

// https://github.com/eslint/eslint/issues/16275
it("should throw an error for a missing pattern when combined with a found pattern", async () => {
eslint = new FlatESLint({
ignore: false,
cwd: getFixturePath("example-app2")
});
const results = await eslint.lintFiles(["subdir1", "doesnotexist/*.js"]);

assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].messages.length, 0);
assert.strictEqual(results[0].filePath, getFixturePath("example-app2/subdir1/a.js"));
assert.strictEqual(results[0].suppressedMessages.length, 0);
});

// https://github.com/eslint/eslint/issues/16260
describe("Globbing based on configs", () => {
it("should report zero messages when given a directory with a .js and config file specifying a subdirectory", async () => {
Expand Down Expand Up @@ -4559,7 +4573,7 @@ describe("FlatESLint", () => {
beforeEach(prepare);
afterEach(cleanup);

it("'lintFiles()' with a directory path should contain 'foo/test.txt' and 'foo/nested/test.txt'.", async () => {
it("'lintFiles()' with a directory path should NOT contain 'foo/test.txt' and 'foo/nested/test.txt'.", async () => {
const engine = new FlatESLint({ cwd: getPath() });
const filePaths = (await engine.lintFiles("."))
.map(r => r.filePath)
Expand All @@ -4568,9 +4582,7 @@ describe("FlatESLint", () => {
assert.deepStrictEqual(filePaths, [
path.join(getPath(), "bar/test.js"),
path.join(getPath(), "eslint.config.js"),
path.join(getPath(), "foo/nested/test.txt"),
path.join(getPath(), "foo/test.js"),
path.join(getPath(), "foo/test.txt"),
path.join(getPath(), "test.js")
]);
});
Expand Down

0 comments on commit f93bb26

Please sign in to comment.