noInvalidFileInputAccept (JavaScript)
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noInvalidFileInputAccept - This rule has an unsafe fix.
- The default severity of this rule is error.
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noInvalidFileInputAccept": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<input type="file" accept="image/jpg" />code-block.jsx:1:27 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" />Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.