Due to client request, I have to remove all the warnings about missing alt text on images in Sitecore(I know, don't ask).
I was able to do that for every where except in the folder view in Media Library, where you see all the thumbnails of images and folders. It displays warnings beneath the image and if you mouse over "1 warning", it says "The Alt field is empty."
After some digging, I found that this validation is defined in web.config under this path:
/configuration/sitecore/mediaLibrary/mediaTypes/mediaType/mediaValidator
This is where it's defined for JPEG images:
         <mediaType name="JPEG image" extensions="jpg, jpeg, jpe, jfif">
          <mimeType>image/jpeg</mimeType>
          <forceDownload>false</forceDownload>
          <sharedTemplate>system/media/unversioned/jpeg</sharedTemplate>
          <versionedTemplate>system/media/versioned/jpeg</versionedTemplate>
          <mediaValidator type="Sitecore.Resources.Media.ImageValidator"/>
          <thumbnails>
            <generator type="Sitecore.Resources.Media.ImageThumbnailGenerator, Sitecore.Kernel">
              <extension>png</extension>
            </generator>
            <width>150</width>
            <height>150</height>
            <backgroundColor>#FFFFFF</backgroundColor>
          </thumbnails>
          <prototypes>
            <media type="Sitecore.Resources.Media.JpegMedia, Sitecore.Kernel"/>
          </prototypes>
        </mediaType>
And in Sitecore.Resources.Media.ImageValidator, all the validation and messages are hard-coded:
using Sitecore.Configuration;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;

namespace Sitecore.Resources.Media
{
/// <summary>Represents a Media Validator.</summary>
public class ImageValidator : MediaValidator
{
/// <summary>Validates the specified output.</summary>
/// <param name="item">The item.</param>
/// <param name="results">The warnings.</param>
protected override void ValidateItem(MediaItem item, MediaValidatorResult results)
{
Assert.ArgumentNotNull((object) item, "item");
Assert.ArgumentNotNull((object) results, "results");
base.ValidateItem(item, results);
if (item.Size >= Settings.Media.MaxSizeInMemory)
results.Warnings.Add("This image is too big to be resized.");
if (string.IsNullOrEmpty(item.Alt))
results.Warnings.Add("The Alt field is empty.");
if (string.IsNullOrEmpty(item.InnerItem["Width"]))
results.Warnings.Add("The Width field is empty.");
else if (MainUtil.GetInt(item.InnerItem["Width"], -1) == -1)
results.Warnings.Add("The Width field does not contain an integer.");
if (string.IsNullOrEmpty(item.InnerItem["Height"]))
{
results.Warnings.Add("The Height field is empty.");
}
else
{
if (MainUtil.GetInt(item.InnerItem["Height"], -1) != -1)
return;
results.Warnings.Add("The Height field does not contain an integer.");
}
}
}
}
So the solution is just to make a custom type that's similar to this but without the alt text validations.