no-empty-file

March 27, 2026 ยท View on GitHub

๐Ÿ“ Disallow empty files.

๐Ÿ’ผ This rule is enabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

Meaningless files clutter a codebase.

Disallow any files only containing the following:

  • Whitespace
  • Comments
  • Directives
  • Empty statements
  • Empty block statements
  • Hashbang

Examples

These files fail:

// Comment
/* Comment */
'use strict';
;
{
}
#!/usr/bin/env node

These files pass:

const x = 0;
'use strict';
const x = 0;
;;
const x = 0;
{
	const x = 0;
}