Reports files with Unicode Byte Order Marks (BOMs).
✅ This rule is included in the ts stylistic and stylisticStrict presets.
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.
76// File starts with BOM character (U+FEFAEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">82= sp><42sp ansty="le--0:#D6DEEB;--1:#403F">542sp><3;d ivclassNa="meco"><2;d>2;d>3;d> 6376// File without BOM chara44AEco61B0v44A09<8242 spans="tyle--0:#D6DEEB;--1:#40">38242>var e=class e extends HTMLElement{static#e=new Map;tabs;panels;#t;#n=`starlight-synced-tabs__`;constructor(){super();let t=this.querySelector(`[role="tablist"]`);if(this.tabs=[...t.querySelectorAll(`[role="tab"]`)],this.panels=[...this.querySelectorAll(`:scope > [role="tabpanel"]`)],this.#t=this.dataset.syncKey,this.#t){let t=e.#e.get(this.#t)??[];t.push(this),e.#e.set(this.#t,t)}this.tabs.forEach((e,n)=>{e.addEventListener(`click`,e=>{e.preventDefault();let r=t.querySelector(`[aria-selected="true"]`);e.currentTarget!==r&&this.switchTab(e.currentTarget,n)}),e.addEventListener(`keydown`,e=>{let t=this.tabs.indexOf(e.currentTarget),n=e.key===`ArrowLeft`?t-1:e.key===`ArrowRight`?t+1:e.key===`Home`?0:e.key===`End`?this.tabs.length-1:null;n!==null&&this.tabs[n]&&(e.preventDefault(),this.switchTab(this.tabs[n],n))})})}switchTab(t,n,r=!0){if(!t)return;let i=r?this.getBoundingClientRect().top:0;this.tabs.forEach(e=>{e.setAttribute(`aria-selected`,`false`),e.setAttribute(`tabindex`,`-1`)}),this.panels.forEach(e=>{e.hidden=!0});let a=this.panels[n];a&&(a.hidden=!1),t.removeAttribute(`tabindex`),t.setAttribute(`aria-selected`,`true`),r&&(t.focus(),e.#i(this,t),window.scrollTo({top:window.scrollY+(this.getBoundingClientRect().top-i),behavior:`instant`}))}#r(e){this.#t&&typeof localStorage<`u`&&localStorage.setItem(this.#n+this.#t,e)}static#i(t,n){let r=t.#t,i=e.#a(n);if(!r||!i)return;let a=e.#e.get(r);if(a){for(let n of a){if(n===t)continue;let r=n.tabs.findIndex(t=>e.#a(t)===i);r!==-1&&n.switchTab(n.tabs[r],r,!1)}t.#r(i)}}static#a(e){return e.textContent?.trim()}};customElements.define(`starlight-tabs`,e);
This rule is not configurable.
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.