Reports numeric literals with unnecessary zero fractions or dangling dots.
✅ This rule is included in the ts stylistic presets.
Numeric literals with trailing zero fractions (e.g., 1.0) or dangling dots (e.g., 1.) are unnecessarily verbose and can be confusing.
The zero fraction or dangling dot doesn’t add any precision information to the number.
This rule reports numeric literals with unnecessary zero fractions or dangling dots.
AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">821= sp><.0sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><0;d>0;d>3;d>AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">8213= sp><.0sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><0;d>0;d>3;d>AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">8= sp><21sp ansty="le--0:#D6DEEB;--1:#403F">521sp><3;d ivclassNa="meco">AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">821= sp><.2sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><2;d>2;d>3;d> 44AEco61B0v44A0<9821 spans="tyle--0:#D6DEEB;--1:#40">39821><= 1>= 1><;di vdivclass="Nameexpressive-">44AEco61B0v44A09<8213 spans="tyle--0:#D6DEEB;--1:#40">38213>44AEco61B0v44A0<9821 spans="tyle--0:#D6DEEB;--1:#40">39821><= 1>= 1>;di><;di vdivclass="Nameexpressive-">44AEco61B0v44A098<21.2 spans="tyle--0:#D6DEEB;--1:#40">321.2>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 prefer explicit zero fractions or dangling dots in numeric literals for stylistic consistency, this rule may not be for you.