function listFilesWithLegacyFunctions(src, extensions) {
  try {
    // eslint/lib/util/glob-util has been moved to eslint/lib/util/glob-utils with version 5.3
    const { listFilesToProcess: originalListFilesToProcess } = require('eslint/lib/util/glob-utils');
    // Prevent passing invalid options (extensions array) to old versions of the function.
    // https://github.com/eslint/eslint/blob/v5.16.0/lib/util/glob-utils.js#L178-L280
    // https://github.com/eslint/eslint/blob/v5.2.0/lib/util/glob-util.js#L174-L269

    return originalListFilesToProcess(src, {
      extensions,
    });
  } catch (e) {
    // Absorb this if it's MODULE_NOT_FOUND
    if (e.code !== 'MODULE_NOT_FOUND') {
      throw e;
    }

    // Last place to try (pre v5.3)
    const {
      listFilesToProcess: originalListFilesToProcess,
    } = require('eslint/lib/util/glob-util');
    const patterns = src.concat(
      flatMap(
        src,
        (pattern) => extensions.map((extension) => (/\*\*|\*\./).test(pattern) ? pattern : `${pattern}/**/*${extension}`),
      ),
    );

    return originalListFilesToProcess(patterns);
  }
}
Attempt to require old versions of the file enumeration capability from v6 `eslint` and earlier, and use
those functions to provide the list of files to operate on
@param {string} src path to the src root
@param {string[]} extensions list of supported extensions
@returns {string[]} list of files to operate on