From 4d84f6f622da2ed35975e5f561ad0c01c29efd0d Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Tue, 4 Oct 2022 10:43:47 -0700 Subject: [PATCH] Add another test --- tests/fixtures/ignores-self/eslint.config.js | 3 +++ tests/lib/eslint/flat-eslint.js | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/fixtures/ignores-self/eslint.config.js diff --git a/tests/fixtures/ignores-self/eslint.config.js b/tests/fixtures/ignores-self/eslint.config.js new file mode 100644 index 00000000000..35f93ee5df3 --- /dev/null +++ b/tests/fixtures/ignores-self/eslint.config.js @@ -0,0 +1,3 @@ +module.exports = { + ignores: ["**/ignores-self/**"] +}; diff --git a/tests/lib/eslint/flat-eslint.js b/tests/lib/eslint/flat-eslint.js index 583a7c4b974..3d895f5ec13 100644 --- a/tests/lib/eslint/flat-eslint.js +++ b/tests/lib/eslint/flat-eslint.js @@ -1136,6 +1136,21 @@ describe("FlatESLint", () => { }); + // https://github.com/eslint/eslint/issues/16340 + it("should lint files even when cwd directory name matches ignores pattern", async () => { + eslint = new FlatESLint({ + cwd: getFixturePath("ignores-self") + }); + + const results = await eslint.lintFiles(["*.js"]); + + assert.strictEqual(results.length, 1); + assert.strictEqual(results[0].filePath, getFixturePath("ignores-self/eslint.config.js")); + assert.strictEqual(results[0].errorCount, 0); + assert.strictEqual(results[0].warningCount, 0); + + }); + });