function wrapConfigErrorWithDetails(error, originalLength, baseLength) {
	let location = "user-defined";
	let configIndex = error.index;

	/*
	 * A config array is set up in this order:
	 * 1. Base config
	 * 2. Original configs
	 * 3. User-defined configs
	 * 4. CLI-defined configs
	 *
	 * So we need to adjust the index to account for the base config.
	 *
	 * - If the index is less than the base length, it's in the base config
	 *   (as specified by `baseConfig` argument to `FlatConfigArray` constructor).
	 * - If the index is greater than the base length but less than the original
	 *   length + base length, it's in the original config. The original config
	 *   is passed to the `FlatConfigArray` constructor as the first argument.
	 * - Otherwise, it's in the user-defined config, which is loaded from the
	 *   config file and merged with any command-line options.
	 */
	if (error.index < baseLength) {
		location = "base";
	} else if (error.index < originalLength + baseLength) {
		location = "original";
		configIndex = error.index - baseLength;
	} else {
		configIndex = error.index - originalLength - baseLength;
	}

	return new TypeError(
		`${error.message.slice(0, -1)} at ${location} index ${configIndex}.`,
		{ cause: error },
	);
}
Wraps a config error with details about where the error occurred.
@param {Error} error The original error.
@param {number} originalLength The original length of the config array.
@param {number} baseLength The length of the base config.
@returns {TypeError} The new error with details.