Repository: eslint/eslint
File: tests/bin/eslint.js (JavaScript)

Code before:
            const child = runESLint(["--stdin", "--no-config-lookup", "--rule", "semi:2"]);

            child.stdin.write("var foo = bar // <-- no semicolon\n");
            child.stdin.end();
            return assertExitCode(child, 1);
        });

        it(
            "gives a detailed error message if no config file is found in /",
            () => {
                if (
                    fs.readdirSync("/").some(
                        fileName =>
                            /^\.eslintrc(?:\.(?:js|yaml|yml|json))?$/u
                                .test(fileName)
                    )
                ) {
                    return Promise.resolve(true);
                }
                const child = runESLint(
                    ["--stdin"], { cwd: "/", env: { HOME: "/" } }
                );

                const exitCodePromise = assertExitCode(child, 2);
                const stderrPromise = getOutput(child).then(output => {
                    assert.match(
                        output.stderr,
                        /Could not find config file/u
                    );
                });

                child.stdin.write("1 < 3;\n");
                child.stdin.end();
                return Promise.all([exitCodePromise, stderrPromise]);
            }
        );

        it("successfully reads from an asynchronous pipe", () => {
            const child = runESLint(["--stdin", "--no-config-lookup"]);

            child.stdin.write("var foo = bar;\n");
            return new Promise(resolve => setTimeout(resolve, 300)).then(() => {
                child.stdin.write("var baz = qux;\n");
                child.stdin.end();

                return assertExitCode(child, 0);
            });
        });

        it("successfully handles more than 4k data via stdin", () => {
            const child = runESLint(["--stdin", "--no-config-lookup"]);

Review comment (suggestion):
It looks like this test first checks if a configuration file happens to exist in `/`, so we should probably update that part (lines 162-170) to search for `eslint.config.js` instead of eslintrc.

Code after:
            const child = runESLint(["--stdin", "--no-config-lookup", "--rule", "semi:2"]);

            child.stdin.write("var foo = bar // <-- no semicolon\n");
            child.stdin.end();
            return assertExitCode(child, 1);
        });

        it(
            "gives a detailed error message if no config file is found in /",
            () => {
                if (
                    fs.readdirSync("/").includes(
                        "eslint.config.js"
                    )
                ) {
                    return Promise.resolve(true);
                }
                const child = runESLint(
                    ["--stdin"], { cwd: "/", env: { HOME: "/" } }
                );

                const exitCodePromise = assertExitCode(child, 2);
                const stderrPromise = getOutput(child).then(output => {
                    assert.match(
                        output.stderr,
                        /Could not find config file/u
                    );
                });

                child.stdin.write("1 < 3;\n");
                child.stdin.end();
                return Promise.all([exitCodePromise, stderrPromise]);
            }
        );

        it("successfully reads from an asynchronous pipe", () => {
            const child = runESLint(["--stdin", "--no-config-lookup"]);

            child.stdin.write("var foo = bar;\n");
            return new Promise(resolve => setTimeout(resolve, 300)).then(() => {
                child.stdin.write("var baz = qux;\n");
                child.stdin.end();

                return assertExitCode(child, 0);
            });
        });

        it("successfully handles more than 4k data via stdin", () => {
            const child = runESLint(["--stdin", "--no-config-lookup"]);
            const large = fs.createReadStream(path.join(__dirname, "../bench/large.js"), "utf8");