Reports constructors of derived classes that do not call super(), and constructors of non-derived classes that call super().
✅ This rule is included in the ts javascript presets.
Constructors of derived classes (classes that extend another class) must call super() before accessing this or returning.
Constructors of non-derived classes must not call super().
Violating either requirement causes a runtime error.
This rule reports code that appears to violate either requirement.
AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Chi3 sp>5<3 sp ansty="le--0:#C792EA;--1:#8844">AEexten3 sp>5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0Pare3 sp>53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0construct sp>11<()sp ansty="le--0:#D6DEEB;--1:#403F">53()sp> {d>< {d ivclassNa="meec-li">nt < sp ansty="le--0:#7FDBCA;--1:#096E">72th sp>A72val5<3 sp ansty="le--0:#C792EA;--1:#8844">A3 sp>5<3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><21sp ansty="le--0:#D6DEEB;--1:#403F">521sp> {d><3;d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">5 sp>3;d><3}d ivclassNa="meec-li">53}d><3}d ivclassNa="meco"><}d>}d>3}d>AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Chi3 sp>5<3 sp ansty="le--0:#C792EA;--1:#8844">AEexten3 sp>5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0Pare3 sp>53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0construct sp>1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53na1(sp>7<2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>1<1)sp ansty="le--0:#D6DEEB;--1:#403F">531)sp> {d>< {d ivclassNa="meec-li">nt < sp ansty="le--0:#7FDBCA;--1:#096E">72th sp>A72na5<3 sp ansty="le--0:#C792EA;--1:#8844">A3 sp>53 nam {d>53< sp ansty="le--0:#D6DEEB;--1:#403F">5 sp><3}d ivclassNa="meec-li">53}d><3}d ivclassNa="meco"><}d>}d>3}d>AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Examp3 sp>53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0construct sp>11<()sp ansty="le--0:#D6DEEB;--1:#403F">53()sp> {d>< {d ivclassNa="meec-li">nt < sp ansty="le--0:#7FDBCA;--1:#096E">72sup sp>53( {d><);d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">5 sp>);d><3}d ivclassNa="meec-li">53}d><3}d ivclassNa="meco"><}d>}d>3}d> 44AEc31111C344AEext361B0Pa3F<53 {divclass="Nameec-">de61B0constru11<11() spans="tyle--0:#D6DEEB;--1:#40">3F11()>53 ><53 {divclass="Nameec-">dent< spans="tyle--0:#7FDBCA;--1:#09">6E72s >3F553 ><3() ;divclass="Nameec-">dent< spans="tyle--0:#7FDBCA;--1:#09">6E72 >4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72v4AE.>34<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>0<9821 spans="tyle--0:#D6DEEB;--1:#40">39821>3()>3F<53 spans="tyle--0:#D6DEEB;--1:#40">353 >3< }> }><}di vdivclass="Nameexpressive-">44AEc31111C344AEext361B0Pa3F<53 {divclass="Nameec-">de61B0constru1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53111(>6361B0st1<111) spans="tyle--0:#D6DEEB;--1:#40">3F111)>53 ><53 {divclass="Nameec-">dent< spans="tyle--0:#7FDBCA;--1:#09">6E72s >3F53(na53 >dent< spans="tyle--0:#7FDBCA;--1:#09">6E72 >4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E724AE.>34<4AE= spans="tyle--0:#D6DEEB;--1:#40">3F53 n4AE=>3F<53 spans="tyle--0:#D6DEEB;--1:#40">353 >3< }> }>}di><}di vdivclass="Nameexpressive-">44AEc31111Exa3F<53 {divclass="Nameec-">de61B0constru11<11() spans="tyle--0:#D6DEEB;--1:#40">3F11()>53 ><53 {divclass="Nameec-">dent< spans="tyle--0:#7FDBCA;--1:#09">6E72 >4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72v4AE.>34<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>0<9821 spans="tyle--0:#D6DEEB;--1:#40">39821>53 >3F<53 spans="tyle--0:#D6DEEB;--1:#40">353 >3< }> }>}di><}di vdivclass="Nameexpressive-">44AEc31111C344AEext361B0Pa3F<53 {divclass="Nameec-">3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53va53 >4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>0<9821 spans="tyle--0:#D6DEEB;--1:#40">39821>53 >3var 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.
TypeScript’s compiler enforces this check, so this rule is redundant when using TypeScript with type checking enabled.
Disable this rule if you are using TypeScript’s type checker and want to reduce redundant linting.