Repository: eslint/eslint
File: lib/config/config-loader.js (JavaScript)

Code before:
             *
             * An empty CommonJS file exports an empty object while
             * an empty ESM file exports undefined.
             */

            let emptyConfig = typeof fileConfig === "undefined";

            debug(`Config file ${configFilePath} is ${emptyConfig ? "empty" : "not empty"}`);

            if (fileConfig) {
                if (Array.isArray(fileConfig)) {
                    if (fileConfig.length === 0) {
                        debug(`Config file ${configFilePath} is an empty array`);
                        emptyConfig = true;
                    } else {
                        configs.push(...fileConfig);
                    }
                } else {
                    if (Object.keys(fileConfig).length === 0) {
                        debug(`Config file ${configFilePath} is an empty object`);
                        emptyConfig = true;
                    } else {
                        configs.push(fileConfig);
                    }
                }
            }

            if (emptyConfig) {
                globalThis.process?.emitWarning?.(`Running ESLint with an empty config (from ${configFilePath}). Please double-check that this is what you want.`, "ESLintEmptyConfigWarning");
            }

        }

        // add in any configured defaults
        configs.push(...defaultConfigs);

        // append command line ignore patterns
        if (ignorePatterns && ignorePatterns.length > 0) {

            let relativeIgnorePatterns;

            /*
             * If the config file basePath is different than the cwd, then
             * the ignore patterns won't work correctly. Here, we adjust the
             * ignore pattern to include the correct relative path. Patterns
             * passed as `ignorePatterns` are relative to the cwd, whereas
             * the config file basePath can be an ancestor of the cwd.
             */
            if (basePath === cwd) {
                relativeIgnorePatterns = ignorePatterns;
            } else {

Review comment (bug):
```suggestion
            if (!emptyConfig) {
                if (Array.isArray(fileConfig)) {
                    if (fileConfig.length === 0) {
                        debug(`Config file ${configFilePath} is an empty array`);
                        emptyConfig = true;
                    } else {
                        configs.push(...fileConfig);
                    }
                } else {
                    if (typeof fileConfig === "object" && fileConfig !== null && Object.keys(fileConfig).length === 0) {
                        debug(`Config file ${configFilePath} is an empty object`);
                        emptyConfig = true;
                    } else {
                        configs.push(fileConfig);
                    }
                }
            }
```

To keep throwing an error on falsy values like `null` or `0`.

Code after:
             *
             * An empty CommonJS file exports an empty object while
             * an empty ESM file exports undefined.
             */

            let emptyConfig = typeof fileConfig === "undefined";

            debug(`Config file ${configFilePath} is ${emptyConfig ? "empty" : "not empty"}`);

            if (!emptyConfig) {
                if (Array.isArray(fileConfig)) {
                    if (fileConfig.length === 0) {
                        debug(`Config file ${configFilePath} is an empty array`);
                        emptyConfig = true;
                    } else {
                        configs.push(...fileConfig);
                    }
                } else {
                    if (typeof fileConfig === "object" && fileConfig !== null && Object.keys(fileConfig).length === 0) {
                        debug(`Config file ${configFilePath} is an empty object`);
                        emptyConfig = true;
                    } else {
                        configs.push(fileConfig);
                    }
                }
            }

            if (emptyConfig) {
                globalThis.process?.emitWarning?.(`Running ESLint with an empty config (from ${configFilePath}). Please double-check that this is what you want. If you want to run ESLint with an empty config, export [{}] to remove this warning.`, "ESLintEmptyConfigWarning");
            }

        }

        // add in any configured defaults
        configs.push(...defaultConfigs);

        // append command line ignore patterns
        if (ignorePatterns && ignorePatterns.length > 0) {

            let relativeIgnorePatterns;

            /*
             * If the config file basePath is different than the cwd, then
             * the ignore patterns won't work correctly. Here, we adjust the
             * ignore pattern to include the correct relative path. Patterns
             * passed as `ignorePatterns` are relative to the cwd, whereas
             * the config file basePath can be an ancestor of the cwd.
             */
            if (basePath === cwd) {
                relativeIgnorePatterns = ignorePatterns;
            } else {