# no-missing-local-resource

Rule `unicorn/no-missing-local-resource`. Disallow references to missing local resources.

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-missing-local-resource` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-missing-local-resource.md) |

## Code examples

### Incorrect: the rule reports this

```js
const logo = new URL('./assets/Logo.svg', import.meta.url);
```

```html
<img src="./images/missing.png" srcset="./images/logo-small.png 1x, ./images/missing-large.png 2x">
```

### Correct: the rule accepts this

```js
const logo = new URL('./assets/logo.svg', import.meta.url);
```

```html
<img src="./images/logo.png" srcset="./images/logo-small.png 1x, ./images/logo-large.png 2x">
```

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-missing-local-resource": "error",
    },
  },
];
```

## Related rules

- [unicorn/no-manually-wrapped-comments](https://lintradar.dev/rules/unicorn/no-manually-wrapped-comments.md): Disallow manually wrapped comments.
- [unicorn/no-keyword-prefix](https://lintradar.dev/rules/unicorn/no-keyword-prefix.md): Disallow identifiers starting with `new` or `class`.
- [unicorn/no-repeated-call-wrappers](https://lintradar.dev/rules/unicorn/no-repeated-call-wrappers.md): Disallow repeating the same wrapper at every call to a function.
- [unicorn/no-unnecessary-default-arguments](https://lintradar.dev/rules/unicorn/no-unnecessary-default-arguments.md): Disallow arguments that match their parameter defaults.
- [unicorn/no-barrel-files](https://lintradar.dev/rules/unicorn/no-barrel-files.md): Disallow barrel files.
- [unicorn/no-unreadable-new-expression](https://lintradar.dev/rules/unicorn/no-unreadable-new-expression.md): Disallow unreadable `new` expressions.

---

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