UNPKG

@augmentcode/ag-redux-toolkit

Version:

Redux + Saga state management for Svelte apps — designed for AI agents. Includes runtime TypeScript source, AI skills, and reference documentation for robust, observable, high-performance state management.

28 lines (24 loc) • 1.25 kB
import { reportProgram } from "../../ast-utils.mjs"; import { createArchitectureRule, createArchitectureRulePlugin } from "../../rule-utils.mjs"; export const ruleId = "shared-svelte-store-boundary"; function isAllowedComponentLocalStore(file) { return /(^|\/)components?\//.test(file) || /(^|\/)(fixtures?|migrations?|migration)\//.test(file); } export const rule = createArchitectureRule({ ruleId, summary: "Shared/domain Svelte store file crossed the Redux state boundary.", why: "Shared `*.store.svelte.ts` modules split canonical app state outside Redux and make state ownership ambiguous.", fix: "Move shared/domain state into Redux, or keep Svelte stores component-local or in explicit migration fixtures.", create(_context, { classifyPath, report, sourceCode }) { return { Program() { const path = classifyPath().path; if (path.endsWith(".store.svelte.ts") && !isAllowedComponentLocalStore(path)) { reportProgram(report, sourceCode, "Shared/domain *.store.svelte.ts files are deprecated; move shared state to Redux or keep only component-local/migration fixtures."); } }, }; }, }); export const plugin = createArchitectureRulePlugin(ruleId, rule); export default plugin;