Skip to content

Commit

Permalink
Make more tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Oct 4, 2022
1 parent 2c36349 commit d7bc4fb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.defaultConfig = [
{
ignores: [
"**/node_modules/**",
"**/.git"
".git/"
]
},

Expand Down
2 changes: 1 addition & 1 deletion lib/eslint/eslint-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async function findFiles({
if (stat.isFile()) {
results.push({
filePath,
ignored: configs.isIgnored(filePath)
ignored: configs.isFileIgnored(filePath)
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"bugs": "https://github.com/eslint/eslint/issues/",
"dependencies": {
"@eslint/eslintrc": "^1.3.2",
"@humanwhocodes/config-array": "^0.11.1",
"@humanwhocodes/config-array": "^0.11.2",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/ignores-directory/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
ignores: ["subdir/subsubdir"]
};
Empty file.
20 changes: 20 additions & 0 deletions tests/lib/eslint/flat-eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,26 @@ describe("FlatESLint", () => {
});


// https://github.com/eslint/eslint/issues/16354
it.only("should skip subdirectory files when ignore pattern matches subdirectory", async () => {
eslint = new FlatESLint({
cwd: getFixturePath("ignores-directory")
});

await assert.rejects(async () => {
await eslint.lintFiles(["subdir/**"]);
}, /All files matched by 'subdir\/\*\*' are ignored\./u);

await assert.rejects(async () => {
await eslint.lintFiles(["subdir/subsubdir/**"]);
}, /All files matched by 'subdir\/subsubdir\/\*\*' are ignored\./u);

await assert.rejects(async () => {
await eslint.lintFiles(["subdir/subsubdir/a.js"]);
}, /All files matched by 'subdir\/subsubdir\/a.js' are ignored\./u);
});


});


Expand Down

0 comments on commit d7bc4fb

Please sign in to comment.