---
url: /docs/guide/usage/linter/rules/unicorn/no-empty-file.md
---

### What it does

Disallows files that do not contain any meaningful code.

This includes files that consist only of:

* Whitespace
* Comments
* Directives (e.g., `"use strict"`)
* Empty statements (`;`)
* Empty blocks (`{}`)
* Hashbangs (`#!/usr/bin/env node`)

### Why is this bad?

Files with no executable or exportable content are typically unintentional
or left over from refactoring. They clutter the codebase and may confuse
tooling or developers by appearing to serve a purpose when they do not.

### Examples

Examples of **incorrect** code for this rule:

```js
```

```js
// Comment
```

```js
/* Comment */
```

```js
"use strict";
```

```js
```

```js
{
}
```

```js
#!/usr/bin/env node
```

Examples of **correct** code for this rule:

```js
const x = 0;
```

```js
"use strict";
const x = 0;
```

```js
const x = 0;
```

```js
{
  const x = 0;
}
```

## How to use

## Version

This rule was added in v0.0.15.

## References
