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

Code before:
            lintResultCache,
            linter,
            options: eslintOptions
        } = privateMembers.get(this);
        const configs = await calculateConfigArray(this, eslintOptions);
        const {
            allowInlineConfig,
            cache,
            cwd,
            fix,
            fixTypes,
            reportUnusedDisableDirectives,
            globInputPaths,
            errorOnUnmatchedPattern,
            warnIgnored
        } = eslintOptions;
        const startTime = Date.now();
        const fixTypesSet = fixTypes ? new Set(fixTypes) : null;

        // Delete cache file; should this be done here?
        if (!cache && cacheFilePath) {
            debug(`Deleting cache file at ${cacheFilePath}`);

            try {
                await fs.unlink(cacheFilePath);
            } catch (error) {
                const errorCode = error && error.code;

                // Ignore errors when no such file exists or file system is read only (and cache file does not exist)
                if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !(await fs.exists(cacheFilePath)))) {
                    throw error;
                }
            }
        }

        const filePaths = await findFiles({
            patterns: normalizedPatterns,
            cwd,
            globInputPaths,
            configs,
            errorOnUnmatchedPattern
        });

        debug(`${filePaths.length} files found in: ${Date.now() - startTime}ms`);

        /*
         * Because we need to process multiple files, including reading from disk,
         * it is most efficient to start by reading each file via promises so that
         * they can be done in parallel. Then, we can lint the returned text. This
         * ensures we are waiting the minimum amount of time in between lints.
         */

Review comment (suggestion):
Maybe something like this so that strings with only spaces like `" "` are caught by the validation as it used to be before this change:

```suggestion
        } else {
            if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) {
                throw new Error("'patterns' must be a non-empty string or an array of non-empty strings");
            }

            if (typeof patterns === "string") {
                normalizedPatterns = [patterns];
            }
        }
```

Code after:
         * 1. `patterns` is an empty string
         * 2. `patterns` is an empty array
         *
         * In both cases, we use the cwd as the directory to lint.
         */
        if (patterns === "" || Array.isArray(patterns) && patterns.length === 0) {

            /*
             * Special case: If `passOnNoPatterns` is true, then we just exit
             * without doing any work.
             */
            if (eslintOptions.passOnNoPatterns) {
                return [];
            }

            normalizedPatterns = ["."];
        } else {

            if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) {
                throw new Error("'patterns' must be a non-empty string or an array of non-empty strings");
            }

            if (typeof patterns === "string") {
                normalizedPatterns = [patterns];
            }
        }

        debug(`Using file patterns: ${normalizedPatterns}`);

        const configs = await calculateConfigArray(this, eslintOptions);
        const {
            allowInlineConfig,
            cache,
            cwd,
            fix,
            fixTypes,
            globInputPaths,
            errorOnUnmatchedPattern,
            warnIgnored
        } = eslintOptions;
        const startTime = Date.now();
        const fixTypesSet = fixTypes ? new Set(fixTypes) : null;

        // Delete cache file; should this be done here?
        if (!cache && cacheFilePath) {
            debug(`Deleting cache file at ${cacheFilePath}`);

            try {
                await fs.unlink(cacheFilePath);
            } catch (error) {
                const errorCode = error && error.code;