# no-invalid-file-input-accept

Rule `unicorn/no-invalid-file-input-accept`. Disallow invalid `accept` values on file inputs.

- Source: unicorn
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 413K weekly downloads of presets that enable it
- Trend: −5.0% last quarter
- Rank: #1618 by reach, #1629 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-invalid-file-input-accept` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-invalid-file-input-accept.md) |
| Biome | `nursery/noInvalidFileInputAccept` | no | unsafe | group nursery, since 2.5.12 | [docs](https://biomejs.dev/linter/rules/no-invalid-file-input-accept/) |

## Code examples

### Incorrect: the rule reports this

```jsx
<input type="file" accept="image/jpg" />;
```

```html
<input type="file" accept="image/jpg">
```

```jsx
<input type="file" accept="png" />;
```

### Correct: the rule accepts this

```jsx
<input type="file" accept="image/jpeg" />;
```

```html
<input type="file" accept="image/jpeg">
```

```jsx
<input type="file" accept=".png" />;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-invalid-file-input-accept": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noInvalidFileInputAccept": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-empty-link-text](https://lintradar.dev/rules/unicorn/no-empty-link-text.md): Disallow empty link text in Markdown.
- [unicorn/no-javascript-url](https://lintradar.dev/rules/unicorn/no-javascript-url.md): Disallow `javascript:` URLs in Markdown.
- [unicorn/no-loss-of-precision](https://lintradar.dev/rules/unicorn/no-loss-of-precision.md): Disallow numeric literals that lose precision when represented as IEEE 754 binary64 values.
- [unicorn/require-post-message-target-origin](https://lintradar.dev/rules/unicorn/require-post-message-target-origin.md): Enforce using the `targetOrigin` argument with `window.postMessage()`.
- [unicorn/prefer-import-meta-properties](https://lintradar.dev/rules/unicorn/prefer-import-meta-properties.md): Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.
- [unicorn/custom-error-definition](https://lintradar.dev/rules/unicorn/custom-error-definition.md): Enforce correct `Error` subclassing.

---

Web page: https://lintradar.dev/rules/unicorn/no-invalid-file-input-accept. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
