# unicorn/no-empty-file

> Disallow files that contain no code

A file without code does nothing. It's usually left over from a refactor, or someone created it and never filled it in. It still shows up in searches and in the file tree, and importing it works but gives you nothing.

A file counts as empty if it only has whitespace, comments, directives such as `"use strict"`, lone semicolons, or empty blocks.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"unicorn/no-empty-file" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
// TODO: move the date helpers here
```

{/* bad */}
```js
"use strict";
```

Not reported:

{/* good */}
```js
export function formatDate(date) {
  return date.toISOString().slice(0, 10);
}
```

A file with a `///` comment isn't reported, because `/// <reference>` does something in TypeScript:

{/* good */}
```ts
/// <reference types="bun" />
```

`export {}` is code. It makes the file a module:

{/* good */}
```ts
export {};
```
