diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9ad30e6a04..ee522ce49c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -149,7 +149,17 @@ jobs: fail-fast: false matrix: node: ['18.x'] - example: ['cra4', 'cra5', 'next', 'vite', 'node-standard', 'node-esm', 'react-native', 'expo'] + example: + [ + 'cra4', + 'cra5', + 'next', + 'vite', + 'node-standard', + 'node-esm', + 'react-native', + 'expo', + ] defaults: run: working-directory: ./examples/publish-ci/${{ matrix.example }} diff --git a/.prettierrc.json b/.prettierrc.json index 61ca55dbb6..6ef9e41d05 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,4 +3,3 @@ "singleQuote": true, "endOfLine": "auto" } - \ No newline at end of file diff --git a/.yarn/releases/yarn-3.2.4.cjs b/.yarn/releases/yarn-3.2.4.cjs index 38f17fd49e..f607954682 100644 --- a/.yarn/releases/yarn-3.2.4.cjs +++ b/.yarn/releases/yarn-3.2.4.cjs @@ -1,7 +1,7 @@ #!/usr/bin/env node /* eslint-disable */ //prettier-ignore -(()=>{var nfe=Object.create;var HS=Object.defineProperty;var sfe=Object.getOwnPropertyDescriptor;var ofe=Object.getOwnPropertyNames;var afe=Object.getPrototypeOf,Afe=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var y=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ht=(r,e)=>{for(var t in e)HS(r,t,{get:e[t],enumerable:!0})},lfe=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ofe(e))!Afe.call(r,n)&&n!==t&&HS(r,n,{get:()=>e[n],enumerable:!(i=sfe(e,n))||i.enumerable});return r};var ne=(r,e,t)=>(t=r!=null?nfe(afe(r)):{},lfe(e||!r||!r.__esModule?HS(t,"default",{value:r,enumerable:!0}):t,r));var ZU=y(($_e,_U)=>{_U.exports=XU;XU.sync=Dfe;var zU=J("fs");function Pfe(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var i=0;i{r1.exports=e1;e1.sync=kfe;var $U=J("fs");function e1(r,e,t){$U.stat(r,function(i,n){t(i,i?!1:t1(n,e))})}function kfe(r,e){return t1($U.statSync(r),e)}function t1(r,e){return r.isFile()&&Rfe(r,e)}function Rfe(r,e){var t=r.mode,i=r.uid,n=r.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=a|l,g=t&c||t&l&&n===o||t&a&&i===s||t&u&&s===0;return g}});var s1=y((rZe,n1)=>{var tZe=J("fs"),RI;process.platform==="win32"||global.TESTING_WINDOWS?RI=ZU():RI=i1();n1.exports=nv;nv.sync=Ffe;function nv(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){nv(r,e||{},function(s,o){s?n(s):i(o)})})}RI(r,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),t(i,n)})}function Ffe(r,e){try{return RI.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var g1=y((iZe,u1)=>{var Xg=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",o1=J("path"),Nfe=Xg?";":":",a1=s1(),A1=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),l1=(r,e)=>{let t=e.colon||Nfe,i=r.match(/\//)||Xg&&r.match(/\\/)?[""]:[...Xg?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],n=Xg?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Xg?n.split(t):[""];return Xg&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},c1=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=l1(r,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(A1(r));let f=i[c],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=o1.join(h,r),m=!h&&/^\.[\\\/]/.test(r)?r.slice(0,2)+p:p;u(l(m,c,0))}),l=(c,u,g)=>new Promise((f,h)=>{if(g===n.length)return f(a(u+1));let p=n[g];a1(c+p,{pathExt:s},(m,w)=>{if(!m&&w)if(e.all)o.push(c+p);else return f(c+p);return f(l(c,u,g+1))})});return t?a(0).then(c=>t(null,c),t):a(0)},Lfe=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:i,pathExtExe:n}=l1(r,e),s=[];for(let o=0;o{"use strict";var f1=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};sv.exports=f1;sv.exports.default=f1});var m1=y((sZe,C1)=>{"use strict";var p1=J("path"),Tfe=g1(),Ofe=h1();function d1(r,e){let t=r.options.env||process.env,i=process.cwd(),n=r.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(r.options.cwd)}catch{}let o;try{o=Tfe.sync(r.command,{path:t[Ofe({env:t})],pathExt:e?p1.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=p1.resolve(n?r.options.cwd:"",o)),o}function Mfe(r){return d1(r)||d1(r,!0)}C1.exports=Mfe});var E1=y((oZe,av)=>{"use strict";var ov=/([()\][%!^"`<>&|;, *?])/g;function Kfe(r){return r=r.replace(ov,"^$1"),r}function Ufe(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(ov,"^$1"),e&&(r=r.replace(ov,"^$1")),r}av.exports.command=Kfe;av.exports.argument=Ufe});var y1=y((aZe,I1)=>{"use strict";I1.exports=/^#!(.*)/});var B1=y((AZe,w1)=>{"use strict";var Hfe=y1();w1.exports=(r="")=>{let e=r.match(Hfe);if(!e)return null;let[t,i]=e[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var b1=y((lZe,Q1)=>{"use strict";var Av=J("fs"),Gfe=B1();function Yfe(r){let t=Buffer.alloc(150),i;try{i=Av.openSync(r,"r"),Av.readSync(i,t,0,150,0),Av.closeSync(i)}catch{}return Gfe(t.toString())}Q1.exports=Yfe});var P1=y((cZe,x1)=>{"use strict";var jfe=J("path"),S1=m1(),v1=E1(),qfe=b1(),Jfe=process.platform==="win32",Wfe=/\.(?:com|exe)$/i,zfe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Vfe(r){r.file=S1(r);let e=r.file&&qfe(r.file);return e?(r.args.unshift(r.file),r.command=e,S1(r)):r.file}function Xfe(r){if(!Jfe)return r;let e=Vfe(r),t=!Wfe.test(e);if(r.options.forceShell||t){let i=zfe.test(e);r.command=jfe.normalize(r.command),r.command=v1.command(r.command),r.args=r.args.map(s=>v1.argument(s,i));let n=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${n}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function _fe(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let i={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?i:Xfe(i)}x1.exports=_fe});var R1=y((uZe,k1)=>{"use strict";var lv=process.platform==="win32";function cv(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function Zfe(r,e){if(!lv)return;let t=r.emit;r.emit=function(i,n){if(i==="exit"){let s=D1(n,e,"spawn");if(s)return t.call(r,"error",s)}return t.apply(r,arguments)}}function D1(r,e){return lv&&r===1&&!e.file?cv(e.original,"spawn"):null}function $fe(r,e){return lv&&r===1&&!e.file?cv(e.original,"spawnSync"):null}k1.exports={hookChildProcess:Zfe,verifyENOENT:D1,verifyENOENTSync:$fe,notFoundError:cv}});var fv=y((gZe,_g)=>{"use strict";var F1=J("child_process"),uv=P1(),gv=R1();function N1(r,e,t){let i=uv(r,e,t),n=F1.spawn(i.command,i.args,i.options);return gv.hookChildProcess(n,i),n}function ehe(r,e,t){let i=uv(r,e,t),n=F1.spawnSync(i.command,i.args,i.options);return n.error=n.error||gv.verifyENOENTSync(n.status,i),n}_g.exports=N1;_g.exports.spawn=N1;_g.exports.sync=ehe;_g.exports._parse=uv;_g.exports._enoent=gv});var T1=y((fZe,L1)=>{"use strict";function the(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function cc(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,cc)}the(cc,Error);cc.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;g>",te=de(">>",!1),me=">&",tt=de(">&",!1),Rt=">",It=de(">",!1),Kr="<<<",oi=de("<<<",!1),pi="<&",pr=de("<&",!1),di="<",ai=de("<",!1),Os=function(C){return{type:"argument",segments:[].concat(...C)}},dr=function(C){return C},Bi="$'",_n=de("$'",!1),ga="'",CA=de("'",!1),Dg=function(C){return[{type:"text",text:C}]},Zn='""',mA=de('""',!1),fa=function(){return{type:"text",text:""}},jp='"',EA=de('"',!1),IA=function(C){return C},wr=function(C){return{type:"arithmetic",arithmetic:C,quoted:!0}},zl=function(C){return{type:"shell",shell:C,quoted:!0}},kg=function(C){return{type:"variable",...C,quoted:!0}},mo=function(C){return{type:"text",text:C}},Rg=function(C){return{type:"arithmetic",arithmetic:C,quoted:!1}},qp=function(C){return{type:"shell",shell:C,quoted:!1}},Jp=function(C){return{type:"variable",...C,quoted:!1}},xr=function(C){return{type:"glob",pattern:C}},oe=/^[^']/,Eo=Ye(["'"],!0,!1),Dn=function(C){return C.join("")},Fg=/^[^$"]/,Qt=Ye(["$",'"'],!0,!1),Vl=`\\ +;(()=>{var nfe=Object.create;var HS=Object.defineProperty;var sfe=Object.getOwnPropertyDescriptor;var ofe=Object.getOwnPropertyNames;var afe=Object.getPrototypeOf,Afe=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var y=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ht=(r,e)=>{for(var t in e)HS(r,t,{get:e[t],enumerable:!0})},lfe=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ofe(e))!Afe.call(r,n)&&n!==t&&HS(r,n,{get:()=>e[n],enumerable:!(i=sfe(e,n))||i.enumerable});return r};var ne=(r,e,t)=>(t=r!=null?nfe(afe(r)):{},lfe(e||!r||!r.__esModule?HS(t,"default",{value:r,enumerable:!0}):t,r));var ZU=y(($_e,_U)=>{_U.exports=XU;XU.sync=Dfe;var zU=J("fs");function Pfe(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var i=0;i{r1.exports=e1;e1.sync=kfe;var $U=J("fs");function e1(r,e,t){$U.stat(r,function(i,n){t(i,i?!1:t1(n,e))})}function kfe(r,e){return t1($U.statSync(r),e)}function t1(r,e){return r.isFile()&&Rfe(r,e)}function Rfe(r,e){var t=r.mode,i=r.uid,n=r.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=a|l,g=t&c||t&l&&n===o||t&a&&i===s||t&u&&s===0;return g}});var s1=y((rZe,n1)=>{var tZe=J("fs"),RI;process.platform==="win32"||global.TESTING_WINDOWS?RI=ZU():RI=i1();n1.exports=nv;nv.sync=Ffe;function nv(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){nv(r,e||{},function(s,o){s?n(s):i(o)})})}RI(r,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),t(i,n)})}function Ffe(r,e){try{return RI.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var g1=y((iZe,u1)=>{var Xg=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",o1=J("path"),Nfe=Xg?";":":",a1=s1(),A1=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),l1=(r,e)=>{let t=e.colon||Nfe,i=r.match(/\//)||Xg&&r.match(/\\/)?[""]:[...Xg?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],n=Xg?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Xg?n.split(t):[""];return Xg&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},c1=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=l1(r,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(A1(r));let f=i[c],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=o1.join(h,r),m=!h&&/^\.[\\\/]/.test(r)?r.slice(0,2)+p:p;u(l(m,c,0))}),l=(c,u,g)=>new Promise((f,h)=>{if(g===n.length)return f(a(u+1));let p=n[g];a1(c+p,{pathExt:s},(m,w)=>{if(!m&&w)if(e.all)o.push(c+p);else return f(c+p);return f(l(c,u,g+1))})});return t?a(0).then(c=>t(null,c),t):a(0)},Lfe=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:i,pathExtExe:n}=l1(r,e),s=[];for(let o=0;o{"use strict";var f1=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};sv.exports=f1;sv.exports.default=f1});var m1=y((sZe,C1)=>{"use strict";var p1=J("path"),Tfe=g1(),Ofe=h1();function d1(r,e){let t=r.options.env||process.env,i=process.cwd(),n=r.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(r.options.cwd)}catch{}let o;try{o=Tfe.sync(r.command,{path:t[Ofe({env:t})],pathExt:e?p1.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=p1.resolve(n?r.options.cwd:"",o)),o}function Mfe(r){return d1(r)||d1(r,!0)}C1.exports=Mfe});var E1=y((oZe,av)=>{"use strict";var ov=/([()\][%!^"`<>&|;, *?])/g;function Kfe(r){return r=r.replace(ov,"^$1"),r}function Ufe(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(ov,"^$1"),e&&(r=r.replace(ov,"^$1")),r}av.exports.command=Kfe;av.exports.argument=Ufe});var y1=y((aZe,I1)=>{"use strict";I1.exports=/^#!(.*)/});var B1=y((AZe,w1)=>{"use strict";var Hfe=y1();w1.exports=(r="")=>{let e=r.match(Hfe);if(!e)return null;let[t,i]=e[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var b1=y((lZe,Q1)=>{"use strict";var Av=J("fs"),Gfe=B1();function Yfe(r){let t=Buffer.alloc(150),i;try{i=Av.openSync(r,"r"),Av.readSync(i,t,0,150,0),Av.closeSync(i)}catch{}return Gfe(t.toString())}Q1.exports=Yfe});var P1=y((cZe,x1)=>{"use strict";var jfe=J("path"),S1=m1(),v1=E1(),qfe=b1(),Jfe=process.platform==="win32",Wfe=/\.(?:com|exe)$/i,zfe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Vfe(r){r.file=S1(r);let e=r.file&&qfe(r.file);return e?(r.args.unshift(r.file),r.command=e,S1(r)):r.file}function Xfe(r){if(!Jfe)return r;let e=Vfe(r),t=!Wfe.test(e);if(r.options.forceShell||t){let i=zfe.test(e);r.command=jfe.normalize(r.command),r.command=v1.command(r.command),r.args=r.args.map(s=>v1.argument(s,i));let n=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${n}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function _fe(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let i={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?i:Xfe(i)}x1.exports=_fe});var R1=y((uZe,k1)=>{"use strict";var lv=process.platform==="win32";function cv(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function Zfe(r,e){if(!lv)return;let t=r.emit;r.emit=function(i,n){if(i==="exit"){let s=D1(n,e,"spawn");if(s)return t.call(r,"error",s)}return t.apply(r,arguments)}}function D1(r,e){return lv&&r===1&&!e.file?cv(e.original,"spawn"):null}function $fe(r,e){return lv&&r===1&&!e.file?cv(e.original,"spawnSync"):null}k1.exports={hookChildProcess:Zfe,verifyENOENT:D1,verifyENOENTSync:$fe,notFoundError:cv}});var fv=y((gZe,_g)=>{"use strict";var F1=J("child_process"),uv=P1(),gv=R1();function N1(r,e,t){let i=uv(r,e,t),n=F1.spawn(i.command,i.args,i.options);return gv.hookChildProcess(n,i),n}function ehe(r,e,t){let i=uv(r,e,t),n=F1.spawnSync(i.command,i.args,i.options);return n.error=n.error||gv.verifyENOENTSync(n.status,i),n}_g.exports=N1;_g.exports.spawn=N1;_g.exports.sync=ehe;_g.exports._parse=uv;_g.exports._enoent=gv});var T1=y((fZe,L1)=>{"use strict";function the(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function cc(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,cc)}the(cc,Error);cc.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;g>",te=de(">>",!1),me=">&",tt=de(">&",!1),Rt=">",It=de(">",!1),Kr="<<<",oi=de("<<<",!1),pi="<&",pr=de("<&",!1),di="<",ai=de("<",!1),Os=function(C){return{type:"argument",segments:[].concat(...C)}},dr=function(C){return C},Bi="$'",_n=de("$'",!1),ga="'",CA=de("'",!1),Dg=function(C){return[{type:"text",text:C}]},Zn='""',mA=de('""',!1),fa=function(){return{type:"text",text:""}},jp='"',EA=de('"',!1),IA=function(C){return C},wr=function(C){return{type:"arithmetic",arithmetic:C,quoted:!0}},zl=function(C){return{type:"shell",shell:C,quoted:!0}},kg=function(C){return{type:"variable",...C,quoted:!0}},mo=function(C){return{type:"text",text:C}},Rg=function(C){return{type:"arithmetic",arithmetic:C,quoted:!1}},qp=function(C){return{type:"shell",shell:C,quoted:!1}},Jp=function(C){return{type:"variable",...C,quoted:!1}},xr=function(C){return{type:"glob",pattern:C}},oe=/^[^']/,Eo=Ye(["'"],!0,!1),Dn=function(C){return C.join("")},Fg=/^[^$"]/,Qt=Ye(["$",'"'],!0,!1),Vl=`\\ `,kn=de(`\\ `,!1),$n=function(){return""},es="\\",ut=de("\\",!1),Io=/^[\\$"`]/,at=Ye(["\\","$",'"',"`"],!1,!1),ln=function(C){return C},S="\\a",Tt=de("\\a",!1),Ng=function(){return"a"},Xl="\\b",Wp=de("\\b",!1),zp=function(){return"\b"},Vp=/^[Ee]/,Xp=Ye(["E","e"],!1,!1),_p=function(){return"\x1B"},G="\\f",yt=de("\\f",!1),yA=function(){return"\f"},Wi="\\n",_l=de("\\n",!1),We=function(){return` `},ha="\\r",Lg=de("\\r",!1),oI=function(){return"\r"},Zp="\\t",aI=de("\\t",!1),ar=function(){return" "},Rn="\\v",Zl=de("\\v",!1),$p=function(){return"\v"},Ms=/^[\\'"?]/,pa=Ye(["\\","'",'"',"?"],!1,!1),cn=function(C){return String.fromCharCode(parseInt(C,16))},De="\\x",Tg=de("\\x",!1),$l="\\u",Ks=de("\\u",!1),ec="\\U",wA=de("\\U",!1),Og=function(C){return String.fromCodePoint(parseInt(C,16))},Mg=/^[0-7]/,da=Ye([["0","7"]],!1,!1),Ca=/^[0-9a-fA-f]/,$e=Ye([["0","9"],["a","f"],["A","f"]],!1,!1),yo=rt(),BA="-",tc=de("-",!1),Us="+",rc=de("+",!1),AI=".",ed=de(".",!1),Kg=function(C,b,N){return{type:"number",value:(C==="-"?-1:1)*parseFloat(b.join("")+"."+N.join(""))}},td=function(C,b){return{type:"number",value:(C==="-"?-1:1)*parseInt(b.join(""))}},lI=function(C){return{type:"variable",...C}},ic=function(C){return{type:"variable",name:C}},cI=function(C){return C},Ug="*",QA=de("*",!1),Rr="/",uI=de("/",!1),Hs=function(C,b,N){return{type:b==="*"?"multiplication":"division",right:N}},Gs=function(C,b){return b.reduce((N,U)=>({left:N,...U}),C)},Hg=function(C,b,N){return{type:b==="+"?"addition":"subtraction",right:N}},bA="$((",R=de("$((",!1),q="))",pe=de("))",!1),Ne=function(C){return C},xe="$(",qe=de("$(",!1),dt=function(C){return C},Ft="${",Fn=de("${",!1),QS=":-",tU=de(":-",!1),rU=function(C,b){return{name:C,defaultValue:b}},bS=":-}",iU=de(":-}",!1),nU=function(C){return{name:C,defaultValue:[]}},SS=":+",sU=de(":+",!1),oU=function(C,b){return{name:C,alternativeValue:b}},vS=":+}",aU=de(":+}",!1),AU=function(C){return{name:C,alternativeValue:[]}},xS=function(C){return{name:C}},lU="$",cU=de("$",!1),uU=function(C){return e.isGlobPattern(C)},gU=function(C){return C},PS=/^[a-zA-Z0-9_]/,DS=Ye([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),kS=function(){return O()},RS=/^[$@*?#a-zA-Z0-9_\-]/,FS=Ye(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),fU=/^[(){}<>$|&; \t"']/,Gg=Ye(["(",")","{","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),NS=/^[<>&; \t"']/,LS=Ye(["<",">","&",";"," "," ",'"',"'"],!1,!1),gI=/^[ \t]/,fI=Ye([" "," "],!1,!1),Q=0,Re=0,SA=[{line:1,column:1}],d=0,E=[],I=0,k;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function O(){return r.substring(Re,Q)}function X(){return Et(Re,Q)}function ee(C,b){throw b=b!==void 0?b:Et(Re,Q),Fi([At(C)],r.substring(Re,Q),b)}function ye(C,b){throw b=b!==void 0?b:Et(Re,Q),Nn(C,b)}function de(C,b){return{type:"literal",text:C,ignoreCase:b}}function Ye(C,b,N){return{type:"class",parts:C,inverted:b,ignoreCase:N}}function rt(){return{type:"any"}}function wt(){return{type:"end"}}function At(C){return{type:"other",description:C}}function et(C){var b=SA[C],N;if(b)return b;for(N=C-1;!SA[N];)N--;for(b=SA[N],b={line:b.line,column:b.column};Nd&&(d=Q,E=[]),E.push(C))}function Nn(C,b){return new cc(C,null,null,b)}function Fi(C,b,N){return new cc(cc.buildMessage(C,b),C,b,N)}function vA(){var C,b;return C=Q,b=Ur(),b===t&&(b=null),b!==t&&(Re=C,b=s(b)),C=b,C}function Ur(){var C,b,N,U,ce;if(C=Q,b=Hr(),b!==t){for(N=[],U=Me();U!==t;)N.push(U),U=Me();N!==t?(U=ma(),U!==t?(ce=ts(),ce===t&&(ce=null),ce!==t?(Re=C,b=o(b,U,ce),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t)}else Q=C,C=t;if(C===t)if(C=Q,b=Hr(),b!==t){for(N=[],U=Me();U!==t;)N.push(U),U=Me();N!==t?(U=ma(),U===t&&(U=null),U!==t?(Re=C,b=a(b,U),C=b):(Q=C,C=t)):(Q=C,C=t)}else Q=C,C=t;return C}function ts(){var C,b,N,U,ce;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t)if(N=Ur(),N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();U!==t?(Re=C,b=l(N),C=b):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t;return C}function ma(){var C;return r.charCodeAt(Q)===59?(C=c,Q++):(C=t,I===0&&Be(u)),C===t&&(r.charCodeAt(Q)===38?(C=g,Q++):(C=t,I===0&&Be(f))),C}function Hr(){var C,b,N;return C=Q,b=hU(),b!==t?(N=Hge(),N===t&&(N=null),N!==t?(Re=C,b=h(b,N),C=b):(Q=C,C=t)):(Q=C,C=t),C}function Hge(){var C,b,N,U,ce,be,ft;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t)if(N=Gge(),N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();if(U!==t)if(ce=Hr(),ce!==t){for(be=[],ft=Me();ft!==t;)be.push(ft),ft=Me();be!==t?(Re=C,b=p(N,ce),C=b):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;else Q=C,C=t;return C}function Gge(){var C;return r.substr(Q,2)===m?(C=m,Q+=2):(C=t,I===0&&Be(w)),C===t&&(r.substr(Q,2)===B?(C=B,Q+=2):(C=t,I===0&&Be(v))),C}function hU(){var C,b,N;return C=Q,b=qge(),b!==t?(N=Yge(),N===t&&(N=null),N!==t?(Re=C,b=D(b,N),C=b):(Q=C,C=t)):(Q=C,C=t),C}function Yge(){var C,b,N,U,ce,be,ft;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t)if(N=jge(),N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();if(U!==t)if(ce=hU(),ce!==t){for(be=[],ft=Me();ft!==t;)be.push(ft),ft=Me();be!==t?(Re=C,b=F(N,ce),C=b):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;else Q=C,C=t;return C}function jge(){var C;return r.substr(Q,2)===H?(C=H,Q+=2):(C=t,I===0&&Be(j)),C===t&&(r.charCodeAt(Q)===124?(C=$,Q++):(C=t,I===0&&Be(z))),C}function hI(){var C,b,N,U,ce,be;if(C=Q,b=SU(),b!==t)if(r.charCodeAt(Q)===61?(N=W,Q++):(N=t,I===0&&Be(Z)),N!==t)if(U=CU(),U!==t){for(ce=[],be=Me();be!==t;)ce.push(be),be=Me();ce!==t?(Re=C,b=A(b,U),C=b):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t;else Q=C,C=t;if(C===t)if(C=Q,b=SU(),b!==t)if(r.charCodeAt(Q)===61?(N=W,Q++):(N=t,I===0&&Be(Z)),N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();U!==t?(Re=C,b=ae(b),C=b):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t;return C}function qge(){var C,b,N,U,ce,be,ft,Bt,Vr,Ci,rs;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t)if(r.charCodeAt(Q)===40?(N=ue,Q++):(N=t,I===0&&Be(_)),N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();if(U!==t)if(ce=Ur(),ce!==t){for(be=[],ft=Me();ft!==t;)be.push(ft),ft=Me();if(be!==t)if(r.charCodeAt(Q)===41?(ft=T,Q++):(ft=t,I===0&&Be(L)),ft!==t){for(Bt=[],Vr=Me();Vr!==t;)Bt.push(Vr),Vr=Me();if(Bt!==t){for(Vr=[],Ci=rd();Ci!==t;)Vr.push(Ci),Ci=rd();if(Vr!==t){for(Ci=[],rs=Me();rs!==t;)Ci.push(rs),rs=Me();Ci!==t?(Re=C,b=ge(ce,Vr),C=b):(Q=C,C=t)}else Q=C,C=t}else Q=C,C=t}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;else Q=C,C=t;if(C===t){for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t)if(r.charCodeAt(Q)===123?(N=we,Q++):(N=t,I===0&&Be(Le)),N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();if(U!==t)if(ce=Ur(),ce!==t){for(be=[],ft=Me();ft!==t;)be.push(ft),ft=Me();if(be!==t)if(r.charCodeAt(Q)===125?(ft=Pe,Q++):(ft=t,I===0&&Be(Te)),ft!==t){for(Bt=[],Vr=Me();Vr!==t;)Bt.push(Vr),Vr=Me();if(Bt!==t){for(Vr=[],Ci=rd();Ci!==t;)Vr.push(Ci),Ci=rd();if(Vr!==t){for(Ci=[],rs=Me();rs!==t;)Ci.push(rs),rs=Me();Ci!==t?(Re=C,b=se(ce,Vr),C=b):(Q=C,C=t)}else Q=C,C=t}else Q=C,C=t}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;else Q=C,C=t;if(C===t){for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t){for(N=[],U=hI();U!==t;)N.push(U),U=hI();if(N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();if(U!==t){if(ce=[],be=dU(),be!==t)for(;be!==t;)ce.push(be),be=dU();else ce=t;if(ce!==t){for(be=[],ft=Me();ft!==t;)be.push(ft),ft=Me();be!==t?(Re=C,b=Ae(N,ce),C=b):(Q=C,C=t)}else Q=C,C=t}else Q=C,C=t}else Q=C,C=t}else Q=C,C=t;if(C===t){for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t){if(N=[],U=hI(),U!==t)for(;U!==t;)N.push(U),U=hI();else N=t;if(N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();U!==t?(Re=C,b=Qe(N),C=b):(Q=C,C=t)}else Q=C,C=t}else Q=C,C=t}}}return C}function pU(){var C,b,N,U,ce;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t){if(N=[],U=pI(),U!==t)for(;U!==t;)N.push(U),U=pI();else N=t;if(N!==t){for(U=[],ce=Me();ce!==t;)U.push(ce),ce=Me();U!==t?(Re=C,b=fe(N),C=b):(Q=C,C=t)}else Q=C,C=t}else Q=C,C=t;return C}function dU(){var C,b,N;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();if(b!==t?(N=rd(),N!==t?(Re=C,b=le(N),C=b):(Q=C,C=t)):(Q=C,C=t),C===t){for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();b!==t?(N=pI(),N!==t?(Re=C,b=le(N),C=b):(Q=C,C=t)):(Q=C,C=t)}return C}function rd(){var C,b,N,U,ce;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();return b!==t?(Ge.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(ie)),N===t&&(N=null),N!==t?(U=Jge(),U!==t?(ce=pI(),ce!==t?(Re=C,b=Y(N,U,ce),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C}function Jge(){var C;return r.substr(Q,2)===he?(C=he,Q+=2):(C=t,I===0&&Be(te)),C===t&&(r.substr(Q,2)===me?(C=me,Q+=2):(C=t,I===0&&Be(tt)),C===t&&(r.charCodeAt(Q)===62?(C=Rt,Q++):(C=t,I===0&&Be(It)),C===t&&(r.substr(Q,3)===Kr?(C=Kr,Q+=3):(C=t,I===0&&Be(oi)),C===t&&(r.substr(Q,2)===pi?(C=pi,Q+=2):(C=t,I===0&&Be(pr)),C===t&&(r.charCodeAt(Q)===60?(C=di,Q++):(C=t,I===0&&Be(ai))))))),C}function pI(){var C,b,N;for(C=Q,b=[],N=Me();N!==t;)b.push(N),N=Me();return b!==t?(N=CU(),N!==t?(Re=C,b=le(N),C=b):(Q=C,C=t)):(Q=C,C=t),C}function CU(){var C,b,N;if(C=Q,b=[],N=mU(),N!==t)for(;N!==t;)b.push(N),N=mU();else b=t;return b!==t&&(Re=C,b=Os(b)),C=b,C}function mU(){var C,b;return C=Q,b=Wge(),b!==t&&(Re=C,b=dr(b)),C=b,C===t&&(C=Q,b=zge(),b!==t&&(Re=C,b=dr(b)),C=b,C===t&&(C=Q,b=Vge(),b!==t&&(Re=C,b=dr(b)),C=b,C===t&&(C=Q,b=Xge(),b!==t&&(Re=C,b=dr(b)),C=b))),C}function Wge(){var C,b,N,U;return C=Q,r.substr(Q,2)===Bi?(b=Bi,Q+=2):(b=t,I===0&&Be(_n)),b!==t?(N=$ge(),N!==t?(r.charCodeAt(Q)===39?(U=ga,Q++):(U=t,I===0&&Be(CA)),U!==t?(Re=C,b=Dg(N),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C}function zge(){var C,b,N,U;return C=Q,r.charCodeAt(Q)===39?(b=ga,Q++):(b=t,I===0&&Be(CA)),b!==t?(N=_ge(),N!==t?(r.charCodeAt(Q)===39?(U=ga,Q++):(U=t,I===0&&Be(CA)),U!==t?(Re=C,b=Dg(N),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C}function Vge(){var C,b,N,U;if(C=Q,r.substr(Q,2)===Zn?(b=Zn,Q+=2):(b=t,I===0&&Be(mA)),b!==t&&(Re=C,b=fa()),C=b,C===t)if(C=Q,r.charCodeAt(Q)===34?(b=jp,Q++):(b=t,I===0&&Be(EA)),b!==t){for(N=[],U=EU();U!==t;)N.push(U),U=EU();N!==t?(r.charCodeAt(Q)===34?(U=jp,Q++):(U=t,I===0&&Be(EA)),U!==t?(Re=C,b=IA(N),C=b):(Q=C,C=t)):(Q=C,C=t)}else Q=C,C=t;return C}function Xge(){var C,b,N;if(C=Q,b=[],N=IU(),N!==t)for(;N!==t;)b.push(N),N=IU();else b=t;return b!==t&&(Re=C,b=IA(b)),C=b,C}function EU(){var C,b;return C=Q,b=QU(),b!==t&&(Re=C,b=wr(b)),C=b,C===t&&(C=Q,b=bU(),b!==t&&(Re=C,b=zl(b)),C=b,C===t&&(C=Q,b=KS(),b!==t&&(Re=C,b=kg(b)),C=b,C===t&&(C=Q,b=Zge(),b!==t&&(Re=C,b=mo(b)),C=b))),C}function IU(){var C,b;return C=Q,b=QU(),b!==t&&(Re=C,b=Rg(b)),C=b,C===t&&(C=Q,b=bU(),b!==t&&(Re=C,b=qp(b)),C=b,C===t&&(C=Q,b=KS(),b!==t&&(Re=C,b=Jp(b)),C=b,C===t&&(C=Q,b=rfe(),b!==t&&(Re=C,b=xr(b)),C=b,C===t&&(C=Q,b=tfe(),b!==t&&(Re=C,b=mo(b)),C=b)))),C}function _ge(){var C,b,N;for(C=Q,b=[],oe.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Eo));N!==t;)b.push(N),oe.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Eo));return b!==t&&(Re=C,b=Dn(b)),C=b,C}function Zge(){var C,b,N;if(C=Q,b=[],N=yU(),N===t&&(Fg.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Qt))),N!==t)for(;N!==t;)b.push(N),N=yU(),N===t&&(Fg.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Qt)));else b=t;return b!==t&&(Re=C,b=Dn(b)),C=b,C}function yU(){var C,b,N;return C=Q,r.substr(Q,2)===Vl?(b=Vl,Q+=2):(b=t,I===0&&Be(kn)),b!==t&&(Re=C,b=$n()),C=b,C===t&&(C=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Be(ut)),b!==t?(Io.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(at)),N!==t?(Re=C,b=ln(N),C=b):(Q=C,C=t)):(Q=C,C=t)),C}function $ge(){var C,b,N;for(C=Q,b=[],N=wU(),N===t&&(oe.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Eo)));N!==t;)b.push(N),N=wU(),N===t&&(oe.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Eo)));return b!==t&&(Re=C,b=Dn(b)),C=b,C}function wU(){var C,b,N;return C=Q,r.substr(Q,2)===S?(b=S,Q+=2):(b=t,I===0&&Be(Tt)),b!==t&&(Re=C,b=Ng()),C=b,C===t&&(C=Q,r.substr(Q,2)===Xl?(b=Xl,Q+=2):(b=t,I===0&&Be(Wp)),b!==t&&(Re=C,b=zp()),C=b,C===t&&(C=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Be(ut)),b!==t?(Vp.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(Xp)),N!==t?(Re=C,b=_p(),C=b):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===G?(b=G,Q+=2):(b=t,I===0&&Be(yt)),b!==t&&(Re=C,b=yA()),C=b,C===t&&(C=Q,r.substr(Q,2)===Wi?(b=Wi,Q+=2):(b=t,I===0&&Be(_l)),b!==t&&(Re=C,b=We()),C=b,C===t&&(C=Q,r.substr(Q,2)===ha?(b=ha,Q+=2):(b=t,I===0&&Be(Lg)),b!==t&&(Re=C,b=oI()),C=b,C===t&&(C=Q,r.substr(Q,2)===Zp?(b=Zp,Q+=2):(b=t,I===0&&Be(aI)),b!==t&&(Re=C,b=ar()),C=b,C===t&&(C=Q,r.substr(Q,2)===Rn?(b=Rn,Q+=2):(b=t,I===0&&Be(Zl)),b!==t&&(Re=C,b=$p()),C=b,C===t&&(C=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Be(ut)),b!==t?(Ms.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(pa)),N!==t?(Re=C,b=ln(N),C=b):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=efe()))))))))),C}function efe(){var C,b,N,U,ce,be,ft,Bt,Vr,Ci,rs,US;return C=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Be(ut)),b!==t?(N=TS(),N!==t?(Re=C,b=cn(N),C=b):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===De?(b=De,Q+=2):(b=t,I===0&&Be(Tg)),b!==t?(N=Q,U=Q,ce=TS(),ce!==t?(be=Ln(),be!==t?(ce=[ce,be],U=ce):(Q=U,U=t)):(Q=U,U=t),U===t&&(U=TS()),U!==t?N=r.substring(N,Q):N=U,N!==t?(Re=C,b=cn(N),C=b):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===$l?(b=$l,Q+=2):(b=t,I===0&&Be(Ks)),b!==t?(N=Q,U=Q,ce=Ln(),ce!==t?(be=Ln(),be!==t?(ft=Ln(),ft!==t?(Bt=Ln(),Bt!==t?(ce=[ce,be,ft,Bt],U=ce):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t),U!==t?N=r.substring(N,Q):N=U,N!==t?(Re=C,b=cn(N),C=b):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===ec?(b=ec,Q+=2):(b=t,I===0&&Be(wA)),b!==t?(N=Q,U=Q,ce=Ln(),ce!==t?(be=Ln(),be!==t?(ft=Ln(),ft!==t?(Bt=Ln(),Bt!==t?(Vr=Ln(),Vr!==t?(Ci=Ln(),Ci!==t?(rs=Ln(),rs!==t?(US=Ln(),US!==t?(ce=[ce,be,ft,Bt,Vr,Ci,rs,US],U=ce):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t),U!==t?N=r.substring(N,Q):N=U,N!==t?(Re=C,b=Og(N),C=b):(Q=C,C=t)):(Q=C,C=t)))),C}function TS(){var C;return Mg.test(r.charAt(Q))?(C=r.charAt(Q),Q++):(C=t,I===0&&Be(da)),C}function Ln(){var C;return Ca.test(r.charAt(Q))?(C=r.charAt(Q),Q++):(C=t,I===0&&Be($e)),C}function tfe(){var C,b,N,U,ce;if(C=Q,b=[],N=Q,r.charCodeAt(Q)===92?(U=es,Q++):(U=t,I===0&&Be(ut)),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Be(yo)),ce!==t?(Re=N,U=ln(ce),N=U):(Q=N,N=t)):(Q=N,N=t),N===t&&(N=Q,U=Q,I++,ce=vU(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Be(yo)),ce!==t?(Re=N,U=ln(ce),N=U):(Q=N,N=t)):(Q=N,N=t)),N!==t)for(;N!==t;)b.push(N),N=Q,r.charCodeAt(Q)===92?(U=es,Q++):(U=t,I===0&&Be(ut)),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Be(yo)),ce!==t?(Re=N,U=ln(ce),N=U):(Q=N,N=t)):(Q=N,N=t),N===t&&(N=Q,U=Q,I++,ce=vU(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Be(yo)),ce!==t?(Re=N,U=ln(ce),N=U):(Q=N,N=t)):(Q=N,N=t));else b=t;return b!==t&&(Re=C,b=Dn(b)),C=b,C}function OS(){var C,b,N,U,ce,be;if(C=Q,r.charCodeAt(Q)===45?(b=BA,Q++):(b=t,I===0&&Be(tc)),b===t&&(r.charCodeAt(Q)===43?(b=Us,Q++):(b=t,I===0&&Be(rc))),b===t&&(b=null),b!==t){if(N=[],Ge.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Be(ie)),U!==t)for(;U!==t;)N.push(U),Ge.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Be(ie));else N=t;if(N!==t)if(r.charCodeAt(Q)===46?(U=AI,Q++):(U=t,I===0&&Be(ed)),U!==t){if(ce=[],Ge.test(r.charAt(Q))?(be=r.charAt(Q),Q++):(be=t,I===0&&Be(ie)),be!==t)for(;be!==t;)ce.push(be),Ge.test(r.charAt(Q))?(be=r.charAt(Q),Q++):(be=t,I===0&&Be(ie));else ce=t;ce!==t?(Re=C,b=Kg(b,N,ce),C=b):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;if(C===t){if(C=Q,r.charCodeAt(Q)===45?(b=BA,Q++):(b=t,I===0&&Be(tc)),b===t&&(r.charCodeAt(Q)===43?(b=Us,Q++):(b=t,I===0&&Be(rc))),b===t&&(b=null),b!==t){if(N=[],Ge.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Be(ie)),U!==t)for(;U!==t;)N.push(U),Ge.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Be(ie));else N=t;N!==t?(Re=C,b=td(b,N),C=b):(Q=C,C=t)}else Q=C,C=t;if(C===t&&(C=Q,b=KS(),b!==t&&(Re=C,b=lI(b)),C=b,C===t&&(C=Q,b=nc(),b!==t&&(Re=C,b=ic(b)),C=b,C===t)))if(C=Q,r.charCodeAt(Q)===40?(b=ue,Q++):(b=t,I===0&&Be(_)),b!==t){for(N=[],U=Me();U!==t;)N.push(U),U=Me();if(N!==t)if(U=BU(),U!==t){for(ce=[],be=Me();be!==t;)ce.push(be),be=Me();ce!==t?(r.charCodeAt(Q)===41?(be=T,Q++):(be=t,I===0&&Be(L)),be!==t?(Re=C,b=cI(U),C=b):(Q=C,C=t)):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t}return C}function MS(){var C,b,N,U,ce,be,ft,Bt;if(C=Q,b=OS(),b!==t){for(N=[],U=Q,ce=[],be=Me();be!==t;)ce.push(be),be=Me();if(ce!==t)if(r.charCodeAt(Q)===42?(be=Ug,Q++):(be=t,I===0&&Be(QA)),be===t&&(r.charCodeAt(Q)===47?(be=Rr,Q++):(be=t,I===0&&Be(uI))),be!==t){for(ft=[],Bt=Me();Bt!==t;)ft.push(Bt),Bt=Me();ft!==t?(Bt=OS(),Bt!==t?(Re=U,ce=Hs(b,be,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t;for(;U!==t;){for(N.push(U),U=Q,ce=[],be=Me();be!==t;)ce.push(be),be=Me();if(ce!==t)if(r.charCodeAt(Q)===42?(be=Ug,Q++):(be=t,I===0&&Be(QA)),be===t&&(r.charCodeAt(Q)===47?(be=Rr,Q++):(be=t,I===0&&Be(uI))),be!==t){for(ft=[],Bt=Me();Bt!==t;)ft.push(Bt),Bt=Me();ft!==t?(Bt=OS(),Bt!==t?(Re=U,ce=Hs(b,be,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t}N!==t?(Re=C,b=Gs(b,N),C=b):(Q=C,C=t)}else Q=C,C=t;return C}function BU(){var C,b,N,U,ce,be,ft,Bt;if(C=Q,b=MS(),b!==t){for(N=[],U=Q,ce=[],be=Me();be!==t;)ce.push(be),be=Me();if(ce!==t)if(r.charCodeAt(Q)===43?(be=Us,Q++):(be=t,I===0&&Be(rc)),be===t&&(r.charCodeAt(Q)===45?(be=BA,Q++):(be=t,I===0&&Be(tc))),be!==t){for(ft=[],Bt=Me();Bt!==t;)ft.push(Bt),Bt=Me();ft!==t?(Bt=MS(),Bt!==t?(Re=U,ce=Hg(b,be,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t;for(;U!==t;){for(N.push(U),U=Q,ce=[],be=Me();be!==t;)ce.push(be),be=Me();if(ce!==t)if(r.charCodeAt(Q)===43?(be=Us,Q++):(be=t,I===0&&Be(rc)),be===t&&(r.charCodeAt(Q)===45?(be=BA,Q++):(be=t,I===0&&Be(tc))),be!==t){for(ft=[],Bt=Me();Bt!==t;)ft.push(Bt),Bt=Me();ft!==t?(Bt=MS(),Bt!==t?(Re=U,ce=Hg(b,be,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t}N!==t?(Re=C,b=Gs(b,N),C=b):(Q=C,C=t)}else Q=C,C=t;return C}function QU(){var C,b,N,U,ce,be;if(C=Q,r.substr(Q,3)===bA?(b=bA,Q+=3):(b=t,I===0&&Be(R)),b!==t){for(N=[],U=Me();U!==t;)N.push(U),U=Me();if(N!==t)if(U=BU(),U!==t){for(ce=[],be=Me();be!==t;)ce.push(be),be=Me();ce!==t?(r.substr(Q,2)===q?(be=q,Q+=2):(be=t,I===0&&Be(pe)),be!==t?(Re=C,b=Ne(U),C=b):(Q=C,C=t)):(Q=C,C=t)}else Q=C,C=t;else Q=C,C=t}else Q=C,C=t;return C}function bU(){var C,b,N,U;return C=Q,r.substr(Q,2)===xe?(b=xe,Q+=2):(b=t,I===0&&Be(qe)),b!==t?(N=Ur(),N!==t?(r.charCodeAt(Q)===41?(U=T,Q++):(U=t,I===0&&Be(L)),U!==t?(Re=C,b=dt(N),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C}function KS(){var C,b,N,U,ce,be;return C=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Be(Fn)),b!==t?(N=nc(),N!==t?(r.substr(Q,2)===QS?(U=QS,Q+=2):(U=t,I===0&&Be(tU)),U!==t?(ce=pU(),ce!==t?(r.charCodeAt(Q)===125?(be=Pe,Q++):(be=t,I===0&&Be(Te)),be!==t?(Re=C,b=rU(N,ce),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Be(Fn)),b!==t?(N=nc(),N!==t?(r.substr(Q,3)===bS?(U=bS,Q+=3):(U=t,I===0&&Be(iU)),U!==t?(Re=C,b=nU(N),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Be(Fn)),b!==t?(N=nc(),N!==t?(r.substr(Q,2)===SS?(U=SS,Q+=2):(U=t,I===0&&Be(sU)),U!==t?(ce=pU(),ce!==t?(r.charCodeAt(Q)===125?(be=Pe,Q++):(be=t,I===0&&Be(Te)),be!==t?(Re=C,b=oU(N,ce),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Be(Fn)),b!==t?(N=nc(),N!==t?(r.substr(Q,3)===vS?(U=vS,Q+=3):(U=t,I===0&&Be(aU)),U!==t?(Re=C,b=AU(N),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Be(Fn)),b!==t?(N=nc(),N!==t?(r.charCodeAt(Q)===125?(U=Pe,Q++):(U=t,I===0&&Be(Te)),U!==t?(Re=C,b=xS(N),C=b):(Q=C,C=t)):(Q=C,C=t)):(Q=C,C=t),C===t&&(C=Q,r.charCodeAt(Q)===36?(b=lU,Q++):(b=t,I===0&&Be(cU)),b!==t?(N=nc(),N!==t?(Re=C,b=xS(N),C=b):(Q=C,C=t)):(Q=C,C=t)))))),C}function rfe(){var C,b,N;return C=Q,b=ife(),b!==t?(Re=Q,N=uU(b),N?N=void 0:N=t,N!==t?(Re=C,b=gU(b),C=b):(Q=C,C=t)):(Q=C,C=t),C}function ife(){var C,b,N,U,ce;if(C=Q,b=[],N=Q,U=Q,I++,ce=xU(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Be(yo)),ce!==t?(Re=N,U=ln(ce),N=U):(Q=N,N=t)):(Q=N,N=t),N!==t)for(;N!==t;)b.push(N),N=Q,U=Q,I++,ce=xU(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Be(yo)),ce!==t?(Re=N,U=ln(ce),N=U):(Q=N,N=t)):(Q=N,N=t);else b=t;return b!==t&&(Re=C,b=Dn(b)),C=b,C}function SU(){var C,b,N;if(C=Q,b=[],PS.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(DS)),N!==t)for(;N!==t;)b.push(N),PS.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(DS));else b=t;return b!==t&&(Re=C,b=kS()),C=b,C}function nc(){var C,b,N;if(C=Q,b=[],RS.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(FS)),N!==t)for(;N!==t;)b.push(N),RS.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Be(FS));else b=t;return b!==t&&(Re=C,b=kS()),C=b,C}function vU(){var C;return fU.test(r.charAt(Q))?(C=r.charAt(Q),Q++):(C=t,I===0&&Be(Gg)),C}function xU(){var C;return NS.test(r.charAt(Q))?(C=r.charAt(Q),Q++):(C=t,I===0&&Be(LS)),C}function Me(){var C,b;if(C=[],gI.test(r.charAt(Q))?(b=r.charAt(Q),Q++):(b=t,I===0&&Be(fI)),b!==t)for(;b!==t;)C.push(b),gI.test(r.charAt(Q))?(b=r.charAt(Q),Q++):(b=t,I===0&&Be(fI));else C=t;return C}if(k=n(),k!==t&&Q===r.length)return k;throw k!==t&&Q{"use strict";function ihe(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function gc(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,gc)}ihe(gc,Error);gc.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;gH&&(H=v,j=[]),j.push(ie))}function Te(ie,Y){return new gc(ie,null,null,Y)}function se(ie,Y,he){return new gc(gc.buildMessage(ie,Y),ie,Y,he)}function Ae(){var ie,Y,he,te;return ie=v,Y=Qe(),Y!==t?(r.charCodeAt(v)===47?(he=s,v++):(he=t,$===0&&Pe(o)),he!==t?(te=Qe(),te!==t?(D=ie,Y=a(Y,te),ie=Y):(v=ie,ie=t)):(v=ie,ie=t)):(v=ie,ie=t),ie===t&&(ie=v,Y=Qe(),Y!==t&&(D=ie,Y=l(Y)),ie=Y),ie}function Qe(){var ie,Y,he,te;return ie=v,Y=fe(),Y!==t?(r.charCodeAt(v)===64?(he=c,v++):(he=t,$===0&&Pe(u)),he!==t?(te=Ge(),te!==t?(D=ie,Y=g(Y,te),ie=Y):(v=ie,ie=t)):(v=ie,ie=t)):(v=ie,ie=t),ie===t&&(ie=v,Y=fe(),Y!==t&&(D=ie,Y=f(Y)),ie=Y),ie}function fe(){var ie,Y,he,te,me;return ie=v,r.charCodeAt(v)===64?(Y=c,v++):(Y=t,$===0&&Pe(u)),Y!==t?(he=le(),he!==t?(r.charCodeAt(v)===47?(te=s,v++):(te=t,$===0&&Pe(o)),te!==t?(me=le(),me!==t?(D=ie,Y=h(),ie=Y):(v=ie,ie=t)):(v=ie,ie=t)):(v=ie,ie=t)):(v=ie,ie=t),ie===t&&(ie=v,Y=le(),Y!==t&&(D=ie,Y=h()),ie=Y),ie}function le(){var ie,Y,he;if(ie=v,Y=[],p.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Pe(m)),he!==t)for(;he!==t;)Y.push(he),p.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Pe(m));else Y=t;return Y!==t&&(D=ie,Y=h()),ie=Y,ie}function Ge(){var ie,Y,he;if(ie=v,Y=[],w.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Pe(B)),he!==t)for(;he!==t;)Y.push(he),w.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Pe(B));else Y=t;return Y!==t&&(D=ie,Y=h()),ie=Y,ie}if(z=n(),z!==t&&v===r.length)return z;throw z!==t&&v{"use strict";function H1(r){return typeof r>"u"||r===null}function she(r){return typeof r=="object"&&r!==null}function ohe(r){return Array.isArray(r)?r:H1(r)?[]:[r]}function ahe(r,e){var t,i,n,s;if(e)for(s=Object.keys(e),t=0,i=s.length;t{"use strict";function dd(r,e){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}dd.prototype=Object.create(Error.prototype);dd.prototype.constructor=dd;dd.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t};G1.exports=dd});var q1=y((kZe,j1)=>{"use strict";var Y1=hc();function Ev(r,e,t,i,n){this.name=r,this.buffer=e,this.position=t,this.line=i,this.column=n}Ev.prototype.getSnippet=function(e,t){var i,n,s,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,i="",n=this.position;n>0&&`\0\r diff --git a/docs/api/actionCreatorMiddleware.mdx b/docs/api/actionCreatorMiddleware.mdx index 50570ae109..7378947a1e 100644 --- a/docs/api/actionCreatorMiddleware.mdx +++ b/docs/api/actionCreatorMiddleware.mdx @@ -53,7 +53,7 @@ import reducer from './reducer' // Augment middleware to consider all functions with a static type property to be action creators const isActionCreator = ( - action: unknown + action: unknown, ): action is Function & { type: unknown } => typeof action === 'function' && 'type' in action diff --git a/docs/api/combineSlices.mdx b/docs/api/combineSlices.mdx index b308a0e36f..81f8cb168a 100644 --- a/docs/api/combineSlices.mdx +++ b/docs/api/combineSlices.mdx @@ -235,7 +235,7 @@ declare module '.' { const withInjected = rootReducer.inject( { reducerPath: 'removable', reducer: removableReducer }, - { overrideExisting: true } + { overrideExisting: true }, ) const emptyReducer = () => null @@ -243,7 +243,7 @@ const emptyReducer = () => null const removeReducer = () => rootReducer.inject( { reducerPath: 'removable', reducer: emptyReducer }, - { overrideExisting: true } + { overrideExisting: true }, ) ``` @@ -273,14 +273,14 @@ const withCounter = rootReducer.inject(counterSlice) const selectCounterValue = (rootState: RootState) => rootState.counter?.value // number | undefined const wrappedSelectCounterValue = withCounter.selector( - (rootState) => rootState.counter.value // number + (rootState) => rootState.counter.value, // number ) console.log( selectCounterValue({}), // undefined selectCounterValue({ counter: { value: 2 } }), // 2 wrappedSelectCounterValue({}), // 0 - wrappedSelectCounterValue({ counter: { value: 2 } }) // 2 + wrappedSelectCounterValue({ counter: { value: 2 } }), // 2 ) ``` @@ -303,7 +303,7 @@ interface RootState { const selectCounterValue = withCounter.selector( (combinedState) => combinedState.counter.value, - (rootState: RootState) => rootState.innerCombined + (rootState: RootState) => rootState.innerCombined, ) console.log( @@ -316,7 +316,7 @@ console.log( value: 2, }, }, - }) // 2 + }), // 2 ) ``` @@ -365,6 +365,6 @@ If the slice state is undefined in the store state passed, the selector will ins console.log( injectedCounterSlice.selectors.selectValue({}), // 0 injectedCounterSlice.selectors.selectValue({ counter: { value: 2 } }), // 2 - aCounterSlice.selectors.selectValue({ aCounter: { value: 2 } }) // 2 + aCounterSlice.selectors.selectValue({ aCounter: { value: 2 } }), // 2 ) ``` diff --git a/docs/api/createAction.mdx b/docs/api/createAction.mdx index 15776024ae..6fbec5d955 100644 --- a/docs/api/createAction.mdx +++ b/docs/api/createAction.mdx @@ -148,6 +148,6 @@ export const epic = (actions$: Observable) => map((action) => { // action.payload can be safely used as number here (and will also be correctly inferred by TypeScript) // ... - }) + }), ) ``` diff --git a/docs/api/createAsyncThunk.mdx b/docs/api/createAsyncThunk.mdx index e837148300..67cdd33984 100644 --- a/docs/api/createAsyncThunk.mdx +++ b/docs/api/createAsyncThunk.mdx @@ -35,7 +35,7 @@ const fetchUserById = createAsyncThunk( async (userId: number, thunkAPI) => { const response = await userAPI.fetchById(userId) return response.data - } + }, ) interface UsersState { @@ -190,23 +190,23 @@ interface RejectedWithValueAction { type Pending = ( requestId: string, - arg: ThunkArg + arg: ThunkArg, ) => PendingAction type Fulfilled = ( payload: PromiseResult, requestId: string, - arg: ThunkArg + arg: ThunkArg, ) => FulfilledAction type Rejected = ( requestId: string, - arg: ThunkArg + arg: ThunkArg, ) => RejectedAction type RejectedWithValue = ( requestId: string, - arg: ThunkArg + arg: ThunkArg, ) => RejectedWithValueAction ``` @@ -365,7 +365,7 @@ const updateUser = createAsyncThunk( // by explicitly returning it using the `rejectWithValue()` utility return rejectWithValue(err.response.data) } - } + }, ) ``` @@ -391,7 +391,7 @@ const fetchUserById = createAsyncThunk( return false } }, - } + }, ) ``` @@ -419,7 +419,7 @@ export const fetchUserById = createAsyncThunk( 'fetchUserById', (userId: string) => { /* ... */ - } + }, ) // file: MyComponent.ts @@ -456,7 +456,7 @@ const fetchUserById = createAsyncThunk( signal: thunkAPI.signal, }) return await response.json() - } + }, ) ``` @@ -486,7 +486,7 @@ const readStream = createAsyncThunk( done = read.done } return result - } + }, ) ``` @@ -510,7 +510,7 @@ const fetchUserById = createAsyncThunk( cancelToken: source.token, }) return response.data - } + }, ) ``` @@ -749,7 +749,7 @@ const UsersComponent = (props: { id: string }) => { // This is an example of an onSubmit handler using Formik meant to demonstrate accessing the payload of the rejected action const handleUpdateUser = async ( values: FormValues, - formikHelpers: FormikHelpers + formikHelpers: FormikHelpers, ) => { const resultAction = await dispatch(updateUser({ id: props.id, ...values })) if (updateUser.fulfilled.match(resultAction)) { diff --git a/docs/api/createDynamicMiddleware.mdx b/docs/api/createDynamicMiddleware.mdx index 2f2150f2b6..199e8418a4 100644 --- a/docs/api/createDynamicMiddleware.mdx +++ b/docs/api/createDynamicMiddleware.mdx @@ -80,7 +80,7 @@ The "dynamic middleware instance" returned from `createDynamicMiddleware` is an ```ts no-transpile export type DynamicMiddlewareInstance< State = unknown, - Dispatch extends ReduxDispatch = ReduxDispatch + Dispatch extends ReduxDispatch = ReduxDispatch, > = { middleware: DynamicMiddleware addMiddleware: AddMiddleware @@ -116,7 +116,7 @@ Accepts a set of middleware, and creates an action. When dispatched, it injects ```ts no-transpile const listenerDispatch = store.dispatch( - withMiddleware(listenerMiddleware.middleware) + withMiddleware(listenerMiddleware.middleware), ) const unsubscribe = listenerDispatch(addListener({ type, effect })) @@ -131,7 +131,7 @@ _These depend on having `react-redux` installed._ ```ts no-transpile interface ReactDynamicMiddlewareInstance< State = any, - Dispatch extends ReduxDispatch = ReduxDispatch + Dispatch extends ReduxDispatch = ReduxDispatch, > extends DynamicMiddlewareInstance { createDispatchWithMiddlewareHook: CreateDispatchWithMiddlewareHook< State, @@ -140,7 +140,7 @@ interface ReactDynamicMiddlewareInstance< createDispatchWithMiddlewareHookFactory: ( context?: Context< ReactReduxContextValue> - > + >, ) => CreateDispatchWithMiddlewareHook } ``` @@ -151,7 +151,7 @@ Accepts a set of middleware, and returns a [`useDispatch`](https://react-redux.j ```ts no-transpile const useListenerDispatch = createDispatchWithMiddlewareHook( - listenerInstance.middleware + listenerInstance.middleware, ) const Component = () => { diff --git a/docs/api/createEntityAdapter.mdx b/docs/api/createEntityAdapter.mdx index 4b9cbc4134..ffd7d19ede 100644 --- a/docs/api/createEntityAdapter.mdx +++ b/docs/api/createEntityAdapter.mdx @@ -82,7 +82,7 @@ console.log(store.getState().books) // Can create a set of memoized selectors based on the location of this entity state const booksSelectors = booksAdapter.getSelectors( - (state) => state.books + (state) => state.books, ) // And then use the selectors to retrieve values @@ -148,7 +148,7 @@ export interface EntityStateAdapter { removeMany>(state: S, keys: EntityId[]): S removeMany>( state: S, - keys: PayloadAction + keys: PayloadAction, ): S removeAll>(state: S): S @@ -156,13 +156,13 @@ export interface EntityStateAdapter { updateOne>(state: S, update: Update): S updateOne>( state: S, - update: PayloadAction> + update: PayloadAction>, ): S updateMany>(state: S, updates: Update[]): S updateMany>( state: S, - updates: PayloadAction[]> + updates: PayloadAction[]>, ): S upsertOne>(state: S, entity: T): S @@ -171,7 +171,7 @@ export interface EntityStateAdapter { upsertMany>(state: S, entities: T[]): S upsertMany>( state: S, - entities: PayloadAction + entities: PayloadAction, ): S } @@ -190,7 +190,7 @@ export interface EntityAdapter extends EntityStateAdapter { getInitialState(state: S): EntityState & S getSelectors(): EntitySelectors> getSelectors( - selectState: (state: V) => EntityState + selectState: (state: V) => EntityState, ): EntitySelectors } ``` @@ -225,7 +225,8 @@ All three options will insert _new_ entities into the list. However they differ Each method has a signature that looks like: ```ts no-transpile -(state: EntityState, argument: TypeOrPayloadAction>) => EntityState +;(state: EntityState, argument: TypeOrPayloadAction>) => + EntityState ``` In other words, they accept a state that looks like `{ids: [], entities: {}}`, and calculate and return a new state. @@ -407,7 +408,7 @@ store.dispatch( booksReceived([ { id: 'b', title: 'Book 3' }, { id: 'c', title: 'Book 2' }, - ]) + ]), ) console.log(booksSelectors.selectIds(store.getState())) diff --git a/docs/api/createListenerMiddleware.mdx b/docs/api/createListenerMiddleware.mdx index 7c626174c4..050fbd20b9 100644 --- a/docs/api/createListenerMiddleware.mdx +++ b/docs/api/createListenerMiddleware.mdx @@ -100,7 +100,7 @@ interface CreateListenerMiddlewareOptions { type ListenerErrorHandler = ( error: unknown, - errorInfo: ListenerErrorInfo + errorInfo: ListenerErrorInfo, ) => void interface ListenerErrorInfo { @@ -125,12 +125,12 @@ interface ListenerMiddlewareInstance< unknown, UnknownAction >, - ExtraArgument = unknown + ExtraArgument = unknown, > { middleware: ListenerMiddleware startListening: (options: AddListenerOptions) => Unsubscribe stopListening: ( - options: AddListenerOptions & UnsubscribeListenerOptions + options: AddListenerOptions & UnsubscribeListenerOptions, ) => boolean clearListeners: () => void } @@ -184,11 +184,11 @@ interface AddListenerOptions { type ListenerPredicate = ( action: Action, currentState?: State, - originalState?: State + originalState?: State, ) => boolean type UnsubscribeListener = ( - unsubscribeOptions?: UnsubscribeListenerOptions + unsubscribeOptions?: UnsubscribeListenerOptions, ) => void interface UnsubscribeListenerOptions { @@ -241,7 +241,7 @@ By default, this does _not_ cancel any active running instances. However, you ma ```ts no-transpile const stopListening = ( - options: AddListenerOptions & UnsubscribeListenerOptions + options: AddListenerOptions & UnsubscribeListenerOptions, ) => boolean interface UnsubscribeListenerOptions { @@ -302,7 +302,7 @@ Returns `true` if the listener entry has been removed, `false` if no subscriptio ```js const wasRemoved = store.dispatch( - removeListener({ predicate, effect, cancelActive: true }) + removeListener({ predicate, effect, cancelActive: true }), ) ``` @@ -322,7 +322,7 @@ The `listenerApi` object is the second argument to each listener callback. It co export interface ListenerEffectAPI< State, Dispatch extends ReduxDispatch, - ExtraArgument = unknown + ExtraArgument = unknown, > extends MiddlewareAPI { // NOTE: MiddlewareAPI contains `dispatch` and `getState` already @@ -579,12 +579,12 @@ The signatures are: ```ts no-transpile type ConditionFunction = ( predicate: ListenerPredicate | (() => boolean), - timeout?: number + timeout?: number, ) => Promise type TakeFunction = ( predicate: ListenerPredicate | (() => boolean), - timeout?: number + timeout?: number, ) => Promise<[Action, State, State] | null> ``` @@ -612,7 +612,7 @@ test('condition method resolves promise when there is a timeout', async () => { (action, currentState: CounterState) => { return currentState.value === 3 }, - 50 + 50, ) // In this test, we expect the timeout to happen first @@ -818,7 +818,7 @@ useEffect(() => { effect: (action, listenerApi) => { // do some useful logic here }, - }) + }), ) return unsubscribe }, []) diff --git a/docs/api/createReducer.mdx b/docs/api/createReducer.mdx index 2526b9a3d9..13a17e00ec 100644 --- a/docs/api/createReducer.mdx +++ b/docs/api/createReducer.mdx @@ -243,11 +243,11 @@ const reducer = createReducer(0, (builder) => { .addCase('increment', (state) => state + 1) .addMatcher( (action) => action.type.startsWith('i'), - (state) => state * 5 + (state) => state * 5, ) .addMatcher( (action) => action.type.endsWith('t'), - (state) => state + 2 + (state) => state + 2, ) }) diff --git a/docs/api/createSelector.mdx b/docs/api/createSelector.mdx index b0679f1ad0..f18410dae8 100644 --- a/docs/api/createSelector.mdx +++ b/docs/api/createSelector.mdx @@ -44,7 +44,7 @@ const selectSelf = (state: State) => state const unsafeSelector = createSelector(selectSelf, (state) => state.value) const draftSafeSelector = createDraftSafeSelector( selectSelf, - (state) => state.value + (state) => state.value, ) // in your reducer: @@ -81,7 +81,7 @@ const createWeakMapDraftSafeSelector = const selectSelf = (state: State) => state const draftSafeSelector = createWeakMapDraftSafeSelector( selectSelf, - (state) => state.value + (state) => state.value, ) ``` diff --git a/docs/api/createSlice.mdx b/docs/api/createSlice.mdx index 45786f3d51..577f34d75d 100644 --- a/docs/api/createSlice.mdx +++ b/docs/api/createSlice.mdx @@ -171,7 +171,7 @@ const todosSlice = createSlice({ // action type is inferred from prepare callback (state, action) => { state.todos.push(action.payload) - } + }, ), fetchTodo: create.asyncThunk( async (id: string, thunkApi) => { @@ -189,7 +189,7 @@ const todosSlice = createSlice({ state.loading = false state.todos.push(action.payload) }, - } + }, ), }), }) @@ -232,7 +232,7 @@ create.preparedReducer( }, (state, action) => { state.todos.push(action.payload) - } + }, ) ``` @@ -322,7 +322,7 @@ create.asyncThunk( error: 'Oh no!', }) } - } + }, ) ``` @@ -330,8 +330,9 @@ For common thunk API configuration options, a [`withTypes` helper](../usage/usag ```ts no-transpile reducers: (create) => { - const createAThunk = - create.asyncThunk.withTypes<{ rejectValue: { error: string } }>() + const createAThunk = create.asyncThunk.withTypes<{ + rejectValue: { error: string } + }>() return { fetchTodo: createAThunk(async (id, thunkApi) => { @@ -432,7 +433,7 @@ const counterSlice = createSlice({ reducers: (create) => ({ getCountData: create.asyncThunk(async (_arg, { getState }) => { const currentCount = counterSlice.selectors.selectValue( - getState() as RootState + getState() as RootState, ) // highlight-start // this would cause a circular type, but the type annotation breaks the circle @@ -548,7 +549,7 @@ const counterSlice = createSlice({ selectors: { selectDouble: createSelector( (sliceState: CounterState) => sliceState.value, - (value) => value * 2 + (value) => value * 2, ), }, }) @@ -568,7 +569,7 @@ console.log(selectDouble.unwrapped.recomputations) // 2 ```ts no-transpile const { selectValue } = counterSlice.getSelectors( - (rootState: RootState) => rootState.aCounter + (rootState: RootState) => rootState.aCounter, ) console.log(selectValue({ aCounter: { value: 2 } })) // 2 @@ -589,7 +590,7 @@ The [`slice.selectors`](#selectors-2) object is the equivalent of calling const { selectValue } = counterSlice.getSelectors(counterSlice.selectSlice) // or const { selectValue } = counterSlice.getSelectors( - (state: RootState) => state[counterSlice.reducerPath] + (state: RootState) => state[counterSlice.reducerPath], ) ``` diff --git a/docs/api/getDefaultEnhancers.mdx b/docs/api/getDefaultEnhancers.mdx index 6863d4168e..075e0d85fb 100644 --- a/docs/api/getDefaultEnhancers.mdx +++ b/docs/api/getDefaultEnhancers.mdx @@ -109,6 +109,6 @@ interface GetDefaultEnhancersOptions { } function getDefaultEnhancers>( - options: GetDefaultEnhancersOptions = {} + options: GetDefaultEnhancersOptions = {}, ): EnhancerArray<[StoreEnhancer<{ dispatch: ExtractDispatchExtensions }>]> ``` diff --git a/docs/api/getDefaultMiddleware.mdx b/docs/api/getDefaultMiddleware.mdx index 7e51cf618f..921c27c2fa 100644 --- a/docs/api/getDefaultMiddleware.mdx +++ b/docs/api/getDefaultMiddleware.mdx @@ -166,6 +166,6 @@ interface GetDefaultMiddlewareOptions { } function getDefaultMiddleware( - options: GetDefaultMiddlewareOptions = {} + options: GetDefaultMiddlewareOptions = {}, ): Middleware<{}, S>[] ``` diff --git a/docs/api/matching-utilities.mdx b/docs/api/matching-utilities.mdx index 12808beecc..2c928f86a4 100644 --- a/docs/api/matching-utilities.mdx +++ b/docs/api/matching-utilities.mdx @@ -126,7 +126,7 @@ import { requestThunk1, requestThunk2 } from '@virtual/matchers' const isARejectedWithValueAction = isRejectedWithValue( requestThunk1, - requestThunk2 + requestThunk2, ) function handleRejectedWithValueAction(action: UnknownAction) { @@ -162,13 +162,13 @@ interface Interesting extends Data { } function isSpecial( - action: PayloadAction + action: PayloadAction, ): action is PayloadAction { return action.payload.isSpecial } function isInteresting( - action: PayloadAction + action: PayloadAction, ): action is PayloadAction { return action.payload.isInteresting } @@ -190,7 +190,7 @@ export const isSpecialAndInterestingThunk = createAsyncThunk( isSpecial: true, isInteresting: true, } - } + }, ) // This has unnecessary complexity @@ -224,13 +224,13 @@ const loadingReducer = createReducer(initialState, (builder) => { isAllOf(isSpecialAndInterestingThunk.fulfilled, isSpecial), (state, action) => { state.isSpecial = true - } + }, ) .addMatcher( isAllOf(isSpecialAndInterestingThunk.fulfilled, isInteresting), (state, action) => { state.isInteresting = true - } + }, ) }) ``` diff --git a/docs/components/DetailedExplanation.jsx b/docs/components/DetailedExplanation.jsx index b3701555ee..da47f48a28 100644 --- a/docs/components/DetailedExplanation.jsx +++ b/docs/components/DetailedExplanation.jsx @@ -2,7 +2,7 @@ import React from 'react' export const DetailedExplanation = ({ children, - title = 'Detailed Explanation' + title = 'Detailed Explanation', }) => { return (
diff --git a/docs/rtk-query/api/createApi.mdx b/docs/rtk-query/api/createApi.mdx index dc76754f4d..24b205556d 100644 --- a/docs/rtk-query/api/createApi.mdx +++ b/docs/rtk-query/api/createApi.mdx @@ -101,11 +101,11 @@ export type BaseQueryFn< Result = unknown, Error = unknown, DefinitionExtraOptions = {}, - Meta = {} + Meta = {}, > = ( args: Args, api: BaseQueryApi, - extraOptions: DefinitionExtraOptions + extraOptions: DefinitionExtraOptions, ) => MaybePromise> export interface BaseQueryApi { @@ -148,7 +148,7 @@ export type QueryDefinition< BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, - ReducerPath extends string = string + ReducerPath extends string = string, > = { query(arg: QueryArg): BaseQueryArg @@ -157,21 +157,21 @@ export type QueryDefinition< arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions, - baseQuery: (arg: Parameters[0]) => ReturnType + baseQuery: (arg: Parameters[0]) => ReturnType, ): MaybePromise>> /* transformResponse only available with `query`, not `queryFn` */ transformResponse?( baseQueryReturnValue: BaseQueryResult, meta: BaseQueryMeta, - arg: QueryArg + arg: QueryArg, ): ResultType | Promise /* transformErrorResponse only available with `query`, not `queryFn` */ transformErrorResponse?( baseQueryReturnValue: BaseQueryError, meta: BaseQueryMeta, - arg: QueryArg + arg: QueryArg, ): unknown extraOptions?: BaseQueryExtraOptions @@ -195,7 +195,7 @@ export type QueryDefinition< queryFulfilled, getCacheEntry, updateCachedData, // available for query endpoints only - }: QueryLifecycleApi + }: QueryLifecycleApi, ): Promise onCacheEntryAdded?( @@ -209,7 +209,7 @@ export type QueryDefinition< cacheDataLoaded, getCacheEntry, updateCachedData, // available for query endpoints only - }: QueryCacheLifecycleApi + }: QueryCacheLifecycleApi, ): Promise } ``` @@ -223,7 +223,7 @@ export type MutationDefinition< TagTypes extends string, ResultType, ReducerPath extends string = string, - Context = Record + Context = Record, > = { query(arg: QueryArg): BaseQueryArg @@ -232,21 +232,21 @@ export type MutationDefinition< arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions, - baseQuery: (arg: Parameters[0]) => ReturnType + baseQuery: (arg: Parameters[0]) => ReturnType, ): MaybePromise>> /* transformResponse only available with `query`, not `queryFn` */ transformResponse?( baseQueryReturnValue: BaseQueryResult, meta: BaseQueryMeta, - arg: QueryArg + arg: QueryArg, ): ResultType | Promise /* transformErrorResponse only available with `query`, not `queryFn` */ transformErrorResponse?( baseQueryReturnValue: BaseQueryError, meta: BaseQueryMeta, - arg: QueryArg + arg: QueryArg, ): unknown extraOptions?: BaseQueryExtraOptions @@ -262,7 +262,7 @@ export type MutationDefinition< requestId, queryFulfilled, getCacheEntry, - }: MutationLifecycleApi + }: MutationLifecycleApi, ): Promise onCacheEntryAdded?( @@ -275,7 +275,7 @@ export type MutationDefinition< cacheEntryRemoved, cacheDataLoaded, getCacheEntry, - }: MutationCacheLifecycleApi + }: MutationCacheLifecycleApi, ): Promise } ``` @@ -391,7 +391,7 @@ _(required if no `queryFn` provided)_ ```ts title="query signature" no-transpile export type query = ( - arg: QueryArg + arg: QueryArg, ) => string | Record // with `fetchBaseQuery` @@ -579,7 +579,7 @@ async function onQueryStarted( requestId, queryFulfilled, getCacheEntry, - }: MutationLifecycleApi + }: MutationLifecycleApi, ): Promise ``` @@ -594,7 +594,7 @@ async function onQueryStarted( queryFulfilled, getCacheEntry, updateCachedData, // available for query endpoints only - }: QueryLifecycleApi + }: QueryLifecycleApi, ): Promise ``` @@ -671,7 +671,7 @@ async function onCacheEntryAdded( cacheEntryRemoved, cacheDataLoaded, getCacheEntry, - }: MutationCacheLifecycleApi + }: MutationCacheLifecycleApi, ): Promise ``` @@ -687,7 +687,7 @@ async function onCacheEntryAdded( cacheDataLoaded, getCacheEntry, updateCachedData, // available for query endpoints only - }: QueryCacheLifecycleApi + }: QueryCacheLifecycleApi, ): Promise ``` diff --git a/docs/rtk-query/api/created-api/api-slice-utils.mdx b/docs/rtk-query/api/created-api/api-slice-utils.mdx index 816d5298a2..5ce2f72e07 100644 --- a/docs/rtk-query/api/created-api/api-slice-utils.mdx +++ b/docs/rtk-query/api/created-api/api-slice-utils.mdx @@ -30,13 +30,13 @@ const updateQueryData = ( endpointName: string, args: any, updateRecipe: (draft: Draft) => void, - updateProvided?: boolean -) => ThunkAction; + updateProvided?: boolean, +) => ThunkAction interface PatchCollection { - patches: Patch[]; - inversePatches: Patch[]; - undo: () => void; + patches: Patch[] + inversePatches: Patch[] + undo: () => void } ``` @@ -64,7 +64,7 @@ Note that the first two arguments (`endpointName` and `args`) are used to determ const patchCollection = dispatch( api.util.updateQueryData('getPosts', undefined, (draftPosts) => { draftPosts.push({ id: 1, name: 'Teddy' }) - }) + }), ) ``` @@ -91,7 +91,7 @@ dispatch(api.endpoints.getPosts.initiate(undefined, { ...options })) const patchCollection = dispatch( api.util.updateQueryData('getPostById', 1, (draftPost) => { draftPost.name = 'Lilly' - }) + }), ) ``` @@ -117,11 +117,8 @@ dispatch(api.endpoints.getPostById.initiate(1, { ...options })) #### Signature ```ts no-transpile -const upsertQueryData = ( - endpointName: string, - args: any, - newEntryData: T -) => ThunkAction>, PartialState, any, UnknownAction>; +const upsertQueryData = (endpointName: string, args: any, newEntryData: T) => + ThunkAction>, PartialState, any, UnknownAction> ``` - **Parameters** @@ -145,7 +142,7 @@ If dispatched while an actual request is in progress, both the upsert and reques ```ts no-transpile await dispatch( - api.util.upsertQueryData('getPost', { id: 1 }, { id: 1, text: 'Hello!' }) + api.util.upsertQueryData('getPost', { id: 1 }, { id: 1, text: 'Hello!' }), ) ``` @@ -184,12 +181,16 @@ In cases where it is desired to simply revert the previous changes, it may be pr const patchCollection = dispatch( api.util.updateQueryData('getPosts', undefined, (draftPosts) => { draftPosts.push({ id: 1, name: 'Teddy' }) - }) + }), ) // later dispatch( - api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches) + api.util.patchQueryData( + 'getPosts', + undefined, + patchCollection.inversePatches, + ), ) // or @@ -201,13 +202,10 @@ patchCollection.undo() #### Signature ```ts no-transpile -type PrefetchOptions = { ifOlderThan?: false | number } | { force?: boolean }; +type PrefetchOptions = { ifOlderThan?: false | number } | { force?: boolean } -const prefetch = ( - endpointName: string, - arg: any, - options: PrefetchOptions -) => ThunkAction; +const prefetch = (endpointName: string, arg: any, options: PrefetchOptions) => + ThunkAction ``` - **Parameters** @@ -239,7 +237,7 @@ dispatch(api.util.prefetch('getPosts', undefined, { force: true })) ```ts no-transpile function selectInvalidatedBy( state: RootState, - tags: ReadonlyArray> + tags: ReadonlyArray>, ): Array<{ endpointName: string originalArgs: any @@ -286,7 +284,7 @@ const entries = api.util.selectInvalidatedBy(state, [ ```ts no-transpile const invalidateTags = ( - tags: Array> + tags: Array>, ) => ({ type: string, payload: tags, @@ -316,7 +314,7 @@ dispatch( api.util.invalidateTags([ { type: 'Post', id: 1 }, { type: 'Post', id: 'LIST' }, - ]) + ]), ) ``` @@ -327,7 +325,7 @@ dispatch( ```ts no-transpile function selectCachedArgsForQuery( state: RootState, - queryName: QueryName + queryName: QueryName, ): Array ``` diff --git a/docs/rtk-query/api/created-api/endpoints.mdx b/docs/rtk-query/api/created-api/endpoints.mdx index ed4178467d..c57cc783fd 100644 --- a/docs/rtk-query/api/created-api/endpoints.mdx +++ b/docs/rtk-query/api/created-api/endpoints.mdx @@ -156,14 +156,14 @@ type CreateCacheSelectorFactory = | MutationResultSelectorFactory type QueryResultSelectorFactory = ( - queryArg: QueryArg | SkipToken + queryArg: QueryArg | SkipToken, ) => (state: RootState) => QueryResultSelectorResult type MutationResultSelectorFactory< Definition extends MutationDefinition, - RootState + RootState, > = ( - requestId: string | SkipToken + requestId: string | SkipToken, ) => (state: RootState) => MutationSubState & RequestStatusFlags type SkipToken = typeof Symbol @@ -200,7 +200,7 @@ function App() { // Each call will create a new selector function instance const selectPost = useMemo( () => api.endpoints.getPost.select(postId), - [postId] + [postId], ) const { data, isLoading } = useAppSelector(selectPost) // highlight-end @@ -234,14 +234,14 @@ function App() { const dispatch = useAppDispatch() const [newPost, setNewPost] = useState({ name: 'Ash' }) const [requestId, setRequestId] = useState( - skipToken + skipToken, ) // highlight-start // useMemo is used to only call `.select(..)` when required. // Each call will create a new selector function instance const selectMutationResult = useMemo( () => api.endpoints.addPost.select(requestId), - [requestId] + [requestId], ) const { isLoading } = useAppSelector(selectMutationResult) // highlight-end diff --git a/docs/rtk-query/api/created-api/hooks.mdx b/docs/rtk-query/api/created-api/hooks.mdx index d6a9426466..cd45e4951c 100644 --- a/docs/rtk-query/api/created-api/hooks.mdx +++ b/docs/rtk-query/api/created-api/hooks.mdx @@ -246,7 +246,7 @@ const useQueryResult = api.useGetPostsQuery(arg, options) ```ts no-transpile type UseQuery = ( arg: any | SkipToken, - options?: UseQueryOptions + options?: UseQueryOptions, ) => UseQueryResult type UseQueryOptions = { @@ -309,7 +309,7 @@ const useMutationResult = api.useUpdatePostMutation(options) ```ts no-transpile type UseMutation = ( - options?: UseMutationStateOptions + options?: UseMutationStateOptions, ) => [UseMutationTrigger, UseMutationResult | SelectedUseMutationResult] type UseMutationStateOptions = { @@ -387,7 +387,7 @@ const useQueryStateResult = api.endpoints.getPosts.useQueryState(arg, options) ```ts no-transpile type UseQueryState = ( arg: any | SkipToken, - options?: UseQueryStateOptions + options?: UseQueryStateOptions, ) => UseQueryStateResult | SelectedQueryStateResult type UseQueryStateOptions = { @@ -438,7 +438,7 @@ const { refetch } = api.endpoints.getPosts.useQuerySubscription(arg, options) ```ts no-transpile type UseQuerySubscription = ( arg: any | SkipToken, - options?: UseQuerySubscriptionOptions + options?: UseQuerySubscriptionOptions, ) => UseQuerySubscriptionResult type UseQuerySubscriptionOptions = { @@ -550,7 +550,7 @@ const [trigger, lastArg] = ```ts no-transpile type UseLazyQuerySubscription = ( - options?: UseLazyQuerySubscriptionOptions + options?: UseLazyQuerySubscriptionOptions, ) => [UseLazyQuerySubscriptionTrigger, LastArg] type UseLazyQuerySubscriptionOptions = { @@ -561,7 +561,7 @@ type UseLazyQuerySubscriptionOptions = { type UseLazyQuerySubscriptionTrigger = ( arg: any, - preferCacheValue?: boolean + preferCacheValue?: boolean, ) => void ``` @@ -588,7 +588,7 @@ const prefetchCallback = api.usePrefetch(endpointName, options) ```ts no-transpile type UsePrefetch = ( endpointName: string, - options?: UsePrefetchOptions + options?: UsePrefetchOptions, ) => PrefetchCallback type UsePrefetchOptions = diff --git a/docs/rtk-query/api/created-api/overview.mdx b/docs/rtk-query/api/created-api/overview.mdx index b515a2f5c8..5db80993b2 100644 --- a/docs/rtk-query/api/created-api/overview.mdx +++ b/docs/rtk-query/api/created-api/overview.mdx @@ -55,7 +55,7 @@ type Api = { > selectInvalidatedBy: ( state: FullState, - tags: Array> + tags: Array>, ) => Array<{ endpointName: string originalArgs: any @@ -63,16 +63,16 @@ type Api = { }> selectCachedArgsForQuery: ( state: FullState, - endpointName: EndpointName + endpointName: EndpointName, ) => Array resetApiState: ActionCreator getRunningQueryThunk( endpointName: EndpointName, - args: QueryArg + args: QueryArg, ): ThunkWithReturnValue getRunningMutationThunk( endpointName: EndpointName, - fixedCacheKeyOrRequestId: string + fixedCacheKeyOrRequestId: string, ): ThunkWithReturnValue getRunningQueriesThunk(): ThunkWithReturnValue< Array> diff --git a/docs/rtk-query/api/fetchBaseQuery.mdx b/docs/rtk-query/api/fetchBaseQuery.mdx index eea7ad4f37..0f668ea145 100644 --- a/docs/rtk-query/api/fetchBaseQuery.mdx +++ b/docs/rtk-query/api/fetchBaseQuery.mdx @@ -50,11 +50,11 @@ export const pokemonApi = createApi({ ```ts title="fetchBaseQuery signature" no-transpile type FetchBaseQuery = ( - args: FetchBaseQueryArgs + args: FetchBaseQueryArgs, ) => ( args: string | FetchArgs, api: BaseQueryApi, - extraOptions: ExtraOptions + extraOptions: ExtraOptions, ) => FetchBaseQueryResult type FetchBaseQueryArgs = { @@ -64,11 +64,11 @@ type FetchBaseQueryArgs = { api: Pick< BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced' - > + >, ) => MaybePromise fetchFn?: ( input: RequestInfo, - init?: RequestInit | undefined + init?: RequestInit | undefined, ) => Promise paramsSerializer?: (params: Record) => string isJsonContentType?: (headers: Headers) => boolean @@ -118,7 +118,7 @@ type prepareHeaders = ( endpoint: string type: 'query' | 'mutation' forced: boolean | undefined - } + }, ) => Headers | void ``` diff --git a/docs/rtk-query/api/setupListeners.mdx b/docs/rtk-query/api/setupListeners.mdx index 5e9fe04bef..feb44c12e0 100644 --- a/docs/rtk-query/api/setupListeners.mdx +++ b/docs/rtk-query/api/setupListeners.mdx @@ -24,8 +24,8 @@ export function setupListeners( onFocusLost: typeof onFocusLost onOnline: typeof onOnline onOffline: typeof onOffline - } - ) => () => void + }, + ) => () => void, ) { function defaultHandler() { const handleFocus = () => dispatch(onFocus()) @@ -46,7 +46,7 @@ export function setupListeners( window.addEventListener( 'visibilitychange', handleVisibilityChange, - false + false, ) window.addEventListener('focus', handleFocus, false) diff --git a/docs/rtk-query/usage-with-typescript.mdx b/docs/rtk-query/usage-with-typescript.mdx index 366da13818..178a50495e 100644 --- a/docs/rtk-query/usage-with-typescript.mdx +++ b/docs/rtk-query/usage-with-typescript.mdx @@ -103,11 +103,11 @@ export type BaseQueryFn< Result = unknown, Error = unknown, DefinitionExtraOptions = {}, - Meta = {} + Meta = {}, > = ( args: Args, api: BaseQueryApi, - extraOptions: DefinitionExtraOptions + extraOptions: DefinitionExtraOptions, ) => MaybePromise> export interface BaseQueryApi { @@ -649,7 +649,7 @@ import { FetchBaseQueryError } from '@reduxjs/toolkit/query' * Type predicate to narrow an unknown error to `FetchBaseQueryError` */ export function isFetchBaseQueryError( - error: unknown + error: unknown, ): error is FetchBaseQueryError { return typeof error === 'object' && error != null && 'status' in error } @@ -658,7 +658,7 @@ export function isFetchBaseQueryError( * Type predicate to narrow an unknown error to an object with a string 'message' property */ export function isErrorWithMessage( - error: unknown + error: unknown, ): error is { message: string } { return ( typeof error === 'object' && diff --git a/docs/rtk-query/usage/automated-refetching.mdx b/docs/rtk-query/usage/automated-refetching.mdx index 5d589934cf..846b32598d 100644 --- a/docs/rtk-query/usage/automated-refetching.mdx +++ b/docs/rtk-query/usage/automated-refetching.mdx @@ -809,8 +809,8 @@ const api = createApi({ result ? [{ type: 'Post', id }] : error?.status === 401 - ? ['UNAUTHORIZED'] - : ['UNKNOWN_ERROR'], + ? ['UNAUTHORIZED'] + : ['UNKNOWN_ERROR'], }), login: build.mutation({ query: () => '/login', @@ -908,7 +908,7 @@ import type { Post, User } from './types' // highlight-start function providesList( resultsWithIds: R | undefined, - tagType: T + tagType: T, ) { return resultsWithIds ? [ diff --git a/docs/rtk-query/usage/cache-behavior.mdx b/docs/rtk-query/usage/cache-behavior.mdx index e6815b5271..caa8774f08 100644 --- a/docs/rtk-query/usage/cache-behavior.mdx +++ b/docs/rtk-query/usage/cache-behavior.mdx @@ -138,8 +138,8 @@ const Component = () => { dispatch( api.endpoints.getPosts.initiate( { count: 5 }, - { subscribe: false, forceRefetch: true } - ) + { subscribe: false, forceRefetch: true }, + ), ) } @@ -206,7 +206,7 @@ const Component = () => { // highlight-start // this overrules the api definition setting, // forcing the query to always fetch when this component is mounted - { refetchOnMountOrArgChange: true } + { refetchOnMountOrArgChange: true }, // highlight-end ) diff --git a/docs/rtk-query/usage/code-generation.mdx b/docs/rtk-query/usage/code-generation.mdx index efd4551e05..4ee69e0d34 100644 --- a/docs/rtk-query/usage/code-generation.mdx +++ b/docs/rtk-query/usage/code-generation.mdx @@ -112,7 +112,7 @@ interface SimpleUsage { export type EndpointMatcherFunction = ( operationName: string, - operationDefinition: OperationDefinition + operationDefinition: OperationDefinition, ) => boolean ``` diff --git a/docs/rtk-query/usage/customizing-create-api.mdx b/docs/rtk-query/usage/customizing-create-api.mdx index bb1ccf4e1c..cce3b8f339 100644 --- a/docs/rtk-query/usage/customizing-create-api.mdx +++ b/docs/rtk-query/usage/customizing-create-api.mdx @@ -44,7 +44,7 @@ const customCreateApi = buildCreateApi( useSelector: createSelectorHook(MyContext), useStore: createStoreHook(MyContext), }, - }) + }), ) ``` @@ -65,7 +65,7 @@ const createLruSelector = createSelectorCreator(lruMemoize) const customCreateApi = buildCreateApi( coreModule({ createSelector: createLruSelector }), - reactHooksModule({ createSelector: createLruSelector }) + reactHooksModule({ createSelector: createLruSelector }), ) ``` @@ -94,7 +94,7 @@ declare module '../apiTypes' { BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, - TagTypes extends string + TagTypes extends string, > { [customModuleName]: { endpoints: { diff --git a/docs/rtk-query/usage/customizing-queries.mdx b/docs/rtk-query/usage/customizing-queries.mdx index 8734cc8d2e..8532ecf26c 100644 --- a/docs/rtk-query/usage/customizing-queries.mdx +++ b/docs/rtk-query/usage/customizing-queries.mdx @@ -57,7 +57,7 @@ const customBaseQuery = ( // highlight-start args, { signal, dispatch, getState }, - extraOptions + extraOptions, // highlight-end ) => { // omitted @@ -77,7 +77,7 @@ const customBaseQuery = ( const customBaseQuery = ( args, { signal, dispatch, getState }, - extraOptions + extraOptions, ) => { // highlight-start if (Math.random() > 0.5) return { error: 'Too high!' } @@ -97,18 +97,21 @@ At its core, a `baseQuery` function only needs to have the minimum return value For [`fetchBaseQuery`](../api/fetchBaseQuery) specifically, the return type is as follows: ```ts title="Return types of fetchBaseQuery" no-transpile -Promise<{ - data: any; - error?: undefined; - meta?: { request: Request; response: Response }; -} | { - error: { - status: number; - data: any; - }; - data?: undefined; - meta?: { request: Request; response: Response }; -}> +Promise< + | { + data: any + error?: undefined + meta?: { request: Request; response: Response } + } + | { + error: { + status: number + data: any + } + data?: undefined + meta?: { request: Request; response: Response } + } +> ``` 1. ```ts title="Expected success result format with fetchBaseQuery" no-transpile @@ -130,7 +133,7 @@ By default, the payload from the server is returned directly. function defaultTransformResponse( baseQueryReturnValue: unknown, meta: unknown, - arg: unknown + arg: unknown, ) { return baseQueryReturnValue } @@ -211,7 +214,7 @@ By default, the payload from the server is returned directly. function defaultTransformResponse( baseQueryReturnValue: unknown, meta: unknown, - arg: unknown + arg: unknown, ) { return baseQueryReturnValue } @@ -232,7 +235,7 @@ dependent on the `baseQuery` used. transformErrorResponse: ( response: { data: { sideA: Tracks; sideB: Tracks } }, meta, - arg + arg, ) => { if (meta?.coinFlip === 'heads') { return response.data.sideA @@ -317,7 +320,7 @@ const queryFn = ( args, { signal, dispatch, getState }, extraOptions, - baseQuery + baseQuery, // highlight-end ) => { // omitted @@ -338,7 +341,7 @@ const queryFn = ( args, { signal, dispatch, getState }, extraOptions, - baseQuery + baseQuery, ) => { // highlight-start if (Math.random() > 0.5) return { error: 'Too high!' } @@ -362,7 +365,7 @@ import type { AxiosRequestConfig, AxiosError } from 'axios' // highlight-start const axiosBaseQuery = ( - { baseUrl }: { baseUrl: string } = { baseUrl: '' } + { baseUrl }: { baseUrl: string } = { baseUrl: '' }, ): BaseQueryFn< { url: string @@ -565,7 +568,7 @@ const baseQueryWithReauth: BaseQueryFn< const refreshResult = await baseQuery( '/refreshToken', api, - extraOptions + extraOptions, ) if (refreshResult.data) { api.dispatch(tokenReceived(refreshResult.data)) @@ -627,7 +630,7 @@ const staggeredBaseQueryWithBailOut = retry( const result = await fetchBaseQuery({ baseUrl: '/api/' })( args, api, - extraOptions + extraOptions, ) // bail out of re-tries immediately if unauthorized, @@ -640,7 +643,7 @@ const staggeredBaseQueryWithBailOut = retry( }, { maxRetries: 5, - } + }, ) // highlight-end @@ -711,7 +714,7 @@ const metaBaseQuery: BaseQueryFn< const baseResult = await fetchBaseQuery({ baseUrl: '/' })( args, api, - extraOptions + extraOptions, ) return { @@ -746,7 +749,7 @@ const api = createApi({ // These properties can be used to transform the response as desired. if (!meta) return [] return returnValue.filter( - (post) => post.timestamp >= meta.timestamp - DAY_MS + (post) => post.timestamp >= meta.timestamp - DAY_MS, ) }, // highlight-end diff --git a/docs/rtk-query/usage/manual-cache-updates.mdx b/docs/rtk-query/usage/manual-cache-updates.mdx index ac6cb96bab..7f05b88a1e 100644 --- a/docs/rtk-query/usage/manual-cache-updates.mdx +++ b/docs/rtk-query/usage/manual-cache-updates.mdx @@ -12,7 +12,7 @@ description: 'RTK Query > Usage > Manual Cache Updates: Updating and creating ca ## Overview -For most cases, in order to receive up to date data after a triggering a change in the backend, you can take advantage of cache tag invalidation to perform [automated re-fetching](./automated-refetching). This will cause a query to re-fetch its data when it has been told that a mutation has occurred which would cause its data to become out of date. +For most cases, in order to receive up to date data after a triggering a change in the backend, you can take advantage of cache tag invalidation to perform [automated re-fetching](./automated-refetching). This will cause a query to re-fetch its data when it has been told that a mutation has occurred which would cause its data to become out of date. We recommend using automated re-fetching as a preference over manual cache updates in most situations. @@ -20,7 +20,7 @@ However, there _are_ use cases when manual cache updates are necessary, such as RTK Query exports thunks for these use cases, attached to `api.utils`: -- [`updateQueryData`](../api/created-api/api-slice-utils.mdx#updatequerydata): updates an already existing cache entry +- [`updateQueryData`](../api/created-api/api-slice-utils.mdx#updatequerydata): updates an already existing cache entry - [`upsertQueryData`](../api/created-api/api-slice-utils.mdx#upsertquerydata): creates or replaces cache entries Since these are thunks, you can dispatch them anywhere you have access to `dispatch`. @@ -32,6 +32,7 @@ For updates of existing cache entries, use [`updateQueryData`](../api/created-ap `updateQueryData` is strictly intended to perform _updates_ to existing cache entries, not create new entries. If an `updateQueryData` thunk action is dispatched and the `endpointName` + `args` combination that does not match any existing cache entry, the provided `recipe` callback will not be called, and no `patches` or `inversePatches` will be returned. Use cases for manual update of cache entries: + - Providing immediate feedback to the user when a mutation is attempted - After a mutation, updating a single item in a large list of items that is already cached, rather than re-fetching the whole list - Debouncing a large number of mutations with immediate feedback as though they are being applied, followed by a single request sent to the server to update the debounced attempts @@ -42,8 +43,7 @@ To create or replace existing cache entries, use [`upsertQueryData`](../api/crea `upsertQueryData` is intended to perform _replacements_ to existing cache entries or _creation_ of new ones. Since `upsertQueryData` does not have access to the previous state of the cache entry, the update may be performed only as a replacement. In comparison, `updateQueryData` allows patching of the existing cache entry, but cannot create a new one. - -One example use case is [pessimistic updates](../usage/manual-cache-updates.mdx#pessimistic-updates). If the client makes an API call to create a `Post`, the backend could return its complete data including the `id`. Then we can use `upsertQueryData` to create a new cache entry for the `getPostById(id)` query, preventing an extra fetch to retrieve the item later. +One example use case is [pessimistic updates](../usage/manual-cache-updates.mdx#pessimistic-updates). If the client makes an API call to create a `Post`, the backend could return its complete data including the `id`. Then we can use `upsertQueryData` to create a new cache entry for the `getPostById(id)` query, preventing an extra fetch to retrieve the item later. ## Recipes @@ -102,7 +102,7 @@ const api = createApi({ const patchResult = dispatch( api.util.updateQueryData('getPost', id, (draft) => { Object.assign(draft, patch) - }) + }), ) try { await queryFulfilled @@ -197,7 +197,7 @@ const api = createApi({ const patchResult = dispatch( api.util.updateQueryData('getPost', id, (draft) => { Object.assign(draft, updatedPost) - }) + }), ) } catch {} }, @@ -214,7 +214,7 @@ const api = createApi({ try { const { data: createdPost } = await queryFulfilled const patchResult = dispatch( - api.util.upsertQueryData('getPost', id, createdPost) + api.util.upsertQueryData('getPost', id, createdPost), ) } catch {} }, @@ -253,7 +253,7 @@ function App() { const patchCollection = dispatch( api.util.updateQueryData('getPosts', undefined, (draftPosts) => { draftPosts.push({ id: 1, name: 'Teddy' }) - }) + }), ) } diff --git a/docs/rtk-query/usage/migrating-to-rtk-query.mdx b/docs/rtk-query/usage/migrating-to-rtk-query.mdx index 11b993c78b..e5f2a655bc 100644 --- a/docs/rtk-query/usage/migrating-to-rtk-query.mdx +++ b/docs/rtk-query/usage/migrating-to-rtk-query.mdx @@ -72,7 +72,7 @@ export const fetchPokemonByName = createAsyncThunk( return rejectWithValue(data) } return data - } + }, ) // highlight-end @@ -187,7 +187,7 @@ render( , // highlight-end - rootElement + rootElement, ) ``` @@ -201,7 +201,7 @@ import { AsyncThunkAction } from '@reduxjs/toolkit' import { RootState } from '../store' interface Pokemon {} export declare const fetchPokemonByName: ( - arg: string + arg: string, ) => AsyncThunkAction export const selectStatusByName = (state: RootState, name: string) => @@ -243,7 +243,7 @@ export function useGetPokemonByNameQuery(name: string) { const dispatch = useAppDispatch() // select the current status from the store state for the provided name const status = useSelector((state: RootState) => - selectStatusByName(state, name) + selectStatusByName(state, name), ) // select the current data from the store state for the provided name const data = useSelector((state: RootState) => selectDataByName(state, name)) diff --git a/docs/rtk-query/usage/mutations.mdx b/docs/rtk-query/usage/mutations.mdx index c018056832..3dd4f73f53 100644 --- a/docs/rtk-query/usage/mutations.mdx +++ b/docs/rtk-query/usage/mutations.mdx @@ -58,14 +58,14 @@ const api = createApi({ transformErrorResponse: ( response: { status: string | number }, meta, - arg + arg, ) => response.status, invalidatesTags: ['Post'], // onQueryStarted is useful for optimistic updates // The 2nd parameter is the destructured `MutationLifecycleApi` async onQueryStarted( arg, - { dispatch, getState, queryFulfilled, requestId, extra, getCacheEntry } + { dispatch, getState, queryFulfilled, requestId, extra, getCacheEntry }, ) {}, // The 2nd parameter is the destructured `MutationCacheLifecycleApi` async onCacheEntryAdded( @@ -78,7 +78,7 @@ const api = createApi({ cacheEntryRemoved, cacheDataLoaded, getCacheEntry, - } + }, ) {}, // highlight-end }), @@ -256,7 +256,7 @@ export const postApi = createApi({ result ? // successful query [ - ...result.map(({ id }) => ({ type: 'Posts', id } as const)), + ...result.map(({ id }) => ({ type: 'Posts', id }) as const), { type: 'Posts', id: 'LIST' }, ] : // an error occurred, but we still want to refetch this query when `{ type: 'Posts', id: 'LIST' }` is invalidated diff --git a/docs/rtk-query/usage/polling.mdx b/docs/rtk-query/usage/polling.mdx index 2e85c1ed6d..8a59db5ca8 100644 --- a/docs/rtk-query/usage/polling.mdx +++ b/docs/rtk-query/usage/polling.mdx @@ -34,7 +34,7 @@ In an action creator without React Hooks: const { data, status, error, refetch } = store.dispatch( endpoints.getCountById.initiate(id, { subscriptionOptions: { pollingInterval: 3000 }, - }) + }), ) ``` diff --git a/docs/rtk-query/usage/prefetching.mdx b/docs/rtk-query/usage/prefetching.mdx index fbdc3b21fb..405109fb9c 100644 --- a/docs/rtk-query/usage/prefetching.mdx +++ b/docs/rtk-query/usage/prefetching.mdx @@ -86,8 +86,8 @@ type EndpointNames = keyof typeof api.endpoints export function usePrefetchImmediately( endpoint: T, - arg: Parameters[0], - options: PrefetchOptions = {} + arg: Parameters<(typeof api.endpoints)[T]['initiate']>[0], + options: PrefetchOptions = {}, ) { const dispatch = useAppDispatch() useEffect(() => { @@ -107,7 +107,7 @@ When dispatching the `prefetch` thunk as shown below you will see the same exact ```ts title="Non-hook prefetching example" no-transpile store.dispatch( - api.util.prefetch(endpointName, arg, { force: false, ifOlderThan: 10 }) + api.util.prefetch(endpointName, arg, { force: false, ifOlderThan: 10 }), ) ``` diff --git a/docs/rtk-query/usage/queries.mdx b/docs/rtk-query/usage/queries.mdx index 1eca72047e..b0568e3047 100644 --- a/docs/rtk-query/usage/queries.mdx +++ b/docs/rtk-query/usage/queries.mdx @@ -65,7 +65,7 @@ const api = createApi({ transformErrorResponse: ( response: { status: string | number }, meta, - arg + arg, ) => response.status, providesTags: (result, error, id) => [{ type: 'Post', id }], // The 2nd parameter is the destructured `QueryLifecycleApi` @@ -79,7 +79,7 @@ const api = createApi({ queryFulfilled, getCacheEntry, updateCachedData, - } + }, ) {}, // The 2nd parameter is the destructured `QueryCacheLifecycleApi` async onCacheEntryAdded( @@ -93,7 +93,7 @@ const api = createApi({ cacheDataLoaded, getCacheEntry, updateCachedData, - } + }, ) {}, // highlight-end }), @@ -287,9 +287,7 @@ function PostsList() { return (
    - {posts?.data?.map((post) => ( - - ))} + {posts?.data?.map((post) => )}
) } @@ -346,7 +344,7 @@ If you're not using React Hooks, you can access `refetch` like this: ```ts no-transpile const { status, data, error, refetch } = dispatch( - pokemonApi.endpoints.getPokemon.initiate('bulbasaur') + pokemonApi.endpoints.getPokemon.initiate('bulbasaur'), ) ``` diff --git a/docs/rtk-query/usage/streaming-updates.mdx b/docs/rtk-query/usage/streaming-updates.mdx index 88ed09082e..880a78bfd6 100644 --- a/docs/rtk-query/usage/streaming-updates.mdx +++ b/docs/rtk-query/usage/streaming-updates.mdx @@ -78,7 +78,7 @@ export const api = createApi({ // highlight-start async onCacheEntryAdded( arg, - { updateCachedData, cacheDataLoaded, cacheEntryRemoved } + { updateCachedData, cacheDataLoaded, cacheEntryRemoved }, ) { // create a websocket connection when the cache subscription starts const ws = new WebSocket('ws://localhost:8080') @@ -165,13 +165,13 @@ export const api = createApi({ transformResponse(response: Message[]) { return messagesAdapter.addMany( messagesAdapter.getInitialState(), - response + response, ) }, // highlight-end async onCacheEntryAdded( arg, - { updateCachedData, cacheDataLoaded, cacheEntryRemoved } + { updateCachedData, cacheDataLoaded, cacheEntryRemoved }, ) { const ws = new WebSocket('ws://localhost:8080') try { diff --git a/docs/rtk-query/usage/usage-without-react-hooks.mdx b/docs/rtk-query/usage/usage-without-react-hooks.mdx index 319e4a0f95..45617d383a 100644 --- a/docs/rtk-query/usage/usage-without-react-hooks.mdx +++ b/docs/rtk-query/usage/usage-without-react-hooks.mdx @@ -71,13 +71,13 @@ Because the `endpoint.select(arg)` function returns a new selector each time it' ```ts title="Creating a memoized selector creator" no-transpile const createGetPostSelector = createSelector( (id: string) => id, - (id) => api.endpoints.getPost.select(id) + (id) => api.endpoints.getPost.select(id), ) const selectGetPostError = createSelector( (state: RootState) => state, (state: RootState, id: string) => createGetPostSelector(id), - (state, selectGetPost) => selectGetPost(state).error + (state, selectGetPost) => selectGetPost(state).error, ) ``` diff --git a/docs/tsconfig.json b/docs/tsconfig.json index 80bf4d4a7d..200ffa3ffe 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -18,36 +18,20 @@ "baseUrl": "..", "jsx": "preserve", "paths": { - "react": [ - "../node_modules/@types/react" - ], - "react-dom": [ - "../node_modules/@types/react-dom" - ], - "@reduxjs/toolkit": [ - "packages/toolkit/src/index.ts" - ], - "@reduxjs/toolkit/query": [ - "packages/toolkit/src/query/index.ts" - ], + "react": ["../node_modules/@types/react"], + "react-dom": ["../node_modules/@types/react-dom"], + "@reduxjs/toolkit": ["packages/toolkit/src/index.ts"], + "@reduxjs/toolkit/query": ["packages/toolkit/src/query/index.ts"], "@reduxjs/toolkit/query/react": [ - "packages/toolkit/src/query/react/index.ts" - ], - "@reduxjs/toolkit/dist/query/*": [ - "packages/toolkit/src/query/*" - ], - "@virtual/*": [ - "docs/virtual/*" - ], - "your-cool-library": [ - "docs/virtual/your-cool-library/index.ts" - ], - "redux-logger": [ - "docs/virtual/redux-logger/index.ts" + "packages/toolkit/src/query/react/index.ts", ], + "@reduxjs/toolkit/dist/query/*": ["packages/toolkit/src/query/*"], + "@virtual/*": ["docs/virtual/*"], + "your-cool-library": ["docs/virtual/your-cool-library/index.ts"], + "redux-logger": ["docs/virtual/redux-logger/index.ts"], "petstore-api.generated": [ - "docs/virtual/petstore-api.generated/index.ts" - ] - } - } -} \ No newline at end of file + "docs/virtual/petstore-api.generated/index.ts", + ], + }, + }, +} diff --git a/docs/tutorials/rtk-query.mdx b/docs/tutorials/rtk-query.mdx index 8f2c97962e..17dcbae065 100644 --- a/docs/tutorials/rtk-query.mdx +++ b/docs/tutorials/rtk-query.mdx @@ -23,7 +23,7 @@ hide_title: true ## Introduction -Welcome to the Redux Toolkit Query tutorial! **This tutorial will briefly introduce you to Redux Toolkit's "RTK Query" data fetching capability and teach you how to start using it correctly**. +Welcome to the Redux Toolkit Query tutorial! **This tutorial will briefly introduce you to Redux Toolkit's "RTK Query" data fetching capability and teach you how to start using it correctly**. :::info diff --git a/docs/usage/migrating-rtk-2.md b/docs/usage/migrating-rtk-2.md index b537ec9d41..bbdedaa9bf 100644 --- a/docs/usage/migrating-rtk-2.md +++ b/docs/usage/migrating-rtk-2.md @@ -145,7 +145,7 @@ First, the `Reducer` type now has a `PreloadedState` possible generic: ```ts type Reducer = ( state: S | PreloadedState | undefined, - action: A + action: A, ) => S ``` @@ -319,7 +319,7 @@ const customCreateApi = buildCreateApi( useDispatch: createDispatchHook(MyContext), useSelector: createSelectorHook(MyContext), useStore: createStoreHook(MyContext), - }) + }), ) // now @@ -331,7 +331,7 @@ const customCreateApi = buildCreateApi( useSelector: createSelectorHook(MyContext), useStore: createStoreHook(MyContext), }, - }) + }), ) ``` @@ -406,7 +406,7 @@ const addNumbers = createSelector( // this input selector will always return a new reference when run // so cache will never be used (a, b) => ({ a, b }), - ({ a, b }) => ({ total: a + b }) + ({ a, b }) => ({ total: a + b }), ) // instead, you should have an input selector for each stable piece of data const addNumbersStable = createSelector( @@ -414,7 +414,7 @@ const addNumbersStable = createSelector( (a, b) => b, (a, b) => ({ total: a + b, - }) + }), ) ``` @@ -537,7 +537,7 @@ const combinedReducer = combineSlices( num: numberSlice.reducer, boolean: booleanReducer, }, - api + api, ) expect(combinedReducer(undefined, dummyAction())).toEqual({ string: stringSlice.getInitialState(), @@ -564,12 +564,12 @@ const injectedReducer = combinedReducer.inject(numberSlice) // `state.number` now exists, and injectedReducer's type no longer marks it as optional expect(injectedReducer(undefined, dummyAction()).number).toBe( - numberSlice.getInitialState() + numberSlice.getInitialState(), ) // original reducer has also been changed (type is still optional) expect(combinedReducer(undefined, dummyAction()).number).toBe( - numberSlice.getInitialState() + numberSlice.getInitialState(), ) ``` @@ -603,7 +603,7 @@ const customState = { number: slice.getInitialState(), } const { selectSlice, selectMultiple } = slice.getSelectors( - (state: typeof customState) => state.number + (state: typeof customState) => state.number, ) expect(selectSlice(customState)).toBe(slice.getInitialState()) expect(selectMultiple(customState, 2)).toBe(slice.getInitialState() * 2) @@ -620,7 +620,7 @@ const fetchUserById = createAsyncThunk( async (userId: number, thunkAPI) => { const response = await userAPI.fetchById(userId) return response.data - } + }, ) const usersSlice = createSlice({ @@ -682,7 +682,7 @@ const todosSlice = createAppSlice({ // action type is inferred from prepare callback (state, action) => { state.todos.push(action.payload) - } + }, ), // An async thunk fetchTodo: create.asyncThunk( @@ -706,7 +706,7 @@ const todosSlice = createAppSlice({ settled: (state, action) => { state.loading = false }, - } + }, ), }), }) @@ -872,7 +872,7 @@ For example, with `redux-observable`: const epic = (action$: Observable) => action$.pipe( ofType(todoAdded), - map((action) => action) + map((action) => action), // ^? still Action ) @@ -880,7 +880,7 @@ const epic = (action$: Observable) => const epic = (action$: Observable) => action$.pipe( filter(todoAdded.match), - map((action) => action) + map((action) => action), // ^? now PayloadAction ) ``` @@ -931,7 +931,7 @@ const asyncThunkCreator = { // the definition from define() definition, // methods to modify slice - context + context, ) { const { payloadCreator, options, pending, fulfilled, rejected, settled } = definition @@ -976,7 +976,7 @@ const todoSlice = createSlice({ selectTodosByAuthor = createSelector( (state: TodoState) => state.todos, (state: TodoState, author: string) => author, - (todos, author) => todos.filter((todo) => todo.author === author) + (todos, author) => todos.filter((todo) => todo.author === author), ), }, }) @@ -991,7 +991,7 @@ export const makeSelectTodosByAuthor = () => createSelector( (state: RootState) => state.todos.todos, (state: RootState, author: string) => author, - (todos, author) => todos.filter((todo) => todo.author === author) + (todos, author) => todos.filter((todo) => todo.author === author), ) function AuthorTodos({ author }: { author: string }) { diff --git a/docs/usage/migrating-to-modern-redux.mdx b/docs/usage/migrating-to-modern-redux.mdx index 57c4758b31..4241f2d22f 100644 --- a/docs/usage/migrating-to-modern-redux.mdx +++ b/docs/usage/migrating-to-modern-redux.mdx @@ -298,7 +298,7 @@ const todosSlice = createSlice({ // In this case, `action.payload` is the default field in the action, // and can hold the `id` value - no need for `action.id` separately const matchingTodo = state.todos.find( - (todo) => todo.id === action.payload + (todo) => todo.id === action.payload, ) if (matchingTodo) { @@ -796,7 +796,7 @@ const initialState: TodosState = [] export default function todosReducer( state = initialState, - action: TodoActions + action: TodoActions, ) { switch (action.type) { // omit reducer logic @@ -944,7 +944,7 @@ const mapDispatchToProps2 = (dispatch) => { todoDeleted, todoToggled, }, - dispatch + dispatch, ) } diff --git a/docs/usage/usage-guide.md b/docs/usage/usage-guide.md index 8baf6c938a..113c732a54 100644 --- a/docs/usage/usage-guide.md +++ b/docs/usage/usage-guide.md @@ -651,7 +651,7 @@ const fetchUserById = createAsyncThunk( async (userId, thunkAPI) => { const response = await userAPI.fetchById(userId) return response.data - } + }, ) // Then, handle actions in your reducers: @@ -1084,7 +1084,7 @@ ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ) ``` @@ -1137,10 +1137,10 @@ const store = configureStore({ ignoredActions: [ // just ignore every redux-firebase and react-redux-firebase action type ...Object.keys(rfConstants.actionTypes).map( - (type) => `${rfConstants.actionsPrefix}/${type}` + (type) => `${rfConstants.actionsPrefix}/${type}`, ), ...Object.keys(rrfActionTypes).map( - (type) => `@@reactReduxFirebase/${type}` + (type) => `@@reactReduxFirebase/${type}`, ), ], ignoredPaths: ['firebase', 'firestore'], diff --git a/docs/usage/usage-with-typescript.md b/docs/usage/usage-with-typescript.md index aadec00ccd..0194fd787e 100644 --- a/docs/usage/usage-with-typescript.md +++ b/docs/usage/usage-with-typescript.md @@ -122,7 +122,7 @@ const store = configureStore({ untypedMiddleware as Middleware< (action: Action<'specialAction'>) => number, RootState - > + >, ) // prepend and concat calls can be chained .concat(logger), @@ -213,7 +213,7 @@ createReducer(0, (builder) => }) .addCase(decrement, (state, action: PayloadAction) => { // this would error out - }) + }), ) ``` @@ -311,7 +311,7 @@ const blogSlice = createSlice({ receivedAll: { reducer( state, - action: PayloadAction + action: PayloadAction, ) { state.all = action.payload state.meta = action.meta @@ -364,7 +364,7 @@ const fetchUserById = createAsyncThunk( async (userId: number) => { const response = await fetch(`https://reqres.in/api/users/${userId}`) return (await response.json()) as Returned - } + }, ) interface UsersState { @@ -438,7 +438,7 @@ create.asyncThunk( error: 'Oh no!', }) } - } + }, ) ``` @@ -446,8 +446,9 @@ For common thunk API configuration options, a [`withTypes` helper](../usage/usag ```ts no-transpile reducers: (create) => { - const createAThunk = - create.asyncThunk.withTypes<{ rejectValue: { error: string } }>() + const createAThunk = create.asyncThunk.withTypes<{ + rejectValue: { error: string } + }>() return { fetchTodo: createAThunk(async (id, thunkApi) => { @@ -478,7 +479,7 @@ interface GenericState { const createGenericSlice = < T, - Reducers extends SliceCaseReducers> + Reducers extends SliceCaseReducers>, >({ name = '', initialState, @@ -547,7 +548,7 @@ const fetchUserById = createAsyncThunk( // Inferred return type: Promise // highlight-next-line return (await response.json()) as MyData - } + }, ) // the parameter of `fetchUserById` is automatically inferred to `number` here @@ -791,7 +792,7 @@ export const fetchArticle = createAsyncThunk( } >(data, articleEntity) return normalized.entities - } + }, ) export const slice = createSlice({ diff --git a/docs/virtual/matchers/index.ts b/docs/virtual/matchers/index.ts index 501de36c1f..ff1e4fdba5 100644 --- a/docs/virtual/matchers/index.ts +++ b/docs/virtual/matchers/index.ts @@ -1,7 +1,7 @@ import { createAsyncThunk, createReducer, - PayloadAction + PayloadAction, } from '@reduxjs/toolkit' export interface Data { @@ -18,13 +18,13 @@ export interface Interesting extends Data { } export function isSpecial( - action: PayloadAction + action: PayloadAction, ): action is PayloadAction { return action.payload.isSpecial } export function isInteresting( - action: PayloadAction + action: PayloadAction, ): action is PayloadAction { return action.payload.isInteresting } @@ -36,7 +36,7 @@ export interface ExampleState { export const initialState = { isSpecial: false, - isInteresting: false + isInteresting: false, } as ExampleState export const isSpecialAndInterestingThunk = createAsyncThunk( @@ -44,16 +44,16 @@ export const isSpecialAndInterestingThunk = createAsyncThunk( () => { return { isSpecial: true, - isInteresting: true + isInteresting: true, } - } + }, ) export const requestThunk1 = createAsyncThunk('requestThunk1', () => ({})) export const requestThunk2 = createAsyncThunk('requestThunk2', () => ({})) -export const loadingReducer = createReducer(initialState, builder => { +export const loadingReducer = createReducer(initialState, (builder) => { builder.addCase(isSpecialAndInterestingThunk.fulfilled, (state, action) => { if (isSpecial(action)) { state.isSpecial = true diff --git a/examples/action-listener/counter/public/index.html b/examples/action-listener/counter/public/index.html index c1b40227ed..5e1a99228a 100644 --- a/examples/action-listener/counter/public/index.html +++ b/examples/action-listener/counter/public/index.html @@ -1,26 +1,28 @@ - + - + Counter Example - Action Middleware -
- - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/advanced/src/Pokemon.tsx b/examples/query/react/advanced/src/Pokemon.tsx index 0506e6c79a..4e848e960b 100644 --- a/examples/query/react/advanced/src/Pokemon.tsx +++ b/examples/query/react/advanced/src/Pokemon.tsx @@ -11,7 +11,7 @@ export const Pokemon = ({ name, { pollingInterval, - } + }, ) return ( diff --git a/examples/query/react/advanced/src/index.tsx b/examples/query/react/advanced/src/index.tsx index b5a9e97285..568f62e54d 100644 --- a/examples/query/react/advanced/src/index.tsx +++ b/examples/query/react/advanced/src/index.tsx @@ -10,5 +10,5 @@ const reactRoot = ReactDOM.createRoot(rootElement as HTMLElement) reactRoot.render( - + , ) diff --git a/examples/query/react/advanced/tsconfig.json b/examples/query/react/advanced/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/advanced/tsconfig.json +++ b/examples/query/react/advanced/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/authentication-with-extrareducers/public/index.html b/examples/query/react/authentication-with-extrareducers/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/authentication-with-extrareducers/public/index.html +++ b/examples/query/react/authentication-with-extrareducers/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/authentication-with-extrareducers/src/features/auth/authSlice.tsx b/examples/query/react/authentication-with-extrareducers/src/features/auth/authSlice.tsx index 3c854bedad..dfbc2182ec 100644 --- a/examples/query/react/authentication-with-extrareducers/src/features/auth/authSlice.tsx +++ b/examples/query/react/authentication-with-extrareducers/src/features/auth/authSlice.tsx @@ -17,7 +17,7 @@ const slice = createSlice({ (state, { payload }) => { state.token = payload.token state.user = payload.user - } + }, ) }, }) diff --git a/examples/query/react/authentication-with-extrareducers/src/index.tsx b/examples/query/react/authentication-with-extrareducers/src/index.tsx index 2bf5b85aa3..2b302a9654 100644 --- a/examples/query/react/authentication-with-extrareducers/src/index.tsx +++ b/examples/query/react/authentication-with-extrareducers/src/index.tsx @@ -20,6 +20,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/authentication-with-extrareducers/src/mocks/handlers.ts b/examples/query/react/authentication-with-extrareducers/src/mocks/handlers.ts index 7415cb72fd..4efb7fdf88 100644 --- a/examples/query/react/authentication-with-extrareducers/src/mocks/handlers.ts +++ b/examples/query/react/authentication-with-extrareducers/src/mocks/handlers.ts @@ -11,14 +11,14 @@ export const handlers = [ ctx.json({ message: 'You shall not pass. Please login first.', }), - ctx.status(401) + ctx.status(401), ) } return res( ctx.json({ message: 'Join us on the Reactiflux Discord server in #redux if you have any questions.', - }) + }), ) }), rest.post('/login', (req, res, ctx) => { @@ -30,7 +30,7 @@ export const handlers = [ last_name: 'User', }, token, - }) + }), ) }), ] diff --git a/examples/query/react/authentication-with-extrareducers/tsconfig.json b/examples/query/react/authentication-with-extrareducers/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/authentication-with-extrareducers/tsconfig.json +++ b/examples/query/react/authentication-with-extrareducers/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/authentication/public/index.html b/examples/query/react/authentication/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/authentication/public/index.html +++ b/examples/query/react/authentication/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/authentication/src/features/auth/authSlice.tsx b/examples/query/react/authentication/src/features/auth/authSlice.tsx index 76fde9f03c..c7d17c0bd5 100644 --- a/examples/query/react/authentication/src/features/auth/authSlice.tsx +++ b/examples/query/react/authentication/src/features/auth/authSlice.tsx @@ -14,7 +14,9 @@ const slice = createSlice({ reducers: { setCredentials: ( state, - { payload: { user, token } }: PayloadAction<{ user: User; token: string }> + { + payload: { user, token }, + }: PayloadAction<{ user: User; token: string }>, ) => { state.user = user state.token = token diff --git a/examples/query/react/authentication/src/index.tsx b/examples/query/react/authentication/src/index.tsx index b55e344e50..25df0f6d58 100644 --- a/examples/query/react/authentication/src/index.tsx +++ b/examples/query/react/authentication/src/index.tsx @@ -12,7 +12,7 @@ worker .start({ quiet: true }) .then(() => { const rootNode = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ) return rootNode.render( @@ -24,7 +24,7 @@ worker - + , ) }) .catch(console.error) diff --git a/examples/query/react/authentication/src/mocks/handlers.ts b/examples/query/react/authentication/src/mocks/handlers.ts index 7415cb72fd..4efb7fdf88 100644 --- a/examples/query/react/authentication/src/mocks/handlers.ts +++ b/examples/query/react/authentication/src/mocks/handlers.ts @@ -11,14 +11,14 @@ export const handlers = [ ctx.json({ message: 'You shall not pass. Please login first.', }), - ctx.status(401) + ctx.status(401), ) } return res( ctx.json({ message: 'Join us on the Reactiflux Discord server in #redux if you have any questions.', - }) + }), ) }), rest.post('/login', (req, res, ctx) => { @@ -30,7 +30,7 @@ export const handlers = [ last_name: 'User', }, token, - }) + }), ) }), ] diff --git a/examples/query/react/authentication/tsconfig.json b/examples/query/react/authentication/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/authentication/tsconfig.json +++ b/examples/query/react/authentication/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/basic/public/index.html b/examples/query/react/basic/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/basic/public/index.html +++ b/examples/query/react/basic/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/basic/src/App.test.tsx b/examples/query/react/basic/src/App.test.tsx index 3225b3e090..4fd1a19675 100644 --- a/examples/query/react/basic/src/App.test.tsx +++ b/examples/query/react/basic/src/App.test.tsx @@ -18,7 +18,7 @@ describe('App', () => { }) as HTMLImageElement expect(img.src).toBe( - 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png' + 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png', ) }) @@ -29,8 +29,8 @@ describe('App', () => { 'https://pokeapi.co/api/v2/pokemon/bulbasaur', (req, res, ctx) => { return res(ctx.status(500)) - } - ) + }, + ), ) renderWithProviders() diff --git a/examples/query/react/basic/src/index.tsx b/examples/query/react/basic/src/index.tsx index 970d6ba2b4..589c537b24 100644 --- a/examples/query/react/basic/src/index.tsx +++ b/examples/query/react/basic/src/index.tsx @@ -7,10 +7,10 @@ import { setupStore } from './store' const store = setupStore() const reactRoot = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ) reactRoot.render( - + , ) diff --git a/examples/query/react/basic/src/test/test-utils.tsx b/examples/query/react/basic/src/test/test-utils.tsx index cf36650812..1e90c11a87 100644 --- a/examples/query/react/basic/src/test/test-utils.tsx +++ b/examples/query/react/basic/src/test/test-utils.tsx @@ -21,7 +21,7 @@ function renderWithProviders( preloadedState = {}, store = setupStore(preloadedState), ...renderOptions - }: ExtendedRenderOptions = {} + }: ExtendedRenderOptions = {}, ) { function Wrapper({ children }: PropsWithChildren<{}>): JSX.Element { return {children} diff --git a/examples/query/react/basic/tsconfig.json b/examples/query/react/basic/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/basic/tsconfig.json +++ b/examples/query/react/basic/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/conditional-fetching/public/index.html b/examples/query/react/conditional-fetching/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/conditional-fetching/public/index.html +++ b/examples/query/react/conditional-fetching/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/conditional-fetching/src/Pokemon.tsx b/examples/query/react/conditional-fetching/src/Pokemon.tsx index 2e2b9549a9..077d11a4b5 100644 --- a/examples/query/react/conditional-fetching/src/Pokemon.tsx +++ b/examples/query/react/conditional-fetching/src/Pokemon.tsx @@ -8,7 +8,7 @@ export const Pokemon = ({ name }: { name: PokemonName }) => { name, { skip, - } + }, ) const SkipToggle = () => ( diff --git a/examples/query/react/conditional-fetching/src/index.tsx b/examples/query/react/conditional-fetching/src/index.tsx index 1af4cef9e5..b455864950 100644 --- a/examples/query/react/conditional-fetching/src/index.tsx +++ b/examples/query/react/conditional-fetching/src/index.tsx @@ -5,10 +5,10 @@ import App from './App' import { store } from './store' const reactRoot = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ) reactRoot.render( - + , ) diff --git a/examples/query/react/conditional-fetching/src/pokemon.data.ts b/examples/query/react/conditional-fetching/src/pokemon.data.ts index 1617ce9e50..22eb3a0547 100644 --- a/examples/query/react/conditional-fetching/src/pokemon.data.ts +++ b/examples/query/react/conditional-fetching/src/pokemon.data.ts @@ -152,4 +152,4 @@ export const POKEMON_NAMES = [ 'mew', ] as const -export type PokemonName = typeof POKEMON_NAMES[number] +export type PokemonName = (typeof POKEMON_NAMES)[number] diff --git a/examples/query/react/conditional-fetching/tsconfig.json b/examples/query/react/conditional-fetching/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/conditional-fetching/tsconfig.json +++ b/examples/query/react/conditional-fetching/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/deduping-queries/public/index.html b/examples/query/react/deduping-queries/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/deduping-queries/public/index.html +++ b/examples/query/react/deduping-queries/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/deduping-queries/src/Pokemon.tsx b/examples/query/react/deduping-queries/src/Pokemon.tsx index 624602f3a9..73e71925bd 100644 --- a/examples/query/react/deduping-queries/src/Pokemon.tsx +++ b/examples/query/react/deduping-queries/src/Pokemon.tsx @@ -1,13 +1,8 @@ import { useGetPokemonByNameQuery } from './services/pokemon' export const Pokemon = ({ name }: { name: string }) => { - const { - data, - error, - isLoading, - isFetching, - refetch, - } = useGetPokemonByNameQuery(name) + const { data, error, isLoading, isFetching, refetch } = + useGetPokemonByNameQuery(name) return (
diff --git a/examples/query/react/deduping-queries/src/index.tsx b/examples/query/react/deduping-queries/src/index.tsx index 0924558a7d..b36d809053 100644 --- a/examples/query/react/deduping-queries/src/index.tsx +++ b/examples/query/react/deduping-queries/src/index.tsx @@ -5,11 +5,11 @@ import App from './App' import { store } from './store' const reactRoot = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ) reactRoot.render( - + , ) diff --git a/examples/query/react/deduping-queries/tsconfig.json b/examples/query/react/deduping-queries/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/deduping-queries/tsconfig.json +++ b/examples/query/react/deduping-queries/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/graphql-codegen/.introspection.json b/examples/query/react/graphql-codegen/.introspection.json index 00aa67088e..732fa070df 100644 --- a/examples/query/react/graphql-codegen/.introspection.json +++ b/examples/query/react/graphql-codegen/.introspection.json @@ -1704,11 +1704,7 @@ "name": "include", "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", "isRepeatable": false, - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], "args": [ { "name": "if", @@ -1732,11 +1728,7 @@ "name": "skip", "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", "isRepeatable": false, - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], "args": [ { "name": "if", @@ -1785,9 +1777,7 @@ "name": "specifiedBy", "description": "Exposes a URL that specifies the behaviour of this scalar.", "isRepeatable": false, - "locations": [ - "SCALAR" - ], + "locations": ["SCALAR"], "args": [ { "name": "url", @@ -1809,4 +1799,4 @@ } ] } -} \ No newline at end of file +} diff --git a/examples/query/react/graphql-codegen/public/index.html b/examples/query/react/graphql-codegen/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/graphql-codegen/public/index.html +++ b/examples/query/react/graphql-codegen/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/graphql-codegen/src/app/services/types.generated.ts b/examples/query/react/graphql-codegen/src/app/services/types.generated.ts index f1f88bfc20..399ebbd2c9 100644 --- a/examples/query/react/graphql-codegen/src/app/services/types.generated.ts +++ b/examples/query/react/graphql-codegen/src/app/services/types.generated.ts @@ -1,119 +1,118 @@ -export type Maybe = T; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type Maybe = T +export type Exact = { + [K in keyof T]: T[K] +} +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe +} +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe +} /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: string; - String: string; - Boolean: boolean; - Int: number; - Float: number; -}; + ID: string + String: string + Boolean: boolean + Int: number + Float: number +} export type IdQueryType = { - equals?: Maybe; - notEquals?: Maybe; - contains?: Maybe; - notContains?: Maybe; - in?: Maybe; - notIn?: Maybe; -}; + equals?: Maybe + notEquals?: Maybe + contains?: Maybe + notContains?: Maybe + in?: Maybe + notIn?: Maybe +} export type Mutation = { - __typename?: 'Mutation'; - createPost?: Maybe; - updatePost?: Maybe; - updatePosts?: Maybe>>; - deletePost?: Maybe; - deletePosts?: Maybe>>; -}; - + __typename?: 'Mutation' + createPost?: Maybe + updatePost?: Maybe + updatePosts?: Maybe>> + deletePost?: Maybe + deletePosts?: Maybe>> +} export type MutationCreatePostArgs = { - data?: Maybe; -}; - + data?: Maybe +} export type MutationUpdatePostArgs = { - where?: Maybe; - data?: Maybe; -}; - + where?: Maybe + data?: Maybe +} export type MutationUpdatePostsArgs = { - where?: Maybe; - data?: Maybe; -}; - + where?: Maybe + data?: Maybe +} export type MutationDeletePostArgs = { - where?: Maybe; -}; - + where?: Maybe +} export type MutationDeletePostsArgs = { - where?: Maybe; -}; + where?: Maybe +} export type Post = { - __typename?: 'Post'; - id?: Maybe; - name?: Maybe; - title?: Maybe; - author?: Maybe; - content?: Maybe; - status?: Maybe; - created_at?: Maybe; - updated_at?: Maybe; -}; + __typename?: 'Post' + id?: Maybe + name?: Maybe + title?: Maybe + author?: Maybe + content?: Maybe + status?: Maybe + created_at?: Maybe + updated_at?: Maybe +} export type PostInput = { - id?: Maybe; - name?: Maybe; - title?: Maybe; - author?: Maybe; - content?: Maybe; - status?: Maybe; - created_at?: Maybe; - updated_at?: Maybe; -}; + id?: Maybe + name?: Maybe + title?: Maybe + author?: Maybe + content?: Maybe + status?: Maybe + created_at?: Maybe + updated_at?: Maybe +} export type PostQueryInput = { - id?: Maybe; - name?: Maybe; - title?: Maybe; - author?: Maybe; - content?: Maybe; - status?: Maybe; - created_at?: Maybe; - updated_at?: Maybe; -}; + id?: Maybe + name?: Maybe + title?: Maybe + author?: Maybe + content?: Maybe + status?: Maybe + created_at?: Maybe + updated_at?: Maybe +} export type Query = { - __typename?: 'Query'; - post?: Maybe; - posts?: Maybe>>; -}; - + __typename?: 'Query' + post?: Maybe + posts?: Maybe>> +} export type QueryPostArgs = { - where?: Maybe; -}; - + where?: Maybe +} export type QueryPostsArgs = { - take?: Maybe; - skip?: Maybe; - cursor?: Maybe; - where?: Maybe; -}; + take?: Maybe + skip?: Maybe + cursor?: Maybe + where?: Maybe +} export type StringQueryType = { - equals?: Maybe; - notEquals?: Maybe; - contains?: Maybe; - notContains?: Maybe; - in?: Maybe; - notIn?: Maybe; -}; + equals?: Maybe + notEquals?: Maybe + contains?: Maybe + notContains?: Maybe + in?: Maybe + notIn?: Maybe +} diff --git a/examples/query/react/graphql-codegen/src/features/posts/GetPost.generated.ts b/examples/query/react/graphql-codegen/src/features/posts/GetPost.generated.ts index 17a3fd7999..0ed9677e3c 100644 --- a/examples/query/react/graphql-codegen/src/features/posts/GetPost.generated.ts +++ b/examples/query/react/graphql-codegen/src/features/posts/GetPost.generated.ts @@ -9,23 +9,19 @@ * for this file to be re-created */ -import * as Types from '../../app/services/types.generated'; +import * as Types from '../../app/services/types.generated' -import { api } from 'app/services/baseApi'; -module.hot?.accept(); +import { api } from 'app/services/baseApi' +module.hot?.accept() export type GetPostQueryVariables = Types.Exact<{ - id: Types.Scalars['ID']; -}>; - - -export type GetPostQuery = ( - { __typename?: 'Query' } - & { post?: Types.Maybe<( - { __typename?: 'Post' } - & Pick - )> } -); + id: Types.Scalars['ID'] +}> +export type GetPostQuery = { __typename?: 'Query' } & { + post?: Types.Maybe< + { __typename?: 'Post' } & Pick + > +} export const GetPostDocument = ` query GetPost($id: ID!) { @@ -35,17 +31,16 @@ export const GetPostDocument = ` content } } - `; + ` const injectedRtkApi = api.injectEndpoints({ - overrideExisting: module.hot?.status() === "apply", + overrideExisting: module.hot?.status() === 'apply', endpoints: (build) => ({ GetPost: build.query({ - query: (variables) => ({ document: GetPostDocument, variables }) + query: (variables) => ({ document: GetPostDocument, variables }), }), }), -}); - -export { injectedRtkApi as api }; -export const { useGetPostQuery, useLazyGetPostQuery } = injectedRtkApi; +}) +export { injectedRtkApi as api } +export const { useGetPostQuery, useLazyGetPostQuery } = injectedRtkApi diff --git a/examples/query/react/graphql-codegen/src/features/posts/GetPosts.generated.ts b/examples/query/react/graphql-codegen/src/features/posts/GetPosts.generated.ts index 79c42956e0..6efed203a6 100644 --- a/examples/query/react/graphql-codegen/src/features/posts/GetPosts.generated.ts +++ b/examples/query/react/graphql-codegen/src/features/posts/GetPosts.generated.ts @@ -9,24 +9,24 @@ * for this file to be re-created */ -import * as Types from '../../app/services/types.generated'; +import * as Types from '../../app/services/types.generated' -import { api } from 'app/services/baseApi'; -module.hot?.accept(); +import { api } from 'app/services/baseApi' +module.hot?.accept() export type GetPostsQueryVariables = Types.Exact<{ - skip?: Types.Maybe; - take?: Types.Maybe; -}>; - - -export type GetPostsQuery = ( - { __typename?: 'Query' } - & { posts?: Types.Maybe - )>>> } -); - + skip?: Types.Maybe + take?: Types.Maybe +}> + +export type GetPostsQuery = { __typename?: 'Query' } & { + posts?: Types.Maybe< + Array< + Types.Maybe< + { __typename?: 'Post' } & Pick + > + > + > +} export const GetPostsDocument = ` query GetPosts($skip: Int = 0, $take: Int = 10) { @@ -36,17 +36,16 @@ export const GetPostsDocument = ` status } } - `; + ` const injectedRtkApi = api.injectEndpoints({ - overrideExisting: module.hot?.status() === "apply", + overrideExisting: module.hot?.status() === 'apply', endpoints: (build) => ({ GetPosts: build.query({ - query: (variables) => ({ document: GetPostsDocument, variables }) + query: (variables) => ({ document: GetPostsDocument, variables }), }), }), -}); - -export { injectedRtkApi as api }; -export const { useGetPostsQuery, useLazyGetPostsQuery } = injectedRtkApi; +}) +export { injectedRtkApi as api } +export const { useGetPostsQuery, useLazyGetPostsQuery } = injectedRtkApi diff --git a/examples/query/react/graphql-codegen/src/features/posts/PostsManager.tsx b/examples/query/react/graphql-codegen/src/features/posts/PostsManager.tsx index 907d412679..9eefa7bf48 100644 --- a/examples/query/react/graphql-codegen/src/features/posts/PostsManager.tsx +++ b/examples/query/react/graphql-codegen/src/features/posts/PostsManager.tsx @@ -23,8 +23,8 @@ const getColorForStatus = (status: string | undefined) => { return status === 'draft' ? 'gray' : status === 'pending_review' - ? 'orange' - : 'green' + ? 'orange' + : 'green' } const PostList = () => { diff --git a/examples/query/react/graphql-codegen/src/index.tsx b/examples/query/react/graphql-codegen/src/index.tsx index 88e4ff607c..a3f9271c5c 100644 --- a/examples/query/react/graphql-codegen/src/index.tsx +++ b/examples/query/react/graphql-codegen/src/index.tsx @@ -11,7 +11,7 @@ import { ApiProvider } from '@reduxjs/toolkit/query/react' // Initialize the msw worker, wait for the service worker registration to resolve, then mount worker.start({ quiet: true }).then(() => { return ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ).render( @@ -21,6 +21,6 @@ worker.start({ quiet: true }).then(() => { - + , ) }) diff --git a/examples/query/react/graphql-codegen/src/mocks/db.ts b/examples/query/react/graphql-codegen/src/mocks/db.ts index fededb9d62..78341ab30a 100644 --- a/examples/query/react/graphql-codegen/src/mocks/db.ts +++ b/examples/query/react/graphql-codegen/src/mocks/db.ts @@ -9,7 +9,7 @@ interface Post { title: string author: string content: string - status: typeof postStatuses[number] + status: (typeof postStatuses)[number] created_at: string updated_at: string } diff --git a/examples/query/react/graphql-codegen/tsconfig.json b/examples/query/react/graphql-codegen/tsconfig.json index 93e52d5db1..16a99dca49 100644 --- a/examples/query/react/graphql-codegen/tsconfig.json +++ b/examples/query/react/graphql-codegen/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -21,6 +16,6 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "baseUrl": "src" - } + "baseUrl": "src", + }, } diff --git a/examples/query/react/graphql/public/index.html b/examples/query/react/graphql/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/graphql/public/index.html +++ b/examples/query/react/graphql/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/graphql/src/app/services/posts.ts b/examples/query/react/graphql/src/app/services/posts.ts index fbbcf0de02..0d84c75f2c 100644 --- a/examples/query/react/graphql/src/app/services/posts.ts +++ b/examples/query/react/graphql/src/app/services/posts.ts @@ -1,6 +1,6 @@ -import { createApi } from '@reduxjs/toolkit/query/react' +import { createApi } from '@reduxjs/toolkit/query/react' import { gql } from 'graphql-request' -import {graphqlRequestBaseQuery} from '@rtk-query/graphql-request-base-query' +import { graphqlRequestBaseQuery } from '@rtk-query/graphql-request-base-query' export const postStatuses = ['draft', 'published', 'pending_review'] as const @@ -9,7 +9,7 @@ export interface Post { title: string author: string content: string - status: typeof postStatuses[number] + status: (typeof postStatuses)[number] created_at: string updated_at: string } diff --git a/examples/query/react/graphql/src/features/posts/PostsManager.tsx b/examples/query/react/graphql/src/features/posts/PostsManager.tsx index e16e6ac46c..8203ed4b3b 100644 --- a/examples/query/react/graphql/src/features/posts/PostsManager.tsx +++ b/examples/query/react/graphql/src/features/posts/PostsManager.tsx @@ -23,8 +23,8 @@ const getColorForStatus = (status: Post['status']) => { return status === 'draft' ? 'gray' : status === 'pending_review' - ? 'orange' - : 'green' + ? 'orange' + : 'green' } const PostList = () => { diff --git a/examples/query/react/graphql/src/index.tsx b/examples/query/react/graphql/src/index.tsx index a7429fe087..db33bb49a1 100644 --- a/examples/query/react/graphql/src/index.tsx +++ b/examples/query/react/graphql/src/index.tsx @@ -11,7 +11,7 @@ import { ApiProvider } from '@reduxjs/toolkit/query/react' // Initialize the msw worker, wait for the service worker registration to resolve, then mount worker.start({ quiet: true }).then(() => { return ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ).render( @@ -21,6 +21,6 @@ worker.start({ quiet: true }).then(() => { - + , ) }) diff --git a/examples/query/react/graphql/src/mocks/db.ts b/examples/query/react/graphql/src/mocks/db.ts index 0aa6a3c2a4..2ba757e6fe 100644 --- a/examples/query/react/graphql/src/mocks/db.ts +++ b/examples/query/react/graphql/src/mocks/db.ts @@ -37,7 +37,8 @@ const createPostData = (): Post => { ;[...new Array(50)].forEach((_) => db.post.create(createPostData())) type PaginationOptions = { - page: number; per_page: number + page: number + per_page: number } interface Posts extends Pagination { @@ -52,19 +53,19 @@ export const handlers = [ const posts = db.post.findMany({ take: per_page, - skip: Math.max(per_page * (page - 1), 0) + skip: Math.max(per_page * (page - 1), 0), }) return res( ctx.data({ data: { - posts + posts, } as { posts: Post[] }, per_page, page, total_pages: Math.ceil(db.post.count() / per_page), total: db.post.count(), - }) + }), ) }), ...db.post.toHandlers('graphql'), diff --git a/examples/query/react/graphql/tsconfig.json b/examples/query/react/graphql/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/graphql/tsconfig.json +++ b/examples/query/react/graphql/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/kitchen-sink/public/index.html b/examples/query/react/kitchen-sink/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/kitchen-sink/public/index.html +++ b/examples/query/react/kitchen-sink/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/kitchen-sink/src/app/services/api.ts b/examples/query/react/kitchen-sink/src/app/services/api.ts index e9c9ab0c56..0cd4e2e692 100644 --- a/examples/query/react/kitchen-sink/src/app/services/api.ts +++ b/examples/query/react/kitchen-sink/src/app/services/api.ts @@ -20,7 +20,7 @@ const baseQueryWithRetry = retry(baseQuery, { maxRetries: 6 }) * Create a base API to inject endpoints into elsewhere. * Components using this API should import from the injected site, * in order to get the appropriate types, - * and to ensure that the file injecting the endpoints is loaded + * and to ensure that the file injecting the endpoints is loaded */ export const api = createApi({ /** diff --git a/examples/query/react/kitchen-sink/src/app/services/posts.ts b/examples/query/react/kitchen-sink/src/app/services/posts.ts index 08204d0062..04293c4237 100644 --- a/examples/query/react/kitchen-sink/src/app/services/posts.ts +++ b/examples/query/react/kitchen-sink/src/app/services/posts.ts @@ -34,7 +34,7 @@ export const postsApi = api.injectEndpoints({ getPosts: build.query({ query: () => ({ url: 'posts' }), providesTags: (result = []) => [ - ...result.map(({ id }) => ({ type: 'Posts', id } as const)), + ...result.map(({ id }) => ({ type: 'Posts', id }) as const), { type: 'Posts' as const, id: 'LIST' }, ], }), diff --git a/examples/query/react/kitchen-sink/src/app/store.ts b/examples/query/react/kitchen-sink/src/app/store.ts index 82232113dc..e814615c9f 100644 --- a/examples/query/react/kitchen-sink/src/app/store.ts +++ b/examples/query/react/kitchen-sink/src/app/store.ts @@ -5,7 +5,7 @@ import polling from '../features/polling/pollingSlice' import auth from '../features/auth/authSlice' export const createStore = ( - options?: ConfigureStoreOptions['preloadedState'] | undefined + options?: ConfigureStoreOptions['preloadedState'] | undefined, ) => configureStore({ reducer: { diff --git a/examples/query/react/kitchen-sink/src/features/bundleSplitting/Post.tsx b/examples/query/react/kitchen-sink/src/features/bundleSplitting/Post.tsx index ececa81173..fe7de3c6cb 100644 --- a/examples/query/react/kitchen-sink/src/features/bundleSplitting/Post.tsx +++ b/examples/query/react/kitchen-sink/src/features/bundleSplitting/Post.tsx @@ -16,10 +16,7 @@ const Post = ({ id }: { id: number }) => { * This missing would be a programming error that you should * catch early anyways. */ - assert( - postApi.endpoints.getPost?.useQuery, - 'Endpoint `getPost` not loaded!' - ) + assert(postApi.endpoints.getPost?.useQuery, 'Endpoint `getPost` not loaded!') const { data, error } = postApi.endpoints.getPost.useQuery(id) return error ? ( <>there was an error diff --git a/examples/query/react/kitchen-sink/src/features/bundleSplitting/PostsList.tsx b/examples/query/react/kitchen-sink/src/features/bundleSplitting/PostsList.tsx index fc9452a7c5..2c8539fe9a 100644 --- a/examples/query/react/kitchen-sink/src/features/bundleSplitting/PostsList.tsx +++ b/examples/query/react/kitchen-sink/src/features/bundleSplitting/PostsList.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; +import * as React from 'react' -import { Post } from '.'; -import { postsApi } from '../../app/services/posts'; +import { Post } from '.' +import { postsApi } from '../../app/services/posts' const PostsList = () => { /** @@ -13,8 +13,8 @@ const PostsList = () => { * injected though. */ - const { data, error } = postsApi.endpoints.getPosts.useQuery(); - const [selected, select] = React.useState(); + const { data, error } = postsApi.endpoints.getPosts.useQuery() + const [selected, select] = React.useState() return error ? ( <>there was an error ) : !data ? ( @@ -30,6 +30,6 @@ const PostsList = () => { ))} - ); -}; -export default PostsList; + ) +} +export default PostsList diff --git a/examples/query/react/kitchen-sink/src/features/counter/Counter.module.css b/examples/query/react/kitchen-sink/src/features/counter/Counter.module.css index 2ba30ae792..7e60ca1c7f 100644 --- a/examples/query/react/kitchen-sink/src/features/counter/Counter.module.css +++ b/examples/query/react/kitchen-sink/src/features/counter/Counter.module.css @@ -13,7 +13,7 @@ padding-left: 16px; padding-right: 16px; margin-top: 2px; - font-family: "Courier New", Courier, monospace; + font-family: 'Courier New', Courier, monospace; } .button { @@ -56,7 +56,7 @@ } .asyncButton:after { - content: ""; + content: ''; background-color: rgba(112, 76, 182, 0.15); display: block; position: absolute; @@ -65,7 +65,9 @@ left: 0; top: 0; opacity: 0; - transition: width 1s linear, opacity 0.5s ease 1s; + transition: + width 1s linear, + opacity 0.5s ease 1s; } .asyncButton:active:after { diff --git a/examples/query/react/kitchen-sink/src/features/counter/Counter.tsx b/examples/query/react/kitchen-sink/src/features/counter/Counter.tsx index c192e40ca2..ed8c5bf357 100644 --- a/examples/query/react/kitchen-sink/src/features/counter/Counter.tsx +++ b/examples/query/react/kitchen-sink/src/features/counter/Counter.tsx @@ -1,32 +1,52 @@ -import React, { useState } from 'react'; -import styles from './Counter.module.css'; -import { useDecrementCountMutation, useGetCountQuery, useIncrementCountMutation } from '../../app/services/counter'; +import React, { useState } from 'react' +import styles from './Counter.module.css' +import { + useDecrementCountMutation, + useGetCountQuery, + useIncrementCountMutation, +} from '../../app/services/counter' -export function Counter({ id, onRemove }: { id?: string; onRemove?: () => void }) { - const [pollingInterval, setPollingInterval] = useState(10000); - const { data } = useGetCountQuery(undefined, { pollingInterval }); - const [increment] = useIncrementCountMutation(); +export function Counter({ + id, + onRemove, +}: { + id?: string + onRemove?: () => void +}) { + const [pollingInterval, setPollingInterval] = useState(10000) + const { data } = useGetCountQuery(undefined, { pollingInterval }) + const [increment] = useIncrementCountMutation() - const [decrement] = useDecrementCountMutation(); + const [decrement] = useDecrementCountMutation() return (
- {data?.count || 0} - setPollingInterval(valueAsNumber)} + onChange={({ target: { valueAsNumber } }) => + setPollingInterval(valueAsNumber) + } /> {onRemove && }
- ); + ) } diff --git a/examples/query/react/kitchen-sink/src/features/counter/CounterList.tsx b/examples/query/react/kitchen-sink/src/features/counter/CounterList.tsx index e917b72140..acf946b93b 100644 --- a/examples/query/react/kitchen-sink/src/features/counter/CounterList.tsx +++ b/examples/query/react/kitchen-sink/src/features/counter/CounterList.tsx @@ -1,30 +1,38 @@ -import * as React from 'react'; -import { nanoid } from '@reduxjs/toolkit'; -import { Container } from '../common/Container'; -import { Counter } from './Counter'; +import * as React from 'react' +import { nanoid } from '@reduxjs/toolkit' +import { Container } from '../common/Container' +import { Counter } from './Counter' export const CounterList = () => { - const [counters, setCounters] = React.useState([]); + const [counters, setCounters] = React.useState([]) if (!counters.length) { return (
No counters, why don't you add one?
- +
- ); + ) } return (
- +
{counters.map((id) => ( - setCounters((prev) => prev.filter((el) => el !== id))} /> + setCounters((prev) => prev.filter((el) => el !== id))} + /> ))}
- ); -}; + ) +} diff --git a/examples/query/react/kitchen-sink/src/features/polling/PollingToggles.tsx b/examples/query/react/kitchen-sink/src/features/polling/PollingToggles.tsx index dca03216bd..c67ddc7910 100644 --- a/examples/query/react/kitchen-sink/src/features/polling/PollingToggles.tsx +++ b/examples/query/react/kitchen-sink/src/features/polling/PollingToggles.tsx @@ -1,47 +1,59 @@ -import * as React from 'react'; -import { useAppDispatch, useTypedSelector } from '../../app/store'; +import * as React from 'react' +import { useAppDispatch, useTypedSelector } from '../../app/store' import { selectGlobalPollingEnabled, selectPollingConfigByApp, toggleGlobalPolling, updatePolling, -} from './pollingSlice'; +} from './pollingSlice' const PollingToggleButton = ({ enabled, onClick, children, }: { - onClick: () => void; - enabled: boolean; - children?: React.ReactNode; + onClick: () => void + enabled: boolean + children?: React.ReactNode }) => { return ( - - ); -}; + ) +} export const PollingToggles = () => { - const dispatch = useAppDispatch(); - const globalPolling = useTypedSelector(selectGlobalPollingEnabled); - const timesPolling = useTypedSelector((state) => selectPollingConfigByApp(state, 'times')); + const dispatch = useAppDispatch() + const globalPolling = useTypedSelector(selectGlobalPollingEnabled) + const timesPolling = useTypedSelector((state) => + selectPollingConfigByApp(state, 'times'), + ) return (
Global Polling Configs
- dispatch(toggleGlobalPolling())}> + dispatch(toggleGlobalPolling())} + > Global dispatch(updatePolling({ app: 'times', enabled: !timesPolling.enabled }))} + onClick={() => + dispatch( + updatePolling({ app: 'times', enabled: !timesPolling.enabled }), + ) + } > Times
- ); -}; + ) +} diff --git a/examples/query/react/kitchen-sink/src/features/polling/pollingSlice.ts b/examples/query/react/kitchen-sink/src/features/polling/pollingSlice.ts index e193c3ba01..0a43c7a474 100644 --- a/examples/query/react/kitchen-sink/src/features/polling/pollingSlice.ts +++ b/examples/query/react/kitchen-sink/src/features/polling/pollingSlice.ts @@ -1,17 +1,17 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import type { RootState } from '../../app/store'; +import { createSlice, PayloadAction } from '@reduxjs/toolkit' +import type { RootState } from '../../app/store' type PollingConfig = { - enabled: boolean; - interval: number; -}; + enabled: boolean + interval: number +} type SliceState = { - enabled: boolean; + enabled: boolean apps: { - [key: string]: PollingConfig; - }; -}; + [key: string]: PollingConfig + } +} const initialState: SliceState = { enabled: true, @@ -29,39 +29,43 @@ const initialState: SliceState = { interval: 0, }, }, -}; +} -type PollingAppKey = keyof typeof initialState['apps']; +type PollingAppKey = keyof (typeof initialState)['apps'] const slice = createSlice({ name: 'polling', initialState, reducers: { toggleGlobalPolling(state) { - state.enabled = !state.enabled; + state.enabled = !state.enabled }, updatePolling( state, { payload, }: PayloadAction<{ - app: PollingAppKey; - enabled?: boolean; - interval?: number; - }> + app: PollingAppKey + enabled?: boolean + interval?: number + }>, ) { - const { app, ...rest } = payload; + const { app, ...rest } = payload state.apps[app] = { ...state.apps[app], ...rest, - }; + } }, }, -}); +}) -export const { toggleGlobalPolling, updatePolling } = slice.actions; +export const { toggleGlobalPolling, updatePolling } = slice.actions -export default slice.reducer; +export default slice.reducer -export const selectGlobalPollingEnabled = (state: RootState) => state.polling.enabled; -export const selectPollingConfigByApp = (state: RootState, app: PollingAppKey) => state.polling.apps[app]; +export const selectGlobalPollingEnabled = (state: RootState) => + state.polling.enabled +export const selectPollingConfigByApp = ( + state: RootState, + app: PollingAppKey, +) => state.polling.apps[app] diff --git a/examples/query/react/kitchen-sink/src/features/time/TimeList.tsx b/examples/query/react/kitchen-sink/src/features/time/TimeList.tsx index 08f3b7f99c..ecca7ca3bf 100644 --- a/examples/query/react/kitchen-sink/src/features/time/TimeList.tsx +++ b/examples/query/react/kitchen-sink/src/features/time/TimeList.tsx @@ -1,10 +1,13 @@ -import * as React from 'react'; -import { nanoid } from '@reduxjs/toolkit'; -import { useEffect } from 'react'; -import { useGetTimeQuery, usePrefetchTime } from '../../app/services/times'; -import { Container } from '../common/Container'; -import { useTypedSelector } from '../../app/store'; -import { selectGlobalPollingEnabled, selectPollingConfigByApp } from '../polling/pollingSlice'; +import * as React from 'react' +import { nanoid } from '@reduxjs/toolkit' +import { useEffect } from 'react' +import { useGetTimeQuery, usePrefetchTime } from '../../app/services/times' +import { Container } from '../common/Container' +import { useTypedSelector } from '../../app/store' +import { + selectGlobalPollingEnabled, + selectPollingConfigByApp, +} from '../polling/pollingSlice' const timezones: Record = { '-12:00': '(GMT -12:00) Eniwetok, Kwajalein', @@ -47,9 +50,13 @@ const timezones: Record = { '+12:75': '(GMT +12:45) Chatham Islands', '+13:00': '(GMT +13:00) Apia, Nukualofa', '+14:00': '(GMT +14:00) Line Islands, Tokelau', -}; +} -const TimeZoneSelector = ({ onChange }: { onChange: (event: React.ChangeEvent) => void }) => { +const TimeZoneSelector = ({ + onChange, +}: { + onChange: (event: React.ChangeEvent) => void +}) => { return ( - ); -}; + ) +} const intervalOptions = [ { label: '0 - Off', value: 0 }, @@ -69,18 +76,20 @@ const intervalOptions = [ { label: '5s', value: 5000 }, { label: '10s', value: 10000 }, { label: '1m', value: 60000 }, -]; +] const TimeDisplay = ({ offset, label }: { offset: string; label: string }) => { - const globalPolling = useTypedSelector(selectGlobalPollingEnabled); - const { enabled: timesPolling } = useTypedSelector((state) => selectPollingConfigByApp(state, 'times')); + const globalPolling = useTypedSelector(selectGlobalPollingEnabled) + const { enabled: timesPolling } = useTypedSelector((state) => + selectPollingConfigByApp(state, 'times'), + ) - const canPoll = globalPolling && timesPolling; + const canPoll = globalPolling && timesPolling - const [pollingInterval, setPollingInterval] = React.useState(0); + const [pollingInterval, setPollingInterval] = React.useState(0) const { data, refetch, isFetching } = useGetTimeQuery(offset, { pollingInterval: canPoll ? pollingInterval : 0, - }); + }) return (
@@ -89,7 +98,12 @@ const TimeDisplay = ({ offset, label }: { offset: string; label: string }) => {

Polling Interval:{' '} - + setPollingInterval(Number(value)) + } + > {intervalOptions.map(({ label, value }) => (

- ); -}; + ) +} export const TimeList = () => { const [times, setTimes] = React.useState<{ [key: string]: string }>({ [nanoid()]: '-08:00', - }); - const [selectedValue, setSelectedValue] = React.useState(''); + }) + const [selectedValue, setSelectedValue] = React.useState('') - const prefetch = usePrefetchTime('getTime'); + const prefetch = usePrefetchTime('getTime') useEffect(() => { setTimeout(() => { - setTimes((prev) => ({ ...prev, [nanoid()]: '+00:00' })); - }, 1000); - }, []); + setTimes((prev) => ({ ...prev, [nanoid()]: '+00:00' })) + }, 1000) + }, []) return ( -

Add some times, even duplicates, and watch them automatically refetch in sync!

+

+ Add some times, even duplicates, and watch them automatically refetch in + sync! +

- Notes: shared queries (aka multiple entries of the same time zone) will share the lowest polling interval - between them that is greater than 0. If all entries are set to 0, it will stop polling. If you have two entries - with a polling time of 5s and one with 0 - off, it will continue at 5s until they are removed or 0'd out. + Notes: shared queries (aka multiple entries of the same time zone) will + share the lowest polling interval between them that is greater than 0. + If all entries are set to 0, it will stop polling. If you have two + entries with a polling time of 5s and one with 0 - off, it will continue + at 5s until they are removed or 0'd out.
- Any new poll starts after the last request has either finished or failed to prevent slow-running requests to - immediately double-trigger. + Any new poll starts after the last request has either finished or failed + to prevent slow-running requests to immediately double-trigger.
* Background flashes green when query is running - +

- setSelectedValue(value)} /> -
@@ -138,5 +166,5 @@ export const TimeList = () => { ))}
- ); -}; + ) +} diff --git a/examples/query/react/kitchen-sink/src/index.tsx b/examples/query/react/kitchen-sink/src/index.tsx index 6df77c3e0a..460d6ad2b6 100644 --- a/examples/query/react/kitchen-sink/src/index.tsx +++ b/examples/query/react/kitchen-sink/src/index.tsx @@ -13,7 +13,7 @@ async function render() { } const rootNode = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById('root') as HTMLElement, ) rootNode.render( @@ -23,7 +23,7 @@ async function render() { - + , ) } diff --git a/examples/query/react/kitchen-sink/src/mocks/handlers.ts b/examples/query/react/kitchen-sink/src/mocks/handlers.ts index dd5edddee7..5ede1b6f63 100644 --- a/examples/query/react/kitchen-sink/src/mocks/handlers.ts +++ b/examples/query/react/kitchen-sink/src/mocks/handlers.ts @@ -1,113 +1,125 @@ -import { rest } from 'msw'; -import { createEntityAdapter, nanoid } from '@reduxjs/toolkit'; -import { Post } from '../app/services/posts'; +import { rest } from 'msw' +import { createEntityAdapter, nanoid } from '@reduxjs/toolkit' +import { Post } from '../app/services/posts' // We're just going to use a simple in-memory store for both the counter and posts // The entity adapter will handle modifications when triggered by the MSW handlers -let count = 0; -let startingId = 3; // Just a silly counter for usage when adding new posts +let count = 0 +let startingId = 3 // Just a silly counter for usage when adding new posts -const adapter = createEntityAdapter(); +const adapter = createEntityAdapter() -let state = adapter.getInitialState(); +let state = adapter.getInitialState() state = adapter.setAll(state, [ { id: 1, name: 'A sample post', fetched_at: new Date().toUTCString() }, - { id: 2, name: 'A post about rtk-query', fetched_at: new Date().toUTCString() }, -]); + { + id: 2, + name: 'A post about rtk-query', + fetched_at: new Date().toUTCString(), + }, +]) -export { state }; +export { state } // Just use a random id for an auth token -const token = nanoid(); +const token = nanoid() export const handlers = [ rest.get('/time/:offset', (req, res, ctx) => { - const { offset } = req.params as { offset: string }; - const date = new Date(); - const localDate = date.getTime(); // users local time - const localOffset = date.getTimezoneOffset() * 60000; - const formattedOffset = Number(offset.replace(':', '.')); - const target = localDate + localOffset + 3600000 * formattedOffset; - return res(ctx.json({ time: new Date(target).toUTCString() }), ctx.delay(400)); + const { offset } = req.params as { offset: string } + const date = new Date() + const localDate = date.getTime() // users local time + const localOffset = date.getTimezoneOffset() * 60000 + const formattedOffset = Number(offset.replace(':', '.')) + const target = localDate + localOffset + 3600000 * formattedOffset + return res( + ctx.json({ time: new Date(target).toUTCString() }), + ctx.delay(400), + ) }), rest.put<{ amount: number }>('/increment', (req, res, ctx) => { - const { amount } = req.body; - count = count += amount; + const { amount } = req.body + count = count += amount - return res(ctx.json({ count })); + return res(ctx.json({ count })) }), rest.put<{ amount: number }>('/decrement', (req, res, ctx) => { - const { amount } = req.body; - count = count -= amount; + const { amount } = req.body + count = count -= amount - return res(ctx.json({ count })); + return res(ctx.json({ count })) }), rest.get('/count', (req, res, ctx) => { - return res(ctx.json({ count })); + return res(ctx.json({ count })) }), rest.post('/login', (req, res, ctx) => { - return res.once(ctx.json({ message: 'i fail once' }), ctx.status(500)); + return res.once(ctx.json({ message: 'i fail once' }), ctx.status(500)) }), rest.post('/login', (req, res, ctx) => { - return res(ctx.json({ token, user: { first_name: 'Test', last_name: 'User' } })); + return res( + ctx.json({ token, user: { first_name: 'Test', last_name: 'User' } }), + ) }), rest.get('/posts', (req, res, ctx) => { - return res(ctx.json(Object.values(state.entities))); + return res(ctx.json(Object.values(state.entities))) }), rest.post('/posts', (req, res, ctx) => { - let post = req.body as Partial; - startingId += 1; - state = adapter.addOne(state, { ...post, id: startingId } as Post); - return res(ctx.json(Object.values(state.entities)), ctx.delay(400)); + let post = req.body as Partial + startingId += 1 + state = adapter.addOne(state, { ...post, id: startingId } as Post) + return res(ctx.json(Object.values(state.entities)), ctx.delay(400)) }), rest.get('/posts/:id', (req, res, ctx) => { const { id: idParam } = req.params as { id: string } const id = parseInt(idParam, 10) - state = adapter.updateOne(state, { id, changes: { fetched_at: new Date().toUTCString() } }); - return res(ctx.json(state.entities[id]), ctx.delay(400)); + state = adapter.updateOne(state, { + id, + changes: { fetched_at: new Date().toUTCString() }, + }) + return res(ctx.json(state.entities[id]), ctx.delay(400)) }), rest.put('/posts/:id', (req, res, ctx) => { const { id: idParam } = req.params as { id: string } const id = parseInt(idParam, 10) - const changes = req.body as Partial; + const changes = req.body as Partial - state = adapter.updateOne(state, { id, changes }); + state = adapter.updateOne(state, { id, changes }) - return res(ctx.json(state.entities[id]), ctx.delay(400)); + return res(ctx.json(state.entities[id]), ctx.delay(400)) }), rest.delete('/posts/:id', (req, res, ctx) => { const { id: idParam } = req.params as { id: string } const id = parseInt(idParam, 10) - state = adapter.removeOne(state, id); + state = adapter.removeOne(state, id) return res( ctx.json({ id, success: true, }), - ctx.delay(600) - ); + ctx.delay(600), + ) }), rest.get('/error-prone', (req, res, ctx) => { if (Math.random() > 0.1) { - return res(ctx.json({ error: 'failed!' }), ctx.status(500)); + return res(ctx.json({ error: 'failed!' }), ctx.status(500)) } return res( ctx.json({ success: true, - }) - ); + }), + ) }), -]; +] diff --git a/examples/query/react/kitchen-sink/src/mocks/setupTests.tsx b/examples/query/react/kitchen-sink/src/mocks/setupTests.tsx index 899d316d61..eee2de33b0 100644 --- a/examples/query/react/kitchen-sink/src/mocks/setupTests.tsx +++ b/examples/query/react/kitchen-sink/src/mocks/setupTests.tsx @@ -24,7 +24,7 @@ export const setupTests = () => { } function renderWithProvider( children: React.ReactChild, - { route, path }: RenderOptions = { route: '/', path: '' } + { route, path }: RenderOptions = { route: '/', path: '' }, ) { const history = createMemoryHistory() history.push(route) @@ -39,7 +39,7 @@ export const setupTests = () => { children )} - + , ) } diff --git a/examples/query/react/kitchen-sink/src/setupTests.ts b/examples/query/react/kitchen-sink/src/setupTests.ts index 74b1a275a0..2eb59b05d8 100644 --- a/examples/query/react/kitchen-sink/src/setupTests.ts +++ b/examples/query/react/kitchen-sink/src/setupTests.ts @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom/extend-expect'; +import '@testing-library/jest-dom/extend-expect' diff --git a/examples/query/react/kitchen-sink/tsconfig.json b/examples/query/react/kitchen-sink/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/kitchen-sink/tsconfig.json +++ b/examples/query/react/kitchen-sink/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/mutations/public/index.html b/examples/query/react/mutations/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/mutations/public/index.html +++ b/examples/query/react/mutations/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/mutations/src/index.tsx b/examples/query/react/mutations/src/index.tsx index 3854044b5e..ca83c0fe6d 100644 --- a/examples/query/react/mutations/src/index.tsx +++ b/examples/query/react/mutations/src/index.tsx @@ -19,6 +19,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/mutations/src/mocks/db.ts b/examples/query/react/mutations/src/mocks/db.ts index 5ade9028d0..98599624e8 100644 --- a/examples/query/react/mutations/src/mocks/db.ts +++ b/examples/query/react/mutations/src/mocks/db.ts @@ -26,7 +26,7 @@ export const handlers = [ return res( ctx.json({ error: 'Oh no, there was an error, try again.' }), ctx.status(500), - ctx.delay(300) + ctx.delay(300), ) } @@ -44,7 +44,7 @@ export const handlers = [ return res( ctx.json({ error: 'Oh no, there was an error, try again.' }), ctx.status(500), - ctx.delay(300) + ctx.delay(300), ) } diff --git a/examples/query/react/mutations/tsconfig.json b/examples/query/react/mutations/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/mutations/tsconfig.json +++ b/examples/query/react/mutations/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/optimistic-update/public/index.html b/examples/query/react/optimistic-update/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/optimistic-update/public/index.html +++ b/examples/query/react/optimistic-update/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/optimistic-update/src/app/services/posts.ts b/examples/query/react/optimistic-update/src/app/services/posts.ts index 6fa771dbfe..3033e3ad2f 100644 --- a/examples/query/react/optimistic-update/src/app/services/posts.ts +++ b/examples/query/react/optimistic-update/src/app/services/posts.ts @@ -43,7 +43,7 @@ export const api = createApi({ const patchResult = dispatch( api.util.updateQueryData('getPost', id, (draft) => { Object.assign(draft, patch) - }) + }), ) try { await queryFulfilled diff --git a/examples/query/react/optimistic-update/src/index.tsx b/examples/query/react/optimistic-update/src/index.tsx index 5d044d74eb..9440268a89 100644 --- a/examples/query/react/optimistic-update/src/index.tsx +++ b/examples/query/react/optimistic-update/src/index.tsx @@ -19,6 +19,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/optimistic-update/src/mocks/db.ts b/examples/query/react/optimistic-update/src/mocks/db.ts index 73ec3f64a7..98e6857860 100644 --- a/examples/query/react/optimistic-update/src/mocks/db.ts +++ b/examples/query/react/optimistic-update/src/mocks/db.ts @@ -19,7 +19,7 @@ export const handlers = [ return res( ctx.json({ error: 'Oh no, there was an error' }), ctx.status(500), - ctx.delay(400) + ctx.delay(400), ) } diff --git a/examples/query/react/optimistic-update/tsconfig.json b/examples/query/react/optimistic-update/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/optimistic-update/tsconfig.json +++ b/examples/query/react/optimistic-update/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/pagination/public/index.html b/examples/query/react/pagination/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/pagination/public/index.html +++ b/examples/query/react/pagination/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/pagination/src/app/services/posts.ts b/examples/query/react/pagination/src/app/services/posts.ts index 0b50ae3b64..b4863852b2 100644 --- a/examples/query/react/pagination/src/app/services/posts.ts +++ b/examples/query/react/pagination/src/app/services/posts.ts @@ -7,7 +7,7 @@ export interface Post { title: string author: string content: string - status: typeof postStatuses[number] + status: (typeof postStatuses)[number] created_at: string updated_at: string } diff --git a/examples/query/react/pagination/src/features/posts/PostsManager.tsx b/examples/query/react/pagination/src/features/posts/PostsManager.tsx index 9a790c7e9f..52f3b824a9 100644 --- a/examples/query/react/pagination/src/features/posts/PostsManager.tsx +++ b/examples/query/react/pagination/src/features/posts/PostsManager.tsx @@ -23,8 +23,8 @@ const getColorForStatus = (status: Post['status']) => { return status === 'draft' ? 'gray' : status === 'pending_review' - ? 'orange' - : 'green' + ? 'orange' + : 'green' } const PostList = () => { diff --git a/examples/query/react/pagination/src/index.tsx b/examples/query/react/pagination/src/index.tsx index 5d044d74eb..9440268a89 100644 --- a/examples/query/react/pagination/src/index.tsx +++ b/examples/query/react/pagination/src/index.tsx @@ -19,6 +19,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/pagination/src/mocks/db.ts b/examples/query/react/pagination/src/mocks/db.ts index 5dc3d0968b..89703a4617 100644 --- a/examples/query/react/pagination/src/mocks/db.ts +++ b/examples/query/react/pagination/src/mocks/db.ts @@ -50,7 +50,7 @@ export const handlers = [ page, total_pages: Math.ceil(db.post.count() / per_page), total: db.post.count(), - }) + }), ) }), ...db.post.toHandlers('rest'), diff --git a/examples/query/react/pagination/tsconfig.json b/examples/query/react/pagination/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/pagination/tsconfig.json +++ b/examples/query/react/pagination/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/polling/public/index.html b/examples/query/react/polling/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/polling/public/index.html +++ b/examples/query/react/polling/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/polling/src/Pokemon.tsx b/examples/query/react/polling/src/Pokemon.tsx index 342023c135..e572b83cdd 100644 --- a/examples/query/react/polling/src/Pokemon.tsx +++ b/examples/query/react/polling/src/Pokemon.tsx @@ -15,18 +15,13 @@ const getRandomIntervalValue = () => export const Pokemon = ({ name }: { name: PokemonName }) => { const [pollingInterval, setPollingInterval] = React.useState( - getRandomIntervalValue() + getRandomIntervalValue(), ) - const { - data, - error, - isLoading, - isFetching, - refetch, - } = useGetPokemonByNameQuery(name, { - pollingInterval, - }) + const { data, error, isLoading, isFetching, refetch } = + useGetPokemonByNameQuery(name, { + pollingInterval, + }) return (
- + , ) diff --git a/examples/query/react/polling/src/pokemon.data.ts b/examples/query/react/polling/src/pokemon.data.ts index 1617ce9e50..22eb3a0547 100644 --- a/examples/query/react/polling/src/pokemon.data.ts +++ b/examples/query/react/polling/src/pokemon.data.ts @@ -152,4 +152,4 @@ export const POKEMON_NAMES = [ 'mew', ] as const -export type PokemonName = typeof POKEMON_NAMES[number] +export type PokemonName = (typeof POKEMON_NAMES)[number] diff --git a/examples/query/react/polling/tsconfig.json b/examples/query/react/polling/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/polling/tsconfig.json +++ b/examples/query/react/polling/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/examples/query/react/prefetching-automatic-waterfall/public/index.html b/examples/query/react/prefetching-automatic-waterfall/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/prefetching-automatic-waterfall/public/index.html +++ b/examples/query/react/prefetching-automatic-waterfall/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/prefetching-automatic-waterfall/src/app/services/posts.ts b/examples/query/react/prefetching-automatic-waterfall/src/app/services/posts.ts index e8cb02f9e4..d4032ef9cf 100644 --- a/examples/query/react/prefetching-automatic-waterfall/src/app/services/posts.ts +++ b/examples/query/react/prefetching-automatic-waterfall/src/app/services/posts.ts @@ -7,7 +7,7 @@ export interface Post { title: string author: string content: string - status: typeof postStatuses[number] + status: (typeof postStatuses)[number] created_at: string updated_at: string } diff --git a/examples/query/react/prefetching-automatic-waterfall/src/features/posts/PostsManager.tsx b/examples/query/react/prefetching-automatic-waterfall/src/features/posts/PostsManager.tsx index e8cea9b348..eb093dade1 100644 --- a/examples/query/react/prefetching-automatic-waterfall/src/features/posts/PostsManager.tsx +++ b/examples/query/react/prefetching-automatic-waterfall/src/features/posts/PostsManager.tsx @@ -23,8 +23,8 @@ const getColorForStatus = (status: Post['status']) => { return status === 'draft' ? 'gray' : status === 'pending_review' - ? 'orange' - : 'green' + ? 'orange' + : 'green' } const PostList = () => { diff --git a/examples/query/react/prefetching-automatic-waterfall/src/index.tsx b/examples/query/react/prefetching-automatic-waterfall/src/index.tsx index 5d044d74eb..9440268a89 100644 --- a/examples/query/react/prefetching-automatic-waterfall/src/index.tsx +++ b/examples/query/react/prefetching-automatic-waterfall/src/index.tsx @@ -19,6 +19,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/prefetching-automatic-waterfall/src/mocks/db.ts b/examples/query/react/prefetching-automatic-waterfall/src/mocks/db.ts index 5dc3d0968b..89703a4617 100644 --- a/examples/query/react/prefetching-automatic-waterfall/src/mocks/db.ts +++ b/examples/query/react/prefetching-automatic-waterfall/src/mocks/db.ts @@ -50,7 +50,7 @@ export const handlers = [ page, total_pages: Math.ceil(db.post.count() / per_page), total: db.post.count(), - }) + }), ) }), ...db.post.toHandlers('rest'), diff --git a/examples/query/react/prefetching-automatic-waterfall/tsconfig.json b/examples/query/react/prefetching-automatic-waterfall/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/prefetching-automatic-waterfall/tsconfig.json +++ b/examples/query/react/prefetching-automatic-waterfall/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/prefetching-automatic/public/index.html b/examples/query/react/prefetching-automatic/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/prefetching-automatic/public/index.html +++ b/examples/query/react/prefetching-automatic/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/prefetching-automatic/src/app/services/posts.ts b/examples/query/react/prefetching-automatic/src/app/services/posts.ts index e8cb02f9e4..d4032ef9cf 100644 --- a/examples/query/react/prefetching-automatic/src/app/services/posts.ts +++ b/examples/query/react/prefetching-automatic/src/app/services/posts.ts @@ -7,7 +7,7 @@ export interface Post { title: string author: string content: string - status: typeof postStatuses[number] + status: (typeof postStatuses)[number] created_at: string updated_at: string } diff --git a/examples/query/react/prefetching-automatic/src/features/posts/PostsManager.tsx b/examples/query/react/prefetching-automatic/src/features/posts/PostsManager.tsx index ce01a87daf..3435481082 100644 --- a/examples/query/react/prefetching-automatic/src/features/posts/PostsManager.tsx +++ b/examples/query/react/prefetching-automatic/src/features/posts/PostsManager.tsx @@ -23,8 +23,8 @@ const getColorForStatus = (status: Post['status']) => { return status === 'draft' ? 'gray' : status === 'pending_review' - ? 'orange' - : 'green' + ? 'orange' + : 'green' } const PostList = () => { diff --git a/examples/query/react/prefetching-automatic/src/index.tsx b/examples/query/react/prefetching-automatic/src/index.tsx index 5d044d74eb..9440268a89 100644 --- a/examples/query/react/prefetching-automatic/src/index.tsx +++ b/examples/query/react/prefetching-automatic/src/index.tsx @@ -19,6 +19,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/prefetching-automatic/src/mocks/db.ts b/examples/query/react/prefetching-automatic/src/mocks/db.ts index 5dc3d0968b..89703a4617 100644 --- a/examples/query/react/prefetching-automatic/src/mocks/db.ts +++ b/examples/query/react/prefetching-automatic/src/mocks/db.ts @@ -50,7 +50,7 @@ export const handlers = [ page, total_pages: Math.ceil(db.post.count() / per_page), total: db.post.count(), - }) + }), ) }), ...db.post.toHandlers('rest'), diff --git a/examples/query/react/prefetching-automatic/tsconfig.json b/examples/query/react/prefetching-automatic/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/prefetching-automatic/tsconfig.json +++ b/examples/query/react/prefetching-automatic/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/prefetching/public/index.html b/examples/query/react/prefetching/public/index.html index 09e975e218..e65acb3de5 100644 --- a/examples/query/react/prefetching/public/index.html +++ b/examples/query/react/prefetching/public/index.html @@ -1,4 +1,4 @@ - + @@ -41,4 +41,3 @@ --> - diff --git a/examples/query/react/prefetching/src/app/services/posts.ts b/examples/query/react/prefetching/src/app/services/posts.ts index e8cb02f9e4..d4032ef9cf 100644 --- a/examples/query/react/prefetching/src/app/services/posts.ts +++ b/examples/query/react/prefetching/src/app/services/posts.ts @@ -7,7 +7,7 @@ export interface Post { title: string author: string content: string - status: typeof postStatuses[number] + status: (typeof postStatuses)[number] created_at: string updated_at: string } diff --git a/examples/query/react/prefetching/src/features/posts/PostsManager.tsx b/examples/query/react/prefetching/src/features/posts/PostsManager.tsx index 2aaebf2c7c..5999215a98 100644 --- a/examples/query/react/prefetching/src/features/posts/PostsManager.tsx +++ b/examples/query/react/prefetching/src/features/posts/PostsManager.tsx @@ -23,8 +23,8 @@ const getColorForStatus = (status: Post['status']) => { return status === 'draft' ? 'gray' : status === 'pending_review' - ? 'orange' - : 'green' + ? 'orange' + : 'green' } const PostList = () => { diff --git a/examples/query/react/prefetching/src/index.tsx b/examples/query/react/prefetching/src/index.tsx index 5d044d74eb..9440268a89 100644 --- a/examples/query/react/prefetching/src/index.tsx +++ b/examples/query/react/prefetching/src/index.tsx @@ -19,6 +19,6 @@ worker.start({ quiet: true }).then(() => - - ) + , + ), ) diff --git a/examples/query/react/prefetching/src/mocks/db.ts b/examples/query/react/prefetching/src/mocks/db.ts index 5dc3d0968b..89703a4617 100644 --- a/examples/query/react/prefetching/src/mocks/db.ts +++ b/examples/query/react/prefetching/src/mocks/db.ts @@ -50,7 +50,7 @@ export const handlers = [ page, total_pages: Math.ceil(db.post.count() / per_page), total: db.post.count(), - }) + }), ) }), ...db.post.toHandlers('rest'), diff --git a/examples/query/react/prefetching/tsconfig.json b/examples/query/react/prefetching/tsconfig.json index 5f488e8e73..7f331f6806 100644 --- a/examples/query/react/prefetching/tsconfig.json +++ b/examples/query/react/prefetching/tsconfig.json @@ -1,14 +1,9 @@ { - "include": [ - "./src/**/*" - ], + "include": ["./src/**/*"], "compilerOptions": { "strict": true, "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], + "lib": ["dom", "es2015"], "jsx": "react-jsx", "target": "es5", "allowJs": true, @@ -20,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - } + "noEmit": true, + }, } diff --git a/examples/query/react/with-apiprovider/public/index.html b/examples/query/react/with-apiprovider/public/index.html index 42ae2d2dcb..efbc007a8b 100644 --- a/examples/query/react/with-apiprovider/public/index.html +++ b/examples/query/react/with-apiprovider/public/index.html @@ -1,17 +1,19 @@ - + - - - - - - - - - - React App - + React App + - - -
- - - - \ No newline at end of file + + diff --git a/examples/query/react/with-apiprovider/src/App.tsx b/examples/query/react/with-apiprovider/src/App.tsx index a91982c4b9..f8ded9f1b6 100644 --- a/examples/query/react/with-apiprovider/src/App.tsx +++ b/examples/query/react/with-apiprovider/src/App.tsx @@ -14,9 +14,8 @@ const api = createApi({ }) function Pokemon() { - const { data, refetch, isFetching } = api.useGetPokemonByNameQuery( - 'bulbasaur' - ) + const { data, refetch, isFetching } = + api.useGetPokemonByNameQuery('bulbasaur') return (
diff --git a/examples/query/react/with-apiprovider/tsconfig.json b/examples/query/react/with-apiprovider/tsconfig.json index d4eea2ea4b..7f331f6806 100644 --- a/examples/query/react/with-apiprovider/tsconfig.json +++ b/examples/query/react/with-apiprovider/tsconfig.json @@ -1,25 +1,20 @@ { - "include": [ - "./src/**/*" - ], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "lib": [ - "dom", - "es2015" - ], - "jsx": "react-jsx", - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true - } -} \ No newline at end of file + "include": ["./src/**/*"], + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2015"], + "jsx": "react-jsx", + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + }, +} diff --git a/packages/rtk-codemods/.github/workflows/ci.yml b/packages/rtk-codemods/.github/workflows/ci.yml index ec853b3887..a4dd4e2ed0 100644 --- a/packages/rtk-codemods/.github/workflows/ci.yml +++ b/packages/rtk-codemods/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: - '*' pull_request: {} schedule: - - cron: '0 6 * * 0' # weekly, on sundays + - cron: '0 6 * * 0' # weekly, on sundays jobs: lint: @@ -18,14 +18,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: install dependencies - run: yarn install --frozen-lockfile - - name: linting - run: yarn lint + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: install dependencies + run: yarn install --frozen-lockfile + - name: linting + run: yarn lint test: name: Tests @@ -36,25 +36,25 @@ jobs: node: ['10', '12', '14'] steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - name: install dependencies - run: yarn install --frozen-lockfile - - name: test - run: yarn test + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - name: install dependencies + run: yarn install --frozen-lockfile + - name: test + run: yarn test floating-test: name: Floating dependencies runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - name: install dependencies - run: yarn install --no-lockfile - - name: test - run: yarn test \ No newline at end of file + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: install dependencies + run: yarn install --no-lockfile + - name: test + run: yarn test diff --git a/packages/rtk-codemods/transforms/createReducerBuilder/README.md b/packages/rtk-codemods/transforms/createReducerBuilder/README.md index 52898146e9..1c91761f45 100644 --- a/packages/rtk-codemods/transforms/createReducerBuilder/README.md +++ b/packages/rtk-codemods/transforms/createReducerBuilder/README.md @@ -39,30 +39,36 @@ node ./bin/cli.js createReducerBuilder path/of/files/ or/some**/*glob.js createReducer(initialState, { [todoAdded]: (state: SliceState, action: PayloadAction) => { // stuff - }, -}); + } +}) createReducer(initialState, { [todoAdded](state: SliceState, action: PayloadAction) { // stuff - }, -}); + } +}) ``` **Output** ([basic-ts.output.ts](transforms\createReducerBuilder__testfixtures__\basic-ts.output.ts)): ```ts createReducer(initialState, (builder) => { - builder.addCase(todoAdded, (state: SliceState, action: PayloadAction) => { - // stuff - }); -}); + builder.addCase( + todoAdded, + (state: SliceState, action: PayloadAction) => { + // stuff + } + ) +}) createReducer(initialState, (builder) => { - builder.addCase(todoAdded, (state: SliceState, action: PayloadAction) => { - // stuff - }); -}); + builder.addCase( + todoAdded, + (state: SliceState, action: PayloadAction) => { + // stuff + } + ) +}) ``` --- @@ -88,8 +94,8 @@ createReducer(initialState, { }, todoAdded1f: (state, action) => { //stuff - }, -}); + } +}) createReducer(initialState, { [todoAdded2a]: (state, action) => { @@ -100,8 +106,8 @@ createReducer(initialState, { }, [todoAdded2c]: function (state, action) { // stuff - }, -}); + } +}) ``` **Output** ([basic.output.js](transforms\createReducerBuilder__testfixtures__\basic.output.js)): @@ -110,40 +116,40 @@ createReducer(initialState, { createReducer(initialState, (builder) => { builder.addCase(todoAdded1a, (state, action) => { // stuff - }); + }) - builder.addCase(todoAdded1b, (state, action) => action.payload); + builder.addCase(todoAdded1b, (state, action) => action.payload) builder.addCase(todoAdded1c + 'test', (state, action) => { // stuff - }); + }) builder.addCase(todoAdded1d, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded1e, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded1f, (state, action) => { //stuff - }); -}); + }) +}) createReducer(initialState, (builder) => { builder.addCase(todoAdded2a, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded2b, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded2c, (state, action) => { // stuff - }); -}); + }) +}) ``` diff --git a/packages/rtk-codemods/transforms/createSliceBuilder/README.md b/packages/rtk-codemods/transforms/createSliceBuilder/README.md index 5a15c86682..1db6f8f6de 100644 --- a/packages/rtk-codemods/transforms/createSliceBuilder/README.md +++ b/packages/rtk-codemods/transforms/createSliceBuilder/README.md @@ -42,9 +42,9 @@ const slice1 = createSlice({ extraReducers: { [todoAdded]: (state: SliceState, action: PayloadAction) => { // stuff - }, - }, -}); + } + } +}) const slice2 = createSlice({ name: 'b', @@ -52,9 +52,9 @@ const slice2 = createSlice({ extraReducers: { [todoAdded](state: SliceState, action: PayloadAction) { // stuff - }, - }, -}); + } + } +}) ``` **Output** ([basic-ts.output.ts](transforms\createSliceBuilder__testfixtures__\basic-ts.output.ts)): @@ -65,22 +65,28 @@ const slice1 = createSlice({ initialState, extraReducers: (builder) => { - builder.addCase(todoAdded, (state: SliceState, action: PayloadAction) => { - // stuff - }); - }, -}); + builder.addCase( + todoAdded, + (state: SliceState, action: PayloadAction) => { + // stuff + } + ) + } +}) const slice2 = createSlice({ name: 'b', initialState, extraReducers: (builder) => { - builder.addCase(todoAdded, (state: SliceState, action: PayloadAction) => { - // stuff - }); - }, -}); + builder.addCase( + todoAdded, + (state: SliceState, action: PayloadAction) => { + // stuff + } + ) + } +}) ``` --- @@ -109,9 +115,9 @@ const slice1 = createSlice({ }, todoAdded1f: (state, action) => { //stuff - }, - }, -}); + } + } +}) const slice2 = createSlice({ name: 'b', @@ -125,9 +131,9 @@ const slice2 = createSlice({ }, [todoAdded2c]: function (state, action) { // stuff - }, - }, -}); + } + } +}) ``` **Output** ([basic.output.js](transforms\createSliceBuilder__testfixtures__\basic.output.js)): @@ -140,27 +146,27 @@ const slice1 = createSlice({ extraReducers: (builder) => { builder.addCase(todoAdded1a, (state, action) => { // stuff - }); + }) - builder.addCase(todoAdded1b, (state, action) => action.payload); + builder.addCase(todoAdded1b, (state, action) => action.payload) builder.addCase(todoAdded1c + 'test', (state, action) => { // stuff - }); + }) builder.addCase(todoAdded1d, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded1e, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded1f, (state, action) => { //stuff - }); - }, -}); + }) + } +}) const slice2 = createSlice({ name: 'b', @@ -169,17 +175,17 @@ const slice2 = createSlice({ extraReducers: (builder) => { builder.addCase(todoAdded2a, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded2b, (state, action) => { // stuff - }); + }) builder.addCase(todoAdded2c, (state, action) => { // stuff - }); - }, -}); + }) + } +}) ``` diff --git a/packages/rtk-query-codegen-openapi/ChangeLog.md b/packages/rtk-query-codegen-openapi/ChangeLog.md index b4dffc2183..8e1b25535c 100644 --- a/packages/rtk-query-codegen-openapi/ChangeLog.md +++ b/packages/rtk-query-codegen-openapi/ChangeLog.md @@ -11,24 +11,28 @@ This version adds a new `mergeReadWriteOnly` configuration option (default to `f ## 1.1.3 - 2023-10-11 ### Added + - Adds a temporary workaround for [4.9.0 and 4.10.0 generate circular types oazapfts/oazapfts#491](https://github.com/oazapfts/oazapfts/issues/491) ## 1.1.2 - 2023-10-11 ### Added -- Support for Read Only Properties in the Open API spec. Previously, this property was ignored. + +- Support for Read Only Properties in the Open API spec. Previously, this property was ignored. - Now if the readOnly property is present and set to `true` in a schema, it will split the type into two types: one with the read only property suffixed as 'Read' and the other without the read only properties, using the same type name as before. - This may cause issues if you had your OpenAPI spec properly typed/configured, as it will remove the read onyl types from your existing type. You will need to switch to the new type suffixed as 'Read' to avoid missing property names. -## 1.1.1 - 2023-10-11 +## 1.1.1 - 2023-10-11 ### Changed + - Codegen: better handling of duplicate param names ([Codegen: better handling of duplicate param names #3780](https://github.com/reduxjs/redux-toolkit/pull/3780)) - If a parameter name is both used in a query and a parameter, it will be prefixed with `query`/`param` now to avoid conflicts -## 1.1.0 - 2023-10-11 +## 1.1.0 - 2023-10-11 ### Added + - Option of generating real TS enums instead of string unions [Adds the option of generating real TS enums instead of string unions #2854](https://github.com/reduxjs/redux-toolkit/pull/2854) - Compatibility with TypeScript 5.x versions as the codegen relies on the TypeScript AST for code generation - As a result also needs a higher TypeScript version to work with (old version range was 4.1-4.5) diff --git a/packages/rtk-query-codegen-openapi/src/generate.ts b/packages/rtk-query-codegen-openapi/src/generate.ts index 6e26697ac1..9c5c00c158 100644 --- a/packages/rtk-query-codegen-openapi/src/generate.ts +++ b/packages/rtk-query-codegen-openapi/src/generate.ts @@ -175,13 +175,13 @@ export async function generateApi( ...apiGen.enumAliases, ...(hooks ? [ - generateReactHooks({ - exportName: generatedApiName, - operationDefinitions, - endpointOverrides, - config: hooks, - }), - ] + generateReactHooks({ + exportName: generatedApiName, + operationDefinitions, + endpointOverrides, + config: hooks, + }), + ] : []), ], factory.createToken(ts.SyntaxKind.EndOfFileToken), @@ -301,7 +301,9 @@ export async function generateApi( const body = apiGen.resolve(requestBody); const schema = apiGen.getSchemaFromContent(body.content); const type = apiGen.getTypeFromSchema(schema); - const schemaName = camelCase((type as any).name || getReferenceName(schema) || ("title" in schema && schema.title) || 'body'); + const schemaName = camelCase( + (type as any).name || getReferenceName(schema) || ('title' in schema && schema.title) || 'body' + ); const name = generateName(schemaName in queryArg ? 'body' : schemaName, 'body'); queryArg[name] = { @@ -335,19 +337,19 @@ export async function generateApi( ? isFlatArg ? withQueryComment({ ...queryArgValues[0].type }, queryArgValues[0], false) : factory.createTypeLiteralNode( - queryArgValues.map((def) => - withQueryComment( - factory.createPropertySignature( - undefined, - propertyName(def.name), - createQuestionToken(!def.required), - def.type - ), - def, - true + queryArgValues.map((def) => + withQueryComment( + factory.createPropertySignature( + undefined, + propertyName(def.name), + createQuestionToken(!def.required), + def.type + ), + def, + true + ) ) ) - ) : factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword) ) ).name @@ -391,18 +393,18 @@ export async function generateApi( return parameters.length === 0 ? undefined : factory.createPropertyAssignment( - factory.createIdentifier(propertyName), - factory.createObjectLiteralExpression( - parameters.map( - (param) => - createPropertyAssignment( - param.originalName, - isFlatArg ? rootObject : accessProperty(rootObject, param.name) - ), - true + factory.createIdentifier(propertyName), + factory.createObjectLiteralExpression( + parameters.map( + (param) => + createPropertyAssignment( + param.originalName, + isFlatArg ? rootObject : accessProperty(rootObject, param.name) + ), + true + ) ) - ) - ); + ); } return factory.createArrowFunction( @@ -423,17 +425,17 @@ export async function generateApi( isQuery && verb.toUpperCase() === 'GET' ? undefined : factory.createPropertyAssignment( - factory.createIdentifier('method'), - factory.createStringLiteral(verb.toUpperCase()) - ), + factory.createIdentifier('method'), + factory.createStringLiteral(verb.toUpperCase()) + ), bodyParameter === undefined ? undefined : factory.createPropertyAssignment( - factory.createIdentifier('body'), - isFlatArg - ? rootObject - : factory.createPropertyAccessExpression(rootObject, factory.createIdentifier(bodyParameter.name)) - ), + factory.createIdentifier('body'), + isFlatArg + ? rootObject + : factory.createPropertyAccessExpression(rootObject, factory.createIdentifier(bodyParameter.name)) + ), createObjectLiteralProperty(pickParams('cookie'), 'cookies'), createObjectLiteralProperty(pickParams('header'), 'headers'), createObjectLiteralProperty(pickParams('query'), 'params'), @@ -445,12 +447,12 @@ export async function generateApi( } // eslint-disable-next-line no-empty-pattern - function generateQueryEndpointProps({ }: { operationDefinition: OperationDefinition }): ObjectPropertyDefinitions { + function generateQueryEndpointProps({}: { operationDefinition: OperationDefinition }): ObjectPropertyDefinitions { return {}; /* TODO needs implementation - skip for now */ } // eslint-disable-next-line no-empty-pattern - function generateMutationEndpointProps({ }: { operationDefinition: OperationDefinition }): ObjectPropertyDefinitions { + function generateMutationEndpointProps({}: { operationDefinition: OperationDefinition }): ObjectPropertyDefinitions { return {}; /* TODO needs implementation - skip for now */ } } @@ -480,16 +482,16 @@ function generatePathExpression( return expressions.length ? factory.createTemplateExpression( - factory.createTemplateHead(head), - expressions.map(([prop, literal], index) => - factory.createTemplateSpan( - isFlatArg ? rootObject : accessProperty(rootObject, prop), - index === expressions.length - 1 - ? factory.createTemplateTail(literal) - : factory.createTemplateMiddle(literal) + factory.createTemplateHead(head), + expressions.map(([prop, literal], index) => + factory.createTemplateSpan( + isFlatArg ? rootObject : accessProperty(rootObject, prop), + index === expressions.length - 1 + ? factory.createTemplateTail(literal) + : factory.createTemplateMiddle(literal) + ) ) ) - ) : factory.createNoSubstitutionTemplateLiteral(head); } @@ -500,13 +502,13 @@ type QueryArgDefinition = { required?: boolean; param?: OpenAPIV3.ParameterObject; } & ( - | { + | { origin: 'param'; param: OpenAPIV3.ParameterObject; } - | { + | { origin: 'body'; body: OpenAPIV3.RequestBodyObject; } - ); +); type QueryArgDefinitions = Record; diff --git a/packages/rtk-query-codegen-openapi/src/types.ts b/packages/rtk-query-codegen-openapi/src/types.ts index bc6fba5d74..701060a6bf 100644 --- a/packages/rtk-query-codegen-openapi/src/types.ts +++ b/packages/rtk-query-codegen-openapi/src/types.ts @@ -2,7 +2,7 @@ import type { OpenAPIV3 } from 'openapi-types'; export type OperationDefinition = { path: string; - verb: typeof operationKeys[number]; + verb: (typeof operationKeys)[number]; pathItem: OpenAPIV3.PathItemObject; operation: OpenAPIV3.OperationObject; }; diff --git a/packages/rtk-query-codegen-openapi/src/utils/getOperationDefinitions.ts b/packages/rtk-query-codegen-openapi/src/utils/getOperationDefinitions.ts index 5cd3854d28..16f1a6f3e7 100644 --- a/packages/rtk-query-codegen-openapi/src/utils/getOperationDefinitions.ts +++ b/packages/rtk-query-codegen-openapi/src/utils/getOperationDefinitions.ts @@ -7,7 +7,7 @@ export function getOperationDefinitions(v3Doc: OpenAPIV3.Document): OperationDef !pathItem ? [] : Object.entries(pathItem) - .filter((arg): arg is [typeof operationKeys[number], OpenAPIV3.OperationObject] => + .filter((arg): arg is [(typeof operationKeys)[number], OpenAPIV3.OperationObject] => operationKeys.includes(arg[0] as any) ) .map(([verb, operation]) => ({ diff --git a/packages/rtk-query-codegen-openapi/src/utils/isQuery.ts b/packages/rtk-query-codegen-openapi/src/utils/isQuery.ts index 8bb779ce17..2cf756e676 100644 --- a/packages/rtk-query-codegen-openapi/src/utils/isQuery.ts +++ b/packages/rtk-query-codegen-openapi/src/utils/isQuery.ts @@ -1,6 +1,6 @@ import type { EndpointOverrides, operationKeys } from '../types'; -export function isQuery(verb: typeof operationKeys[number], overrides: EndpointOverrides | undefined) { +export function isQuery(verb: (typeof operationKeys)[number], overrides: EndpointOverrides | undefined) { if (overrides?.type) { return overrides.type === 'query'; } diff --git a/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts b/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts index 8171f0ca6f..d922e7ff55 100644 --- a/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts +++ b/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts @@ -379,7 +379,7 @@ describe('openapi spec', () => { unionUndefined: true, schemaFile: './fixtures/readOnlyWriteOnly.yaml', apiFile: './fixtures/emptyApi.ts', - mergeReadWriteOnly: true + mergeReadWriteOnly: true, }); expect(api).toMatchSnapshot(); }); diff --git a/packages/rtk-query-codegen-openapi/test/tsconfig.json b/packages/rtk-query-codegen-openapi/test/tsconfig.json index 499c1c5631..1c8d5b68ec 100644 --- a/packages/rtk-query-codegen-openapi/test/tsconfig.json +++ b/packages/rtk-query-codegen-openapi/test/tsconfig.json @@ -3,7 +3,7 @@ "lib": ["es2019"], "paths": { "@/*": ["./test/fixtures/*"], - "@rtk-query/codegen-openapi": ["./src"] + "@rtk-query/codegen-openapi": ["./src"], }, "allowSyntheticDefaultImports": true, "esModuleInterop": true, @@ -17,6 +17,6 @@ "resolveJsonModule": true, "types": ["node", "jest"], "allowJs": true, - "checkJs": true - } + "checkJs": true, + }, } diff --git a/packages/rtk-query-codegen-openapi/tsconfig.json b/packages/rtk-query-codegen-openapi/tsconfig.json index 28cad6ed33..6527f11b9d 100644 --- a/packages/rtk-query-codegen-openapi/tsconfig.json +++ b/packages/rtk-query-codegen-openapi/tsconfig.json @@ -66,7 +66,7 @@ /* Advanced Options */ "skipLibCheck": true /* Skip type checking of declaration files. */, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, }, - "exclude": ["test", "lib"] + "exclude": ["test", "lib"], } diff --git a/packages/rtk-query-graphql-request-base-query/src/GraphqlBaseQueryTypes.ts b/packages/rtk-query-graphql-request-base-query/src/GraphqlBaseQueryTypes.ts index 0c34984567..562d85ae32 100644 --- a/packages/rtk-query-graphql-request-base-query/src/GraphqlBaseQueryTypes.ts +++ b/packages/rtk-query-graphql-request-base-query/src/GraphqlBaseQueryTypes.ts @@ -3,21 +3,24 @@ import type { GraphQLClient, RequestOptions, RequestDocument, - ClientError + ClientError, } from 'graphql-request' export type Document = RequestDocument export type RequestHeaders = RequestOptions['requestHeaders'] export type PrepareHeaders = ( headers: Headers, - api: Pick + api: Pick< + BaseQueryApi, + 'getState' | 'endpoint' | 'type' | 'forced' | 'extra' + >, ) => MaybePromise export type ErrorResponse = { - message: string; - stack: string; - name: string; -}; + message: string + stack: string + name: string +} export type GraphqlRequestBaseQueryArgs = ( | { @@ -26,8 +29,8 @@ export type GraphqlRequestBaseQueryArgs = ( | { client: GraphQLClient } ) & { requestHeaders?: RequestHeaders - prepareHeaders?: PrepareHeaders, - customErrors?: (args: ClientError) => E; + prepareHeaders?: PrepareHeaders + customErrors?: (args: ClientError) => E } export type QueryReturnValue = diff --git a/packages/rtk-query-graphql-request-base-query/src/index.ts b/packages/rtk-query-graphql-request-base-query/src/index.ts index 481ed629ac..b796c5d6d8 100644 --- a/packages/rtk-query-graphql-request-base-query/src/index.ts +++ b/packages/rtk-query-graphql-request-base-query/src/index.ts @@ -10,7 +10,7 @@ import type { } from './GraphqlBaseQueryTypes' export const graphqlRequestBaseQuery = ( - options: GraphqlRequestBaseQueryArgs + options: GraphqlRequestBaseQueryArgs, ): BaseQueryFn< { document: string | DocumentNode; variables?: any }, unknown, @@ -24,7 +24,7 @@ export const graphqlRequestBaseQuery = ( return async ( { document, variables }, - { getState, endpoint, forced, type, signal, extra } + { getState, endpoint, forced, type, signal, extra }, ) => { try { const prepareHeaders: PrepareHeaders = diff --git a/packages/rtk-query-graphql-request-base-query/tsconfig.json b/packages/rtk-query-graphql-request-base-query/tsconfig.json index 98694b0257..076aee3602 100644 --- a/packages/rtk-query-graphql-request-base-query/tsconfig.json +++ b/packages/rtk-query-graphql-request-base-query/tsconfig.json @@ -4,8 +4,8 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ @@ -25,7 +25,7 @@ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ @@ -51,7 +51,7 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ @@ -66,10 +66,8 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ /* Advanced Options */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "skipLibCheck": true /* Skip type checking of declaration files. */, + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, }, - "include": [ - "**/*.ts" - ] + "include": ["**/*.ts"], } diff --git a/website/src/css/custom.css b/website/src/css/custom.css index 4a61c52f6d..5bb4d94df8 100644 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -173,12 +173,16 @@ a:visited { transform: rotateZ(180deg); -webkit-transition: -webkit-transform 0.2s linear; transition: -webkit-transform 0.2s linear; - transition-property: transform, -webkit-transform; + transition-property: + transform, + -webkit-transform; transition-duration: 0.2s, 0.2s; transition-timing-function: linear, linear; transition-delay: 0s, 0s; transition: transform 0.2s linear; - transition: transform 0.2s linear, -webkit-transform 0.2s linear; + transition: + transform 0.2s linear, + -webkit-transform 0.2s linear; color: var(--ifm-font-base-color) !important; } diff --git a/website/src/js/monokaiTheme.js b/website/src/js/monokaiTheme.js index e5c47f8be9..94e5cb451c 100644 --- a/website/src/js/monokaiTheme.js +++ b/website/src/js/monokaiTheme.js @@ -1,62 +1,62 @@ module.exports = { plain: { color: '#f8f8f2', - backgroundColor: '#272822' + backgroundColor: '#272822', }, styles: [ { types: ['comment', 'prolog', 'doctype', 'cdata'], style: { - color: '#778090' - } + color: '#778090', + }, }, { types: ['punctuation'], style: { - color: '#F8F8F2' - } + color: '#F8F8F2', + }, }, { types: ['property', 'tag', 'constant', 'symbol', 'deleted'], style: { - color: '#F92672' - } + color: '#F92672', + }, }, { types: ['boolean', 'number'], style: { - color: '#AE81FF' - } + color: '#AE81FF', + }, }, { types: ['selector', 'attr-name', 'string', 'char', 'builtin', 'inserted'], style: { - color: '#a6e22e' - } + color: '#a6e22e', + }, }, { types: ['operator', 'entity', 'url', 'variable'], style: { - color: '#F8F8F2' - } + color: '#F8F8F2', + }, }, { types: ['atrule', 'attr-value', 'function'], style: { - color: '#E6D874' - } + color: '#E6D874', + }, }, { types: ['keyword'], style: { - color: '#F92672' - } + color: '#F92672', + }, }, { types: ['regex', 'important'], style: { - color: '#FD971F' - } - } - ] + color: '#FD971F', + }, + }, + ], } diff --git a/website/src/pages/styles.module.css b/website/src/pages/styles.module.css index e8184048bd..54f977306d 100644 --- a/website/src/pages/styles.module.css +++ b/website/src/pages/styles.module.css @@ -99,7 +99,6 @@ margin-top: 0; } - .errorDetails { color: #ff6464; border-radius: 0.5rem;