PageSourceSearch

https://rgbstudios.org/_app/immutable/chunks/_page.45d3cf33.js

js rgbstudios.org collected 2026-10-01 23:56:06 UTC 11,403 bytes, 10 lines download raw bytes

1import{S as so,i as ro,s as io,N as mt,z as ao,A as no,C as po,R as uo,T as Kt,t as fo,b as co,D as yo,O as Qt,e as r,d as u,f as n,l as i,m as a,k as f,j as t,n as p,o as b,B as _o,p as l,q as s,y as vo}from"./index.bd0d3ab8.js";import{L as mo}from"./Layout.872cfa2b.js";function bo(C){let c,y,_,j,d,m,D,K,Ie,ie,R,Ue,ae,H,$e,ne,L,Q,Fe,pe,S,Ge,ue,g,V,Me,fe,E,Je,X,Ye,qe,ce,I,Ae,de,P,Xt=`<code class="language-js"><span class="token comment">// eslint-disable-next-line no-unused-vars</span>
2<span class="token keyword">const</span> author <span class="token operator">=</span> <span class="token string">'Justin'</span><span class="token punctuation">;</span></code>`,ye,U,Be,_e,$,Ne,ve,F,Z,We,me,G,ze,be,M,ee,Ke,Ee,J,Qe,he,Y,Ve,we,q,te,Xe,je,A,Ze,Pe,v,et,oe,tt,ot,le,lt,st,se,rt,it,ke,k,Zt=`<code class="language-cjs">module.exports = &#123;
3	rules: &#123;
4		&#39;@typescript-eslint/no-unused-vars&#39;: &#39;off&#39;
5	&#125;
6&#125;;</code>`,Oe,h,at,re,nt,pt,Te,O,eo=`<code class="language-json"><span class="token property">"eslintConfig"</span><span class="token operator">:</span> <span class="token punctuation">&#123;</span>
7  <span class="token property">"rules"</span><span class="token operator">:</span> <span class="token punctuation">&#123;</span>
8    <span class="token property">"no-unused-vars"</span><span class="token operator">:</span> <span class="token string">"off"</span>
9  <span class="token punctuation">&#125;</span>
10<span class="token punctuation">&#125;</span><span class="token punctuation">,</span></code>`,xe,B,ut,Ce,N,ft,De,W,ct,Re,z,dt,He,T,yt,x,_t;return{c(){c=r("figure"),y=r("picture"),_=r("source"),j=u(),d=r("img"),D=u(),K=r("figcaption"),Ie=n("Photo credit @mbaumi on Unsplash"),ie=u(),R=r("h3"),Ue=n("One Line"),ae=u(),H=r("p"),$e=n("To ignore an error in one line:"),ne=u(),L=r("p"),Q=r("code"),Fe=n("// @ts-ignore"),pe=u(),S=r("p"),Ge=n("You can also write text after it, for example:"),ue=u(),g=r("p"),V=r("code"),Me=n("// @ts-ignore: this error is dumb so we ignore it"),fe=u(),E=r("p"),Je=n("Use "),X=r("code"),Ye=n("eslint-disable-next-line"),qe=n(" to disable non-typescript rules from eslint and typescript eslint."),ce=u(),I=r("p"),Ae=n("For example:"),de=u(),P=r("pre"),ye=u(),U=r("h3"),Be=n("One File"),_e=u(),$=r("p"),Ne=n("To ignore for the entire file, put this line at the top for the rule you want to ignore:"),ve=u(),F=r("p"),Z=r("code"),We=n("/* eslint-disable @typescript-eslint/no-unused-vars */"),me=u(),G=r("p"),ze=n("If you want to enable the rule after ignoring it for several lines, just add:"),be=u(),M=r("p"),ee=r("code"),Ke=n("/* eslint-enable @typescript-eslint/no-unused-vars */"),Ee=u(),J=r("p"),Qe=n("above the location you want to start enabling it."),he=u(),Y=r("p"),Ve=n("To disable all eslint, just remove the rule name:"),we=u(),q=r("p"),te=r("code"),Xe=n("/* eslint-disable */"),je=u(),A=r("h3"),Ze=n("Project Level"),Pe=u(),v=r("p"),et=n("Edit your "),oe=r("code"),tt=n(".eslintrc"),ot=n(" or "),le=r("code"),lt=n(".eslintrc.cjs"),st=n(" and go to the rules object and set the rule you want to disable to "),se=r("code"),rt=n("'off'"),it=n(":"),ke=u(),k=r("pre"),Oe=u(),h=r("p"),at=n("You can also configure eslint rules in your "),re=r("code"),nt=n("package.json"),pt=n(":"),Te=u(),O=r("pre"),xe=u(),B=r("p"),ut=n("Use this option if you use eslint without typescript-eslint."),Ce=u(),N=r("h3"),ft=n("When to Ignore"),De=u(),W=r("p"),ct=n("Generally, you want your project to be error free. But that doesn’t mean you just ignore everything to get the lines away. The whole value of the rules are that they enforce clean and bug free code. However, you should edit rules in general to your preference, at the project level. Specific rules should only be disbaled if you’re using other code that is poorly typed. One final consideration is opportunity cost; if it would take you three hours to solve the error, but the code isn’t bug prone and can be safely left alone, maybe the project (and you) are better off spending those three hours elsewhere, so add a “TODO” comment above it and consider moving on."),Re=u(),z=r("h3"),dt=n("Related Reading"),He=u(),T=r("p"),yt=n("Check out "),x=r("a"),_t=n("Jon Middaugh’s article on ignoring TypeScript errors"),this.h()},l(e){c=i(e,"FIGURE",{});var o=a(c);y=i(o,"PICTURE",{});var Le=a(y);_=i(Le,"SOURCE",{type:!0,srcset:!0,alt:!0}),j=f(Le),d=i(Le,"IMG",{src:!0,alt:!0}),Le.forEach(t),D=f(o),K=i(o,"FIGCAPTION",{});var bt=a(K);Ie=p(bt,"Photo credit @mbaumi on Unsplash"),bt.forEach(t),o.forEach(t),ie=f(e),R=i(e,"H3",{});var Et=a(R);Ue=p(Et,"One Line"),Et.forEach(t),ae=f(e),H=i(e,"P",{});var ht=a(H);$e=p(ht,"To ignore an error in one line:"),ht.forEach(t),ne=f(e),L=i(e,"P",{});var wt=a(L);Q=i(wt,"CODE",{});var jt=a(Q);Fe=p(jt,"// @ts-ignore"),jt.forEach(t),wt.forEach(t),pe=f(e),S=i(e,"P",{});var Pt=a(S);Ge=p(Pt,"You can also write text after it, for example:"),Pt.forEach(t),ue=f(e),g=i(e,"P",{});var kt=a(g);V=i(kt,"CODE",{});var Ot=a(V);Me=p(Ot,"// @ts-ignore: this error is dumb so we ignore it"),Ot.forEach(t),kt.forEach(t),fe=f(e),E=i(e,"P",{});var Se=a(E);Je=p(Se,"Use "),X=i(Se,"CODE",{});var Tt=a(X);Ye=p(Tt,"eslint-disable-next-line"),Tt.forEach(t),qe=p(Se," to disable non-typescript rules from eslint and typescript eslint."),Se.forEach(t),ce=f(e),I=i(e,"P",{});var xt=a(I);Ae=p(xt,"For example:"),xt.forEach(t),de=f(e),P=i(e,"PRE",{class:!0});var to=a(P);to.forEach(t),ye=f(e),U=i(e,"H3",{});
10var Ct=a(U);Be=p(Ct,"One File"),Ct.forEach(t),_e=f(e),$=i(e,"P",{});var Dt=a($);Ne=p(Dt,"To ignore for the entire file, put this line at the top for the rule you want to ignore:"),Dt.forEach(t),ve=f(e),F=i(e,"P",{});var Rt=a(F);Z=i(Rt,"CODE",{});var Ht=a(Z);We=p(Ht,"/* eslint-disable @typescript-eslint/no-unused-vars */"),Ht.forEach(t),Rt.forEach(t),me=f(e),G=i(e,"P",{});var Lt=a(G);ze=p(Lt,"If you want to enable the rule after ignoring it for several lines, just add:"),Lt.forEach(t),be=f(e),M=i(e,"P",{});var St=a(M);ee=i(St,"CODE",{});var gt=a(ee);Ke=p(gt,"/* eslint-enable @typescript-eslint/no-unused-vars */"),gt.forEach(t),St.forEach(t),Ee=f(e),J=i(e,"P",{});var It=a(J);Qe=p(It,"above the location you want to start enabling it."),It.forEach(t),he=f(e),Y=i(e,"P",{});var Ut=a(Y);Ve=p(Ut,"To disable all eslint, just remove the rule name:"),Ut.forEach(t),we=f(e),q=i(e,"P",{});var $t=a(q);te=i($t,"CODE",{});var Ft=a(te);Xe=p(Ft,"/* eslint-disable */"),Ft.forEach(t),$t.forEach(t),je=f(e),A=i(e,"H3",{});var Gt=a(A);Ze=p(Gt,"Project Level"),Gt.forEach(t),Pe=f(e),v=i(e,"P",{});var w=a(v);et=p(w,"Edit your "),oe=i(w,"CODE",{});var Mt=a(oe);tt=p(Mt,".eslintrc"),Mt.forEach(t),ot=p(w," or "),le=i(w,"CODE",{});var Jt=a(le);lt=p(Jt,".eslintrc.cjs"),Jt.forEach(t),st=p(w," and go to the rules object and set the rule you want to disable to "),se=i(w,"CODE",{});var Yt=a(se);rt=p(Yt,"'off'"),Yt.forEach(t),it=p(w,":"),w.forEach(t),ke=f(e),k=i(e,"PRE",{class:!0});var oo=a(k);
10oo.forEach(t),Oe=f(e),h=i(e,"P",{});var ge=a(h);at=p(ge,"You can also configure eslint rules in your "),re=i(ge,"CODE",{});var qt=a(re);nt=p(qt,"package.json"),qt.forEach(t),pt=p(ge,":"),ge.forEach(t),Te=f(e),O=i(e,"PRE",{class:!0});var lo=a(O);lo.forEach(t),xe=f(e),B=i(e,"P",{});var At=a(B);ut=p(At,"Use this option if you use eslint without typescript-eslint."),At.forEach(t),Ce=f(e),N=i(e,"H3",{});var Bt=a(N);ft=p(Bt,"When to Ignore"),Bt.forEach(t),De=f(e),W=i(e,"P",{});var Nt=a(W);ct=p(Nt,"Generally, you want your project to be error free. But that doesn’t mean you just ignore everything to get the lines away. The whole value of the rules are that they enforce clean and bug free code. However, you should edit rules in general to your preference, at the project level. Specific rules should only be disbaled if you’re using other code that is poorly typed. One final consideration is opportunity cost; if it would take you three hours to solve the error, but the code isn’t bug prone and can be safely left alone, maybe the project (and you) are better off spending those three hours elsewhere, so add a “TODO” comment above it and consider moving on."),Nt.forEach(t),Re=f(e),z=i(e,"H3",{});var Wt=a(z);dt=p(Wt,"Related Reading"),Wt.forEach(t),He=f(e),T=i(e,"P",{});var vt=a(T);yt=p(vt,"Check out "),x=i(vt,"A",{href:!0,rel:!0});var zt=a(x);_t=p(zt,"Jon Middaugh’s article on ignoring TypeScript errors"),zt.forEach(t),vt.forEach(t),this.h()},h(){b(_,"type","image/avif"),b(_,"srcset","/img/blog/mute_light.avif"),b(_,"alt",""),_o(d.src,m="/img/blog/mute_light.jpg")||b(d,"src",m),b(d,"alt",""),b(P,"class","language-js"),b(k,"class","language-cjs"),b(O,"class","language-json"),b(x,"href","https://smartdevpreneur.com/typescript-eslint-ignore-and-disable-type-rules/"),b(x,"rel","nofollow")},m(e,o){l(e,c,o),s(c,y),s(y,_),s(y,j),s(y,d),s(c,D),s(c,K),s(K,Ie),l(e,ie,o),l(e,R,o),s(R,Ue),l(e,ae,o),l(e,H,o),s(H,$e),l(e,ne,o),l(e,L,o),s(L,Q),s(Q,Fe),l(e,pe,o),l(e,S,o),s(S,Ge),l(e,ue,o),l(e,g,o),s(g,V),s(V,Me),l(e,fe,o),l(e,E,o),s(E,Je),s(E,X),s(X,Ye),s(E,qe),l(e,ce,o),l(e,I,o),s(I,Ae),l(e,de,o),l(e,P,o),P.innerHTML=Xt,l(e,ye,o),l(e,U,o),s(U,Be),l(e,_e,o),l(e,$,o),s($,Ne),l(e,ve,o),l(e,F,o),s(F,Z),s(Z,We),l(e,me,o),l(e,G,o),s(G,ze),l(e,be,o),l(e,M,o),s(M,ee),s(ee,Ke),l(e,Ee,o),l(e,J,o),s(J,Qe),l(e,he,o),l(e,Y,o),s(Y,Ve),l(e,we,o),l(e,q,o),s(q,te),s(te,Xe),l(e,je,o),l(e,A,o),s(A,Ze),l(e,Pe,o),l(e,v,o),s(v,et),s(v,oe),s(oe,tt),s(v,ot),s(v,le),s(le,lt),s(v,st),s(v,se),s(se,rt),s(v,it),l(e,ke,o),l(e,k,o),k.innerHTML=Zt,l(e,Oe,o),l(e,h,o),s(h,at),s(h,re),s(re,nt),s(h,pt),l(e,Te,o),l(e,O,o),O.innerHTML=eo,l(e,xe,o),l(e,B,o),s(B,ut),l(e,Ce,o),l(e,N,o),s(N,ft),l(e,De,o),l(e,W,o),s(W,ct),l(e,Re,o),l(e,z,o),s(z,dt),l(e,He,o),l(e,T,o),s(T,yt),s(T,x),s(x,_t)},p:vo,d(e){e&&t(c),e&&t(ie),e&&t(R),e&&t(ae),e&&t(H),e&&t(ne),e&&t(L),e&&t(pe),e&&t(S),e&&t(ue),e&&t(g),e&&t(fe),e&&t(E),e&&t(ce),e&&t(I),e&&t(de),e&&t(P),e&&t(ye),e&&t(U),e&&t(_e),e&&t($),e&&t(ve),e&&t(F),e&&t(me),e&&t(G),e&&t(be),e&&t(M),e&&t(Ee),e&&t(J),e&&t(he),e&&t(Y),e&&t(we),e&&t(q),e&&t(je),e&&t(A),e&&t(Pe),e&&t(v),e&&t(ke),e&&t(k),e&&t(Oe),e&&t(h),e&&t(Te),e&&t(O),e&&t(xe),e&&t(B),e&&t(Ce),e&&t(N),e&&t(De),e&&t(W),e&&t(Re),e&&t(z),e&&t(He),e&&t(T)}}}function Eo(C){let c,y;const _=[C[0],Vt];let j={$$slots:{default:[bo]},$$scope:{ctx:C}};for(let d=0;d<_.length;d+=1)j=mt(j,_[d]);return c=new mo({props:j}),{c(){ao(c.$$.fragment)},l(d){no(c.$$.fragment,d)},m(d,m){po(c,d,m),y=!0},p(d,[m]){const D=m&1?uo(_,[m&1&&Kt(d[0]),m&0&&Kt(Vt)]):{};m&2&&(D.$$scope={dirty:m,ctx:d}),c.$set(D)},i(d){y||(fo(c.$$.fragment,d),y=!0)},o(d){co(c.$$.fragment,d),y=!1},d(d){yo(c,d)}}}const Vt={layout:"blog_layout",title:"How to Disable Specific TypeScript Rules",slug:"disable-typescript-rules",date:"2023/07/20",updated_date:"2023/07/20",author:"Justin Golden",preview_text:"Learn how to disable and ignore TypeScript warnings and errors by line, by file, and by project",img:"/img/blog/mute_light.avif",categories:["webdev","typescript"],keywords:["typescript disable rule","typescript disable error","typescript disable warning","typescript ignore rule","typescript ignore error","typescript ignore warning","typescript ignore rule one line","typescript ignore rule entire file","typescript ignore rule one instance"]};function ho(C,c,y){return C.$$set=_=>{y(0,c=mt(mt({},c),Qt(_)))},c=Qt(c),[c]}class Po extends so{constructor(c){super(),ro(this,c,ho,Eo,io,{})}}export{Po as default,Vt as metadata};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.