Repository: eslint/eslint
File: tests/lib/eslint/flat-eslint.js (JavaScript)

Code before:
                assert.strictEqual(await engine.isPathIgnored("bar.js"), true);
                assert.strictEqual(await engine.isPathIgnored("subdir/bar.js"), false);
            });

            it("'lintFiles()' should not verify 'foo.js' and '/bar.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });
                const filePaths = (await engine.lintFiles("**/*.js"))
                    .map(r => r.filePath)
                    .sort();

                assert.deepStrictEqual(filePaths, [
                    path.join(getPath(), "baz.js"),
                    path.join(getPath(), "eslint.config.js"),
                    path.join(getPath(), "subdir/bar.js"),
                    path.join(getPath(), "subdir/baz.js")
                ]);
            });
        });

        describe("ignores can unignore '/node_modules/foo'.", () => {

            const { prepare, cleanup, getPath } = createCustomTeardown({
                cwd: `${root}-unignores`,
                files: {
                    "eslint.config.js": `module.exports = {
                        ignores: ["!**/node_modules/foo/**"]
                    };`,
                    "node_modules/foo/index.js": "",
                    "node_modules/foo/.dot.js": "",
                    "node_modules/bar/index.js": "",
                    "foo.js": ""
                }
            });

            beforeEach(prepare);
            afterEach(cleanup);

            it("'isPathIgnored()' should return 'false' for 'node_modules/foo/index.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });

                assert.strictEqual(await engine.isPathIgnored("node_modules/foo/index.js"), false);
            });

            it("'isPathIgnored()' should return 'false' for 'node_modules/foo/.dot.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });

                assert.strictEqual(await engine.isPathIgnored("node_modules/foo/.dot.js"), false);
            });

            it("'isPathIgnored()' should return 'true' for 'node_modules/bar/index.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });

Review comment (suggestion):
I wouldn't expect this pattern to have any effects after [`**/node_modules/**`](https://github.com/eslint/eslint/blob/de12b266f2aa6f063d0af888b8f0de41d09ec33f/lib/config/default-config.js#L54).

```
**/node_modules/**
!**/node_modules/foo/**
```

The first test below asserts that `node_modules/foo/index.js` is not ignored. I think that this file should be ignored because it's in ignored directory  `node_modules/foo`.

`**/node_modules/**` ignores `node_modules/foo`, but `!**/node_modules/foo/**` does not unignore it.

Code after:
                assert.strictEqual(await engine.isPathIgnored("bar.js"), true);
                assert.strictEqual(await engine.isPathIgnored("subdir/bar.js"), false);
            });

            it("'lintFiles()' should not verify 'foo.js' and '/bar.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });
                const filePaths = (await engine.lintFiles("**/*.js"))
                    .map(r => r.filePath)
                    .sort();

                assert.deepStrictEqual(filePaths, [
                    path.join(getPath(), "baz.js"),
                    path.join(getPath(), "eslint.config.js"),
                    path.join(getPath(), "subdir/bar.js"),
                    path.join(getPath(), "subdir/baz.js")
                ]);
            });
        });


        describe("ignores can unignore '/node_modules/foo'.", () => {

            const { prepare, cleanup, getPath } = createCustomTeardown({
                cwd: `${root}-unignores`,
                files: {
                    "eslint.config.js": `module.exports = {
                        ignores: ["!**/node_modules/foo"]
                    };`,
                    "node_modules/foo/index.js": "",
                    "node_modules/foo/.dot.js": "",
                    "node_modules/bar/index.js": "",
                    "foo.js": ""
                }
            });

            beforeEach(prepare);
            afterEach(cleanup);

            it("'isPathIgnored()' should return 'false' for 'node_modules/foo/index.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });

                assert.strictEqual(await engine.isPathIgnored("node_modules/foo/index.js"), false);
            });

            it("'isPathIgnored()' should return 'false' for 'node_modules/foo/.dot.js'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });

                assert.strictEqual(await engine.isPathIgnored("node_modules/foo/.dot.js"), false);
            });

            it("'isPathIgnored()' should return 'true' for 'node_modules/bar/index.js'.", async () => {