Repository: eslint/eslint
File: lib/linter/linter.js (JavaScript)

Code before:
        if (!preprocessResult.ok) {
            return preprocessResult.errors;
        }

        const filterCodeBlock =
            options.filterCodeBlock ||
            (blockFilename => blockFilename.endsWith(".js"));
        const originalExtname = path.extname(filename);
        const { files } = preprocessResult;

        const messageLists = files.map(block => {
            debug("A code block was found: %o", block.path || "(unnamed)");

            // Keep the legacy behavior.
            if (typeof block === "string") {
                return this._verifyWithFlatConfigArrayAndWithoutProcessors(block, config, options);
            }

            // Skip this block if filtered.
            if (!filterCodeBlock(block.path, block.body)) {
                debug("This code block was skipped.");
                return [];
            }

            // Resolve configuration again if the file content or extension was changed.
            if (configForRecursive && (text !== block.body || path.extname(block.path) !== originalExtname)) {
                debug("Resolving configuration again because the file content or extension was changed.");
                return this._verifyWithFlatConfigArray(
                    block.body,
                    configForRecursive,
                    { ...options, filename: block.path, physicalFilename: block.physicalPath }
                );
            }

            slots.lastSourceCode = null;

            // Does lint.
            return this.#flatVerifyWithoutProcessors(
                block,
                config,
                { ...options, filename: block.path, physicalFilename: block.physicalPath }
            );
        });

        return postprocess(messageLists, filenameToExpose);
    }

    /**
     * Verify using flat config and without any processors.
     * @param {VFile} file The file to lint.
     * @param {FlatConfig} providedConfig An ESLintConfig instance to configure everything.

Review comment (suggestion):
```suggestion
            if (configForRecursive && (text !== block.rawBody || path.extname(block.path) !== originalExtname)) {
```

To make the example from https://github.com/eslint/eslint/pull/18818#discussion_r1743608645 still work as before.

Code after:
        if (!preprocessResult.ok) {
            return preprocessResult.errors;
        }

        const filterCodeBlock =
            options.filterCodeBlock ||
            (blockFilename => blockFilename.endsWith(".js"));
        const originalExtname = path.extname(filename);
        const { files } = preprocessResult;

        const messageLists = files.map(block => {
            debug("A code block was found: %o", block.path || "(unnamed)");

            // Keep the legacy behavior.
            if (typeof block === "string") {
                return this._verifyWithFlatConfigArrayAndWithoutProcessors(block, config, options);
            }

            // Skip this block if filtered.
            if (!filterCodeBlock(block.path, block.body)) {
                debug("This code block was skipped.");
                return [];
            }

            // Resolve configuration again if the file content or extension was changed.
            if (configForRecursive && (text !== block.rawBody || path.extname(block.path) !== originalExtname)) {
                debug("Resolving configuration again because the file content or extension was changed.");
                return this._verifyWithFlatConfigArray(
                    block.rawBody,
                    configForRecursive,
                    { ...options, filename: block.path, physicalFilename: block.physicalPath }
                );
            }

            slots.lastSourceCode = null;

            // Does lint.
            return this.#flatVerifyWithoutProcessors(
                block,
                config,
                { ...options, filename: block.path, physicalFilename: block.physicalPath }
            );
        });

        return processorService.postprocessSync(file, messageLists, {
            processor: {
                preprocess,
                postprocess
            }
        });
    }