[{"data":1,"prerenderedAt":468,"buildId":469},["ShallowReactive",2],{"navigation_docs":3,"rule-content-\u002Fpinia\u002Frules\u002Fstores\u002Fno-module-scope-store":104},[4,32,36,40,44,48,52,64,68,92,96,100],{"title":5,"path":6,"stem":7,"children":8,"icon":31},"CLI","\u002Fcli","1.cli\u002F1.index",[9,11,15,19,23,27],{"title":10,"path":6,"stem":7},"Run Doctor",{"title":12,"path":13,"stem":14},"Reports","\u002Fcli\u002Freports","1.cli\u002F2.reports",{"title":16,"path":17,"stem":18},"Configuration","\u002Fcli\u002Fconfiguration","1.cli\u002F3.configuration",{"title":20,"path":21,"stem":22},"CI and changed files","\u002Fcli\u002Fci","1.cli\u002F4.ci",{"title":24,"path":25,"stem":26},"Workspaces","\u002Fcli\u002Fworkspaces","1.cli\u002F5.workspaces",{"title":28,"path":29,"stem":30},"Cache and speed","\u002Fcli\u002Fcache","1.cli\u002F6.cache","i-lucide-terminal",{"title":33,"path":34,"stem":35},"Nuxt","\u002Fnuxt","2.nuxt",{"title":37,"path":38,"stem":39},"Vue","\u002Fvue","3.vue",{"title":41,"path":42,"stem":43},"Vite","\u002Fvite","4.vite",{"title":45,"path":46,"stem":47},"Nitro","\u002Fnitro","5.nitro",{"title":49,"path":50,"stem":51},"TypeScript","\u002Ftypescript","6.typescript",{"title":53,"path":54,"stem":55,"children":56,"icon":63},"Design system","\u002Fdesign-system","7.design-system\u002F1.index",[57,59],{"title":58,"path":54,"stem":55},"Overview",{"title":60,"path":61,"stem":62},"Classes and styles","\u002Fdesign-system\u002Fclasses","7.design-system\u002F2.classes","i-lucide-swatch-book",{"title":65,"path":66,"stem":67},"Package","\u002Fpackage","8.package",{"title":69,"path":70,"stem":71,"children":72,"icon":91},"Extending Doctor","\u002Fextending","9.extending\u002F1.index",[73,75,79,83,87],{"title":74,"path":70,"stem":71},"Write an extension",{"title":76,"path":77,"stem":78},"Visitors","\u002Fextending\u002Fvisitors","9.extending\u002F2.visitors",{"title":80,"path":81,"stem":82},"Ship with a library","\u002Fextending\u002Fshipping","9.extending\u002F3.shipping",{"title":84,"path":85,"stem":86},"Test a Rule","\u002Fextending\u002Ftesting","9.extending\u002F4.testing",{"title":88,"path":89,"stem":90},"Rule inputs","\u002Fextending\u002Frule-inputs","9.extending\u002F5.rule-inputs","i-lucide-puzzle",{"title":93,"path":94,"stem":95},"H3","\u002Fh3","9.h3",{"title":97,"path":98,"stem":99},"MCP","\u002Fmodel-context-protocol","9.model-context-protocol",{"title":101,"path":102,"stem":103},"Pinia","\u002Fpinia","9.pinia",{"id":105,"title":106,"body":107,"category":113,"description":455,"diagnosticCodes":456,"docsUrl":115,"extension":457,"fix":116,"framework":458,"meta":459,"navigation":460,"pack":117,"path":462,"recommendedReplacement":463,"ruleId":118,"seo":464,"severity":119,"source":120,"sourceUrl":121,"stem":465,"why":466,"__hash__":467},"rules\u002Fpinia\u002Frules\u002Fstores\u002Fno-module-scope-store.md","Call stores inside setup or functions, not at module scope",{"type":108,"value":109,"toc":446},"minimark",[110,122,127,159,163,178,182,196,200,219,223,228,231,357,360,442],[111,112],"rule-metadata",{"category":113,"diagnosticCodes":114,"docsUrl":115,"fix":116,"pack":117,"ruleId":118,"severity":119,"source":120,"sourceUrl":121},"stores","PINIA0006","https:\u002F\u002Fpinia.vuejs.org\u002Fcore-concepts\u002Foutside-component-usage.html","no","vite-doctor\u002Fpinia","pinia\u002Fstores\u002Fno-module-scope-store","warn","src\u002Frule-packs\u002Fpinia\u002Frules\u002Fno-module-scope-store.ts","https:\u002F\u002Fgithub.com\u002Fwords-with-agents\u002Fvite-doctor\u002Fblob\u002Fmain\u002Fsrc\u002Frule-packs\u002Fpinia\u002Frules\u002Fno-module-scope-store.ts",[123,124,126],"h2",{"id":125},"run-this-rule","Run this rule",[128,129,134],"pre",{"className":130,"code":131,"language":132,"meta":133,"style":133},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm vite-doctor . --rules pinia\u002Fstores\u002Fno-module-scope-store\n","bash","",[135,136,137],"code",{"__ignoreMap":133},[138,139,142,146,150,153,156],"span",{"class":140,"line":141},"line",1,[138,143,145],{"class":144},"sBMFI","pnpm",[138,147,149],{"class":148},"sfazB"," vite-doctor",[138,151,152],{"class":148}," .",[138,154,155],{"class":148}," --rules",[138,157,158],{"class":148}," pinia\u002Fstores\u002Fno-module-scope-store\n",[123,160,162],{"id":161},"why-it-matters","Why it matters",[164,165,166,169,170,173,174,177],"p",{},[135,167,168],{},"useXStore()"," finds its Pinia instance through the current app's injection context, falling back to the active Pinia. At module scope there is no app context: before app.",[135,171,172],{},"use(pinia)"," runs, Pinia throws \"",[135,175,176],{},"getActivePinia()","\" was called but there was no active Pinia, and with server-side rendering the module runs once per server process, so every request shares the store it got.",[123,179,181],{"id":180},"recommended-fix","Recommended fix",[164,183,184,185,187,188,191,192,195],{},"Move the ",[135,186,168],{}," call into the function that needs the store: ",[135,189,190],{},"\u003Cscript setup>",", ",[135,193,194],{},"setup()",", a composable, a store action, a router guard, or a Nuxt plugin or middleware callback.",[123,197,199],{"id":198},"useful-links","Useful links",[201,202,203,212],"ul",{},[204,205,206],"li",{},[207,208,211],"a",{"href":115,"rel":209},[210],"nofollow","Rule reference",[204,213,214],{},[207,215,218],{"href":216,"rel":217},"https:\u002F\u002Fpinia.vuejs.org\u002Fssr\u002F",[210],"Pinia SSR",[123,220,222],{"id":221},"example","Example",[224,225,227],"h3",{"id":226},"call-the-store-inside-the-guard-that-uses-it","Call the store inside the guard that uses it",[164,229,230],{},"Before",[128,232,236],{"className":233,"code":234,"language":235,"meta":133,"style":133},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const user = useUserStore()\n\nrouter.beforeEach((to) => {\n  if (to.meta.requiresAuth && !user.isLoggedIn) return '\u002Flogin'\n})\n","ts",[135,237,238,259,266,296,348],{"__ignoreMap":133},[138,239,240,244,248,252,256],{"class":140,"line":141},[138,241,243],{"class":242},"spNyl","const",[138,245,247],{"class":246},"sTEyZ"," user ",[138,249,251],{"class":250},"sMK4o","=",[138,253,255],{"class":254},"s2Zo4"," useUserStore",[138,257,258],{"class":246},"()\n",[138,260,262],{"class":140,"line":261},2,[138,263,265],{"emptyLinePlaceholder":264},true,"\n",[138,267,269,272,275,278,281,283,287,290,293],{"class":140,"line":268},3,[138,270,271],{"class":246},"router",[138,273,274],{"class":250},".",[138,276,277],{"class":254},"beforeEach",[138,279,280],{"class":246},"(",[138,282,280],{"class":250},[138,284,286],{"class":285},"sHdIc","to",[138,288,289],{"class":250},")",[138,291,292],{"class":242}," =>",[138,294,295],{"class":250}," {\n",[138,297,299,303,307,309,311,314,316,319,322,325,328,330,333,336,339,342,345],{"class":140,"line":298},4,[138,300,302],{"class":301},"s7zQu","  if",[138,304,306],{"class":305},"swJcz"," (",[138,308,286],{"class":246},[138,310,274],{"class":250},[138,312,313],{"class":246},"meta",[138,315,274],{"class":250},[138,317,318],{"class":246},"requiresAuth",[138,320,321],{"class":250}," &&",[138,323,324],{"class":250}," !",[138,326,327],{"class":246},"user",[138,329,274],{"class":250},[138,331,332],{"class":246},"isLoggedIn",[138,334,335],{"class":305},") ",[138,337,338],{"class":301},"return",[138,340,341],{"class":250}," '",[138,343,344],{"class":148},"\u002Flogin",[138,346,347],{"class":250},"'\n",[138,349,351,354],{"class":140,"line":350},5,[138,352,353],{"class":250},"}",[138,355,356],{"class":246},")\n",[164,358,359],{},"After",[128,361,363],{"className":233,"code":362,"language":235,"meta":133,"style":133},"router.beforeEach((to) => {\n  const user = useUserStore()\n  if (to.meta.requiresAuth && !user.isLoggedIn) return '\u002Flogin'\n})\n",[135,364,365,385,400,436],{"__ignoreMap":133},[138,366,367,369,371,373,375,377,379,381,383],{"class":140,"line":141},[138,368,271],{"class":246},[138,370,274],{"class":250},[138,372,277],{"class":254},[138,374,280],{"class":246},[138,376,280],{"class":250},[138,378,286],{"class":285},[138,380,289],{"class":250},[138,382,292],{"class":242},[138,384,295],{"class":250},[138,386,387,390,393,396,398],{"class":140,"line":261},[138,388,389],{"class":242},"  const",[138,391,392],{"class":246}," user",[138,394,395],{"class":250}," =",[138,397,255],{"class":254},[138,399,258],{"class":305},[138,401,402,404,406,408,410,412,414,416,418,420,422,424,426,428,430,432,434],{"class":140,"line":268},[138,403,302],{"class":301},[138,405,306],{"class":305},[138,407,286],{"class":246},[138,409,274],{"class":250},[138,411,313],{"class":246},[138,413,274],{"class":250},[138,415,318],{"class":246},[138,417,321],{"class":250},[138,419,324],{"class":250},[138,421,327],{"class":246},[138,423,274],{"class":250},[138,425,332],{"class":246},[138,427,335],{"class":305},[138,429,338],{"class":301},[138,431,341],{"class":250},[138,433,344],{"class":148},[138,435,347],{"class":250},[138,437,438,440],{"class":140,"line":298},[138,439,353],{"class":250},[138,441,356],{"class":246},[443,444,445],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}",{"title":133,"searchDepth":261,"depth":261,"links":447},[448,449,450,451,452],{"id":125,"depth":261,"text":126},{"id":161,"depth":261,"text":162},{"id":180,"depth":261,"text":181},{"id":198,"depth":261,"text":199},{"id":221,"depth":261,"text":222,"children":453},[454],{"id":226,"depth":268,"text":227},"Report useXStore() calls that run when a module is first imported instead of inside setup, a composable, an action, or a callback.",[114],"md","pinia",{},{"title":461},"Module-scope stores","\u002Fpinia\u002Frules\u002Fstores\u002Fno-module-scope-store","Move the useXStore() call into the function that needs the store: \u003Cscript setup>, setup(), a composable, a store action, a router guard, or a Nuxt plugin or middleware callback.",{"title":106,"description":455},"pinia\u002Frules\u002Fstores\u002Fno-module-scope-store","useXStore() finds its Pinia instance through the current app's injection context, falling back to the active Pinia. At module scope there is no app context: before app.use(pinia) runs, Pinia throws \"getActivePinia()\" was called but there was no active Pinia, and with server-side rendering the module runs once per server process, so every request shares the store it got.","Wmd1NbAuwZlgsbw96HJkcdhVhDiPvnljsjaNHjvqR-I",1796507772874,"e745db9b-2064-477e-b678-8c0a05edc39c"]