Skip to content

noInvalidFileInputAccept (HTML)

biome.json
{
"linter": {
"rules": {
"nursery": {
"noInvalidFileInputAccept": "error"
}
}
}
}

Disallow invalid accept values on file inputs.

An accept value must contain comma-separated filename extensions, MIME types, or the wildcard MIME types audio/*, image/*, and video/*. Browsers ignore invalid entries, so the file picker may not filter files as intended.

<input type="file" accept="image/jpg">
code-block.html:1:28 lint/nursery/noInvalidFileInputAccept  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Use image/jpeg as the file input accept value.

> 1 │ <input type="file" accept="image/jpg">
^^^^^^^^^
2 │

File input accept values must contain comma-separated filename extensions or valid MIME types.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Unsafe fix: Use the normalized file input accept value.

1 - <input·type="file"·accept="image/jpg">
1+ <input·type="file"·accept="image/jpeg">
2 2

<input type="file" accept="image/jpeg, .jpg">