Description
If the MIME type is not strictly accurate, suggest using a specific file extension.
Examples
// ❌
<input type="file" accept="image/x-icon" />
// ✅
<input type="file" accept=".ico" />
// ❌
<input type="file" accept="application/x-rar-compressed" />
// ✅
<input type="file" accept=".rar" />
// ❌
<input type="file" accept="application/x-zip-compressed" />
// ✅
<input type="file" accept=".zip" />
// ❌
const input = document.createElement('input');
input.type = 'file';
input.setAttribute('accept', 'image/x-icon');
// Or: input.accept = 'image/x-icon';
// ✅
input.setAttribute('accept', '.ico');
// Or: input.accept = '.ico';
Proposed rule name
prefer-extension-over-mime
Additional Info
example of "bad" MIME type: https://en.wikipedia.org/wiki/ICO_(file_format)#MIME_type
Description
If the MIME type is not strictly accurate, suggest using a specific file extension.
Examples
Proposed rule name
prefer-extension-over-mime
Additional Info
example of "bad" MIME type: https://en.wikipedia.org/wiki/ICO_(file_format)#MIME_type