unicodeBOMs
Reports files with Unicode Byte Order Marks (BOMs).
✅ This rule is included in the ts stylistic
preset.
The Unicode Byte Order Mark (BOM) is a special character (U+FEFF) that can appear at the start of a file to indicate its byte order and encoding. While it can be useful in some contexts, it is generally unnecessary in UTF-8 files and can cause issues with some tools and editors that do not expect it.
Examples
Section titled “Examples”// File starts with BOM character (U+FEFF)const value = 42;
// File without BOM characterconst value = 42;
Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you are working in an environment that specifically requires UTF-8 files to have a BOM, you might choose to disable this rule. However, this is uncommon in modern development, as most tools and editors handle UTF-8 files without a BOM correctly.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
unicode-bom
- Oxlint:
eslint/unicode-bom
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.