@studiometa/eslint-plugin-ui 1.11.1 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -72,7 +72,7 @@ Add the plugin to your `.oxlintrc.json` using the `"ui"` name to get the `ui/` r
72
72
 
73
73
  ### `ui/prefer-ui-component`
74
74
 
75
- Detects classes whose name matches a component exported by `@studiometa/ui` (e.g. `Menu`, `Accordion`, `Modal`) that extend `Base` directly. Suggests importing and extending the existing component instead.
75
+ Detects classes whose name matches a component exported by `@studiometa/ui` (e.g. `Menu`, `Disclosure`, `Dialog`) that extend `Base` directly. Suggests importing and extending the existing component instead.
76
76
 
77
77
  ```js
78
78
  // ❌ Incorrect
package/dist/index.js CHANGED
@@ -177,57 +177,84 @@ function createContextAndVisitor(rule, afterHooksState) {
177
177
  };
178
178
  }
179
179
 
180
- // src/utils/ast.ts
181
- function createRule(rule) {
182
- return rule;
183
- }
184
- var UI_PACKAGE = "@studiometa/ui";
185
- var TOOLKIT_PACKAGE = "@studiometa/js-toolkit";
180
+ // src/utils/component-names.ts
186
181
  var UI_COMPONENT_NAMES = /* @__PURE__ */ new Set([
187
- "Accordion",
188
- "AccordionItem",
182
+ "AbstractCarouselChild",
183
+ "AbstractCarouselComponent",
184
+ "AbstractFigure",
185
+ "AbstractFigureDynamic",
186
+ "AbstractPrefetch",
187
+ "AbstractTrack",
189
188
  "Action",
189
+ "ActionEvent",
190
190
  "AnchorNav",
191
191
  "AnchorNavLink",
192
192
  "AnchorNavTarget",
193
- "CircularMarquee",
193
+ "Carousel",
194
+ "CarouselBtn",
195
+ "CarouselCount",
196
+ "CarouselDots",
197
+ "CarouselDrag",
198
+ "CarouselItem",
199
+ "CarouselPlay",
200
+ "CarouselProgress",
201
+ "CarouselThumbnails",
202
+ "CarouselWrapper",
203
+ "ClickOutside",
194
204
  "Cursor",
195
205
  "DataBind",
196
206
  "DataComputed",
197
207
  "DataEffect",
198
208
  "DataModel",
209
+ "DataRegistry",
199
210
  "DataScope",
211
+ "Defer",
212
+ "Dialog",
213
+ "Disclosure",
214
+ "DisclosureGroup",
200
215
  "Draggable",
216
+ "Fetch",
217
+ "FetchShopifyPartial",
218
+ "FetchShopifySection",
201
219
  "Figure",
220
+ "FigureShopify",
221
+ "FigureTwicpics",
202
222
  "FigureVideo",
203
- "Frame",
204
- "FrameAnchor",
205
- "FrameForm",
206
- "FrameTarget",
207
- "FrameLoader",
223
+ "FigureVideoTwicpics",
208
224
  "Hoverable",
209
- "LargeText",
210
- "LazyInclude",
225
+ "InView",
226
+ "InViewOnce",
227
+ "Indexable",
228
+ "Marquee",
211
229
  "Menu",
212
230
  "MenuBtn",
213
231
  "MenuList",
214
- "Modal",
215
- "Panel",
216
- "AbstractPrefetch",
217
- "PrefetchWhenOver",
232
+ "PrefetchOnInteraction",
218
233
  "PrefetchWhenVisible",
219
- "AbstractScrollAnimation",
220
- "ScrollAnimationTimeline",
221
- "ScrollAnimationTarget",
222
234
  "ScrollReveal",
235
+ "ScrollTo",
223
236
  "Sentinel",
224
- "Slider",
225
- "SliderItem",
226
- "SliderDrag",
227
237
  "Sticky",
228
238
  "Tabs",
229
- "Transition"
239
+ "Target",
240
+ "Timer",
241
+ "TimerProgress",
242
+ "Toast",
243
+ "Toaster",
244
+ "Track",
245
+ "TrackContext",
246
+ "TrackEvent",
247
+ "TrackShopify",
248
+ "Transition",
249
+ "ViewTransition"
230
250
  ]);
251
+
252
+ // src/utils/ast.ts
253
+ function createRule(rule) {
254
+ return rule;
255
+ }
256
+ var UI_PACKAGE = "@studiometa/ui";
257
+ var TOOLKIT_PACKAGE = "@studiometa/js-toolkit";
231
258
  function getSuperClassName(node) {
232
259
  if (node.type !== "ClassDeclaration" && node.type !== "ClassExpression") return null;
233
260
  if (!node.superClass) return null;
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../node_modules/@oxlint/plugins/index.js", "../src/utils/ast.ts", "../src/rules/prefer-ui-component.ts", "../src/rules/prefer-transition.ts", "../src/rules/no-manual-fetch.ts", "../src/rules/prefer-data-model.ts", "../src/rules/prefer-action.ts", "../src/index.ts"],
4
- "sourcesContent": ["//#region src-js/package/define.ts\n/**\n* Define a plugin.\n*\n* No-op function, just to provide type safety. Input is passed through unchanged.\n*\n* @param plugin - Plugin to define\n* @returns Same plugin as passed in\n*/\nfunction definePlugin(plugin) {\n\treturn plugin;\n}\n/**\n* Define a rule.\n*\n* No-op function, just to provide type safety. Input is passed through unchanged.\n*\n* @param rule - Rule to define\n* @returns Same rule as passed in\n*/\nfunction defineRule(rule) {\n\treturn rule;\n}\n//#endregion\n//#region src-js/package/compat.ts\nconst EMPTY_VISITOR = {};\n/**\n* Convert a plugin which used Oxlint's `createOnce` API to also work with ESLint.\n*\n* If any of the plugin's rules use the Oxlint alternative `createOnce` API,\n* add ESLint-compatible `create` methods to those rules, which delegate to `createOnce`.\n* This makes the plugin compatible with ESLint.\n*\n* The `plugin` object passed in is mutated in-place.\n*\n* @param plugin - Plugin to convert\n* @returns Plugin with all rules having `create` method\n* @throws {Error} If `plugin` is not an object, or `plugin.rules` is not an object\n*/\nfunction eslintCompatPlugin(plugin) {\n\tif (typeof plugin != \"object\" || !plugin) throw Error(\"Plugin must be an object\");\n\tlet { rules } = plugin;\n\tif (typeof rules != \"object\" || !rules) throw Error(\"Plugin must have an object as `rules` property\");\n\tlet afterHooksState = new AfterHooksState();\n\tfor (let ruleName in rules) Object.hasOwn(rules, ruleName) && convertRule(rules[ruleName], afterHooksState);\n\treturn plugin;\n}\n/**\n* Class containing state for tracking if any `after` hooks for a plugin's rules need to be called.\n*\n* # Aims\n*\n* Aims are:\n* 1. `after` hook of each rule runs after all other AST visit functions, and CFG event handlers.\n* 2. `after` hooks for *all* a plugin's rules run after *all* that plugin's rules have completed visiting AST.\n* 3. `after` hooks for *all* a plugin's rules run before *any* of plugin's rules begin linting another file.\n* 4. In the case of an error during AST traversal, `after` hooks are always still run.\n*\n* The above exactly matches the behavior when running a `createOnce` rule in Oxlint.\n*\n* # Why this is important\n*\n* All the complication comes from ensuring `after` hooks run even after an error during AST traversal.\n*\n* In ESLint CLI, an error will crash the process, so it doesn't particularly matter if `after` hooks run or not,\n* but language servers will typically swallow errors, and keep the process running.\n*\n* Rules using `before` and `after` hooks will often rely on both hooks running in a predictable order,\n* to maintain some internal state. For example, they may use `before` and `after` hooks to maintain a per-file\n* cache of data which is shared between rules. The cache use case is why rule (2) above is important.\n*\n* Below is an example of using `before` and `after` hooks to maintain a per-file cache, shared between rules.\n* It relies on all `before` hooks running before any rule starts visiting the AST,\n* and all `after` hooks running after all rules have finished visiting the AST.\n*\n* ```ts\n* let cache: Data | null = null;\n*\n* let numRunningRules = 0;\n*\n* const setupCache = (context) => {\n* if (cache === null) cache = new Data(context);\n* numRunningRules++;\n* };\n*\n* const teardownCache = () => {\n* numRunningRules--;\n* if (numRunningRules === 0) cache = null;\n* };\n*\n* const rule1 = {\n* createOnce(context) {\n* return {\n* before() {\n* setupCache(context);\n* },\n* Identifier(node) {\n* // Use `cache`\n* },\n* after: teardownCache,\n* };\n* },\n* };\n*\n* const rule2 = {\n* // Same as above\n* };\n*\n* const rule3 = {\n* // Same as above\n* };\n* ```\n*\n* If `after` hooks did not always run, the next lint run could get stale state, and malfunction.\n* If `after` hooks ran in the wrong order (e.g. after some `before` hooks for next file),\n* `numRunningRules` would never get to 0, and cache would never be cleared.\n*\n* Note that because all rules run together in a single AST traversal, if a rule from plugin X throws an error,\n* it can disrupt rules from plugin Y. This would make it hard to debug.\n*\n* # Mechanism\n*\n* ## Initialization\n*\n* Rules with an `after` hook register themselves by:\n*\n* 1. Calling `registerResetFunction` to register a function to run `after` hook and clean up internal state.\n* This call adds the reset fn to `resetFunctions`, and adds `AFTER_HOOK_INACTIVE` to `pendingStates`.\n* 2. Adding an `onCodePathEnd` CFG event handler to the visitor which calls `ruleFinished` at end of AST traversal.\n*\n* ## Per-file setup\n*\n* Before linting a file, `create` will call `setupAfterHook` which is created by `createContextAndVisitor`.\n* This registers that the `after` hook for the rule needs to run, by setting `pendingStates[ruleIndex]`\n* to `AFTER_HOOK_PENDING`, and incrementing `pendingCount`.\n*\n* If a cleanup microtask has not been scheduled yet, one is scheduled now (see reason below).\n*\n* ## Normal operation\n*\n* AST traversal for each rule ends with `ruleFinished` hook being called from `onCodePathEnd` CFG event handler.\n* It increments `lintFinishedCount`. If `lintFinishedCount` equals `pendingCount`, all rules have finished linting\n* the file, and `reset` is called, which calls all the pending `after` hooks.\n*\n* ## Error handling\n*\n* If an error is thrown during AST traversal, we ensure that `after` hooks are still run by 2 mechanisms:\n*\n* ### 1. Next microtick\n*\n* Before any rules began linting files, a microtask was scheduled, which runs on next micro-tick.\n* All language servers we're aware of run each lint task in a separate tick, so this microtask will run in next tick\n* after a linting run, before the next lint task starts.\n*\n* If the linting run completed successfully, the microtask does nothing.\n*\n* But if an error was thrown during AST traversal, this will be visible from the state of `pendingCount`.\n* The microtask will run any `after` hooks which need to be run, and reset state to reflect that there are\n* no more pending `after` hooks.\n*\n* ### 2. Fallback: Next lint run\n*\n* Before linting any file, the state of `pendingCount` is checked.\n* If any `after` hooks are still pending, they are run immediately.\n* They're run before the `context` objects in `createOnce` closures are updated to the next file,\n* so they run with access to the old `context` object from the last file.\n*\n* This fallback should not be required, but it's included as \"belt and braces\", to handle if any language server\n* or other environment running ESLint programmatically, does not pause a tick between linting runs.\n*/\nvar AfterHooksState = class {\n\tresetFunctions = [];\n\tpendingStates = [];\n\tpendingCount = 0;\n\tlintFinishedCount = 0;\n\tresetIsScheduled = !1;\n\tsourceCode = null;\n\tresetMicrotask = this.resetMicrotaskImpl.bind(this);\n\t/**\n\t* Register a function to run `after` hook for a rule, and reset state.\n\t* @param reset - Function to run `after` hook and reset state\n\t* @returns Index of rule\n\t*/\n\tregisterResetFunction(reset) {\n\t\tlet { pendingStates } = this, index = pendingStates.length;\n\t\treturn pendingStates.push(0), this.resetFunctions.push(reset), index;\n\t}\n\t/**\n\t* Register that a rule with `after` hook has completed linting a file.\n\t* Called by `onCodePathEnd` CFG event handler which is added to visitor for rules with `after` hooks.\n\t*\n\t* If all rules with an `after` hook which needs to be run have completed linting the file, run all `after` hooks.\n\t*/\n\truleFinished() {\n\t\tthis.lintFinishedCount++, this.lintFinishedCount === this.pendingCount && this.reset(!1);\n\t}\n\t/**\n\t* Call all reset functions where corresponding entry in `pendingStates` is `AFTER_HOOK_PENDING`.\n\t* Should only be called when some `after` hooks are pending.\n\t*\n\t* @param ignoreErrors - `true` to catch and silently ignore any errors which occur in `after` hooks.\n\t* `false` to throw them,\n\t* @throws {unknown} If `ignoreErrors` is `false` and an error occurs in any `after` hooks.\n\t*/\n\treset(ignoreErrors) {\n\t\tthis.pendingCount;\n\t\tlet { resetFunctions, pendingStates } = this, hooksLen = pendingStates.length, hasError = !1, error;\n\t\tfor (let i = 0; i < hooksLen; i++) if (pendingStates[i] !== 0) {\n\t\t\tpendingStates[i] = 0;\n\t\t\ttry {\n\t\t\t\tresetFunctions[i]();\n\t\t\t} catch (e) {\n\t\t\t\thasError === !1 && (hasError = !0, error = e);\n\t\t\t}\n\t\t}\n\t\tif (this.pendingCount = 0, this.lintFinishedCount = 0, this.sourceCode = null, hasError === !0 && ignoreErrors === !1) throw error;\n\t}\n\t/**\n\t* Schedule a microtask to run `reset` functions.\n\t*/\n\tscheduleReset() {\n\t\tqueueMicrotask(this.resetMicrotask), this.resetIsScheduled = !0;\n\t}\n\t/**\n\t* Function which is scheduled as the cleanup microtask.\n\t* `scheduleReset` uses `resetMicrotask` which is this method bound to `this`.\n\t*/\n\tresetMicrotaskImpl() {\n\t\tthis.resetIsScheduled = !1, this.pendingCount !== 0 && this.reset(!0);\n\t}\n};\n/**\n* Convert a rule.\n*\n* The `rule` object passed in is mutated in-place.\n*\n* @param rule - Rule to convert\n* @param afterHooksState - State of `after` hooks\n* @throws {Error} If `rule` is not an object\n*/\nfunction convertRule(rule, afterHooksState) {\n\tif (typeof rule != \"object\" || !rule) throw Error(\"Rule must be an object\");\n\tif (\"create\" in rule) return;\n\tlet context = null, visitor, beforeHook, setupAfterHook;\n\trule.create = (eslintContext) => {\n\t\tcontext === null && ({context, visitor, beforeHook, setupAfterHook} = createContextAndVisitor(rule, afterHooksState));\n\t\tlet eslintFileContext = Object.getPrototypeOf(eslintContext);\n\t\tif (setupAfterHook !== null) {\n\t\t\tlet { sourceCode } = eslintFileContext;\n\t\t\tafterHooksState.sourceCode !== sourceCode && (afterHooksState.sourceCode = sourceCode, afterHooksState.pendingCount !== 0 && afterHooksState.reset(!0));\n\t\t}\n\t\treturn Object.defineProperties(context, {\n\t\t\tid: { value: eslintContext.id },\n\t\t\toptions: { value: eslintContext.options },\n\t\t\treport: { value: eslintContext.report }\n\t\t}), Object.setPrototypeOf(context, eslintFileContext), beforeHook !== null && beforeHook() === !1 ? EMPTY_VISITOR : (setupAfterHook !== null && (setupAfterHook(eslintFileContext.sourceCode.ast), afterHooksState.resetIsScheduled === !1 && afterHooksState.scheduleReset()), visitor);\n\t};\n}\nconst FILE_CONTEXT = Object.freeze({\n\tget filename() {\n\t\tthrow Error(\"Cannot access `context.filename` in `createOnce`\");\n\t},\n\tgetFilename() {\n\t\tthrow Error(\"Cannot call `context.getFilename` in `createOnce`\");\n\t},\n\tget physicalFilename() {\n\t\tthrow Error(\"Cannot access `context.physicalFilename` in `createOnce`\");\n\t},\n\tgetPhysicalFilename() {\n\t\tthrow Error(\"Cannot call `context.getPhysicalFilename` in `createOnce`\");\n\t},\n\tget cwd() {\n\t\tthrow Error(\"Cannot access `context.cwd` in `createOnce`\");\n\t},\n\tgetCwd() {\n\t\tthrow Error(\"Cannot call `context.getCwd` in `createOnce`\");\n\t},\n\tget sourceCode() {\n\t\tthrow Error(\"Cannot access `context.sourceCode` in `createOnce`\");\n\t},\n\tgetSourceCode() {\n\t\tthrow Error(\"Cannot call `context.getSourceCode` in `createOnce`\");\n\t},\n\tget languageOptions() {\n\t\tthrow Error(\"Cannot access `context.languageOptions` in `createOnce`\");\n\t},\n\tget settings() {\n\t\tthrow Error(\"Cannot access `context.settings` in `createOnce`\");\n\t},\n\textend(extension) {\n\t\treturn Object.freeze(Object.assign(Object.create(this), extension));\n\t},\n\tget parserOptions() {\n\t\tthrow Error(\"Cannot access `context.parserOptions` in `createOnce`\");\n\t},\n\tget parserPath() {\n\t\tthrow Error(\"Cannot access `context.parserPath` in `createOnce`\");\n\t}\n});\n/**\n* Call `createOnce` method of rule, and return `Context`, `Visitor`, and `beforeHook` (if any).\n*\n* @param rule - Rule with `createOnce` method\n* @param afterHooksState - State of `after` hooks\n* @returns Object with `context`, `visitor`, and `beforeHook` properties,\n* and `setupAfterHook` function if visitor has an `after` hook\n*/\nfunction createContextAndVisitor(rule, afterHooksState) {\n\tlet { createOnce } = rule;\n\tif (createOnce == null) throw Error(\"Rules must define either a `create` or `createOnce` method\");\n\tif (typeof createOnce != \"function\") throw Error(\"Rule `createOnce` property must be a function\");\n\tlet context = Object.create(FILE_CONTEXT, {\n\t\tid: {\n\t\t\tvalue: null,\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0\n\t\t},\n\t\toptions: {\n\t\t\tvalue: null,\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0\n\t\t},\n\t\treport: {\n\t\t\tvalue() {\n\t\t\t\tthrow Error(\"Cannot report errors in `createOnce`\");\n\t\t\t},\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0\n\t\t}\n\t}), { before: beforeHook, after: afterHook, ...visitor } = createOnce.call(rule, context);\n\tif (beforeHook === void 0) beforeHook = null;\n\telse if (beforeHook !== null && typeof beforeHook != \"function\") throw Error(\"`before` property of visitor must be a function if defined\");\n\tlet setupAfterHook = null;\n\tif (afterHook != null) {\n\t\tif (typeof afterHook != \"function\") throw Error(\"`after` property of visitor must be a function if defined\");\n\t\tlet program = null, ruleIndex = afterHooksState.registerResetFunction(() => {\n\t\t\tprogram = null, afterHook();\n\t\t});\n\t\tsetupAfterHook = (ast) => {\n\t\t\tprogram = ast, afterHooksState.pendingStates[ruleIndex] = 1, afterHooksState.pendingCount++;\n\t\t};\n\t\tlet onCodePathEnd = visitor.onCodePathEnd;\n\t\tvisitor.onCodePathEnd = onCodePathEnd == null ? function(_codePath, node) {\n\t\t\tnode === program && afterHooksState.ruleFinished();\n\t\t} : function(codePath, node) {\n\t\t\tonCodePathEnd.call(this, codePath, node), node === program && afterHooksState.ruleFinished();\n\t\t};\n\t}\n\treturn {\n\t\tcontext,\n\t\tvisitor,\n\t\tbeforeHook,\n\t\tsetupAfterHook\n\t};\n}\n//#endregion\nexport { definePlugin, defineRule, eslintCompatPlugin };\n", "export type Node = Record<string, any>;\nexport type RuleContext = Record<string, any>;\n\nexport type RuleMeta = {\n type?: 'problem' | 'suggestion' | 'layout';\n fixable?: 'code' | 'whitespace';\n hasSuggestions?: boolean;\n docs?: { description?: string };\n messages?: Record<string, string>;\n};\n\nexport function createRule<V extends Record<string, (node: Node) => unknown>>(rule: {\n meta?: RuleMeta;\n createOnce(context: RuleContext): V;\n}): { meta?: RuleMeta; createOnce(context: RuleContext): V } {\n return rule;\n}\n\nexport const UI_PACKAGE = '@studiometa/ui';\nexport const TOOLKIT_PACKAGE = '@studiometa/js-toolkit';\n\n/**\n * All component names exported by @studiometa/ui.\n * Keep in sync with packages/ui/index.ts exports.\n */\nexport const UI_COMPONENT_NAMES = new Set([\n 'Accordion',\n 'AccordionItem',\n 'Action',\n 'AnchorNav',\n 'AnchorNavLink',\n 'AnchorNavTarget',\n 'CircularMarquee',\n 'Cursor',\n 'DataBind',\n 'DataComputed',\n 'DataEffect',\n 'DataModel',\n 'DataScope',\n 'Draggable',\n 'Figure',\n 'FigureVideo',\n 'Frame',\n 'FrameAnchor',\n 'FrameForm',\n 'FrameTarget',\n 'FrameLoader',\n 'Hoverable',\n 'LargeText',\n 'LazyInclude',\n 'Menu',\n 'MenuBtn',\n 'MenuList',\n 'Modal',\n 'Panel',\n 'AbstractPrefetch',\n 'PrefetchWhenOver',\n 'PrefetchWhenVisible',\n 'AbstractScrollAnimation',\n 'ScrollAnimationTimeline',\n 'ScrollAnimationTarget',\n 'ScrollReveal',\n 'Sentinel',\n 'Slider',\n 'SliderItem',\n 'SliderDrag',\n 'Sticky',\n 'Tabs',\n 'Transition',\n]);\n\n/**\n * Returns the local name of the superclass for a class declaration/expression.\n */\nexport function getSuperClassName(node: Node): string | null {\n if (node.type !== 'ClassDeclaration' && node.type !== 'ClassExpression') return null;\n if (!node.superClass) return null;\n if (node.superClass.type === 'Identifier') return node.superClass.name;\n return null;\n}\n\n/**\n * Returns true when a class extends Base (directly or via a toolkit import).\n */\nexport function isBaseSubclass(node: Node, context: RuleContext): boolean {\n const superName = getSuperClassName(node);\n if (!superName) return false;\n if (superName === 'Base') return true;\n\n const sourceCode = context.sourceCode ?? context.getSourceCode?.();\n const ast = sourceCode?.ast;\n if (!ast) return false;\n\n for (const n of ast.body) {\n if (n.type !== 'ImportDeclaration') continue;\n if (n.source.value !== TOOLKIT_PACKAGE) continue;\n for (const specifier of n.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.local.name === superName) return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true when a class extends a component imported from @studiometa/ui.\n */\nexport function isUISubclass(node: Node, context: RuleContext): boolean {\n const superName = getSuperClassName(node);\n if (!superName) return false;\n\n const sourceCode = context.sourceCode ?? context.getSourceCode?.();\n const ast = sourceCode?.ast;\n if (!ast) return false;\n\n for (const n of ast.body) {\n if (n.type !== 'ImportDeclaration') continue;\n if (n.source.value !== UI_PACKAGE) continue;\n for (const specifier of n.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.local.name === superName) return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true when className is already imported from @studiometa/ui.\n */\nexport function isImportedFromUI(className: string, context: RuleContext): boolean {\n const sourceCode = context.sourceCode ?? context.getSourceCode?.();\n const ast = sourceCode?.ast;\n if (!ast) return false;\n\n for (const n of ast.body) {\n if (n.type !== 'ImportDeclaration') continue;\n if (n.source.value !== UI_PACKAGE) continue;\n for (const specifier of n.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.imported?.name === className)\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Walks up ancestor nodes to find the nearest class declaration/expression.\n */\nexport function findEnclosingClass(ancestors: Node[]): Node | null {\n for (let i = ancestors.length - 1; i >= 0; i--) {\n const node = ancestors[i];\n if (node.type === 'ClassDeclaration' || node.type === 'ClassExpression') return node;\n }\n return null;\n}\n\nexport function getAncestors(context: RuleContext, node: Node): Node[] {\n return context.getAncestors?.() ?? context.sourceCode?.getAncestors?.(node) ?? [];\n}\n\n/**\n * Returns all method definitions in a class body by name.\n */\nexport function getClassMethods(classNode: Node): Map<string, Node> {\n const methods = new Map<string, Node>();\n for (const member of classNode.body?.body ?? []) {\n if (member.type === 'MethodDefinition' && member.key?.type === 'Identifier') {\n methods.set(member.key.name, member);\n }\n }\n return methods;\n}\n", "import {\n UI_COMPONENT_NAMES,\n isBaseSubclass,\n isImportedFromUI,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\nexport const preferUiComponent = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer importing components from @studiometa/ui over reimplementing them from scratch',\n },\n messages: {\n preferImport:\n '\"{{name}}\" is available in @studiometa/ui. ' +\n 'Extend it instead of reimplementing from Base: import { {{name}} } from \\'@studiometa/ui\\'.',\n },\n },\n createOnce(context: RuleContext) {\n return {\n ClassDeclaration(node: Node) {\n check(node, context);\n },\n ClassExpression(node: Node) {\n check(node, context);\n },\n };\n },\n});\n\nfunction check(node: Node, context: RuleContext) {\n const name: string = node.id?.name ?? '';\n if (!name || !UI_COMPONENT_NAMES.has(name)) return;\n if (!isBaseSubclass(node, context)) return;\n // Already importing it from @studiometa/ui \u2014 they're extending it properly\n if (isImportedFromUI(name, context)) return;\n\n context.report({ node: node.id ?? node, messageId: 'preferImport', data: { name } });\n}\n", "import {\n isBaseSubclass,\n isImportedFromUI,\n getClassMethods,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\n/**\n * Detect classes that extend Base and define both open() and close() methods \u2014\n * a pattern that duplicates what Transition (or Modal) already provides.\n */\nexport const preferTransition = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer @studiometa/ui Transition over manually implementing open/close logic in a Base subclass',\n },\n messages: {\n preferTransition:\n 'This class manually implements open() and close() methods. ' +\n 'Consider extending Transition from @studiometa/ui instead, which handles show/hide with CSS class transitions: ' +\n \"import { Transition } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n return {\n ClassDeclaration(node: Node) {\n check(node, context);\n },\n ClassExpression(node: Node) {\n check(node, context);\n },\n };\n },\n});\n\nfunction check(node: Node, context: RuleContext) {\n if (!isBaseSubclass(node, context)) return;\n // Already using a @studiometa/ui component as the base\n if (isImportedFromUI(node.superClass?.name, context)) return;\n\n const methods = getClassMethods(node);\n if (!methods.has('open') || !methods.has('close')) return;\n\n context.report({ node: node.id ?? node, messageId: 'preferTransition' });\n}\n", "import {\n findEnclosingClass,\n isBaseSubclass,\n isImportedFromUI,\n getAncestors,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\nconst DOM_WRITE_METHODS = new Set(['insertAdjacentHTML', 'insertAdjacentElement']);\n\n/**\n * Detect manual fetch() calls inside Base subclasses that also write to innerHTML\n * or use insertAdjacentHTML \u2014 suggest using the Fetch component from @studiometa/ui.\n */\nexport const noManualFetch = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer the Fetch component from @studiometa/ui over manually fetching and injecting HTML',\n },\n messages: {\n preferFetch:\n 'Manual fetch() with DOM injection detected. ' +\n \"Consider using the Fetch component from @studiometa/ui instead: import { Fetch } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n const classesWithFetch = new WeakSet<Node>();\n const classesWithDomWrite = new WeakSet<Node>();\n const reported = new WeakSet<Node>();\n\n function getEnclosingBaseClass(node: Node): Node | null {\n const ancestors = getAncestors(context, node);\n const cls = findEnclosingClass(ancestors);\n if (!cls || !isBaseSubclass(cls, context)) return null;\n if (isImportedFromUI('Fetch', context)) return null;\n return cls;\n }\n\n function maybeReport(cls: Node) {\n if (reported.has(cls)) return;\n if (classesWithFetch.has(cls) && classesWithDomWrite.has(cls)) {\n reported.add(cls);\n context.report({ node: cls.id ?? cls, messageId: 'preferFetch' });\n }\n }\n\n return {\n CallExpression(node: Node) {\n const callee = node.callee;\n\n // Detect fetch(url)\n const isFetch =\n (callee.type === 'Identifier' && callee.name === 'fetch') ||\n (callee.type === 'MemberExpression' &&\n callee.property?.name === 'fetch' &&\n callee.object?.type === 'ThisExpression');\n\n // Detect el.insertAdjacentHTML / el.insertAdjacentElement\n const isDomWrite =\n callee.type === 'MemberExpression' &&\n DOM_WRITE_METHODS.has(callee.property?.name);\n\n if (!isFetch && !isDomWrite) return;\n\n const cls = getEnclosingBaseClass(node);\n if (!cls) return;\n\n if (isFetch) classesWithFetch.add(cls);\n if (isDomWrite) classesWithDomWrite.add(cls);\n\n maybeReport(cls);\n },\n\n AssignmentExpression(node: Node) {\n const left = node.left;\n if (left.type !== 'MemberExpression') return;\n if (left.property?.name !== 'innerHTML') return;\n\n const cls = getEnclosingBaseClass(node);\n if (!cls) return;\n\n classesWithDomWrite.add(cls);\n maybeReport(cls);\n },\n };\n },\n});\n", "import {\n findEnclosingClass,\n isBaseSubclass,\n isImportedFromUI,\n getAncestors,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\n/**\n * Detect manual input/change event listeners that update DOM \u2014 suggest DataModel/DataEffect.\n *\n * Signal: addEventListener('input', ...) or an onInput* method that writes to\n * textContent / innerHTML / value on another element inside a Base subclass.\n */\n/** Walk up a member expression chain and check if the root is this.$refs / this.$el / this.$children */\nfunction isThisComponentAccess(node: Node): boolean {\n let current = node;\n while (current?.type === 'MemberExpression') {\n if (\n current.object?.type === 'ThisExpression' &&\n (current.property?.name === '$refs' ||\n current.property?.name === '$el' ||\n current.property?.name === '$children')\n ) {\n return true;\n }\n current = current.object;\n }\n return false;\n}\n\nexport const preferDataModel = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer DataModel/DataEffect from @studiometa/ui over manually syncing input values to the DOM',\n },\n messages: {\n preferDataModel:\n 'Manual input\u2192DOM synchronization detected. ' +\n 'Consider using DataModel and DataEffect from @studiometa/ui for reactive bindings: ' +\n \"import { DataModel, DataEffect } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n const classesWithInputListener = new WeakSet<Node>();\n const classesWithDomWrite = new WeakSet<Node>();\n const reported = new WeakSet<Node>();\n\n function getEnclosingBaseClass(node: Node): Node | null {\n const ancestors = getAncestors(context, node);\n const cls = findEnclosingClass(ancestors);\n if (!cls || !isBaseSubclass(cls, context)) return null;\n if (isImportedFromUI('DataModel', context) || isImportedFromUI('DataEffect', context))\n return null;\n return cls;\n }\n\n function maybeReport(cls: Node) {\n if (reported.has(cls)) return;\n if (classesWithInputListener.has(cls) && classesWithDomWrite.has(cls)) {\n reported.add(cls);\n context.report({ node: cls.id ?? cls, messageId: 'preferDataModel' });\n }\n }\n\n return {\n // Detect on-handler methods named onInput*, onChange*, onModelInput, etc.\n MethodDefinition(node: Node) {\n const name: string = node.key?.name ?? '';\n if (!/^on.*(Input|Change|Model)/i.test(name)) return;\n\n const ancestors = getAncestors(context, node);\n const cls = findEnclosingClass(ancestors);\n if (!cls || !isBaseSubclass(cls, context)) return;\n if (isImportedFromUI('DataModel', context)) return;\n\n classesWithInputListener.add(cls);\n maybeReport(cls);\n },\n\n AssignmentExpression(node: Node) {\n const left = node.left;\n if (left.type !== 'MemberExpression') return;\n\n const prop = left.property?.name;\n const isDomWrite =\n prop === 'textContent' || prop === 'innerHTML' || prop === 'value';\n if (!isDomWrite) return;\n\n // Must ultimately access this.$refs, this.$el, or this.$children\n if (!isThisComponentAccess(left.object)) return;\n\n const cls = getEnclosingBaseClass(node);\n if (!cls) return;\n\n classesWithDomWrite.add(cls);\n maybeReport(cls);\n },\n };\n },\n});\n", "import {\n isBaseSubclass,\n getClassMethods,\n isImportedFromUI,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\n/**\n * Simple event handler method names that the Action component already handles.\n * These are on-handler names on this.$el (root element) \u2014 if the class body\n * contains ONLY these kinds of methods (plus config), it's a good Action candidate.\n */\nconst ACTION_EVENT_METHODS = new Set([\n 'onClick',\n 'onMouseenter',\n 'onMouseleave',\n 'onMouseover',\n 'onMouseout',\n 'onFocus',\n 'onBlur',\n 'onKeydown',\n 'onKeyup',\n 'onKeypress',\n 'onPointerenter',\n 'onPointerleave',\n 'onPointerdown',\n 'onPointerup',\n]);\n\nconst NON_LOGIC_METHODS = new Set(['mounted', 'destroyed', 'updated']);\n\n/**\n * Detect Base subclasses whose only logic is a single simple event handler\n * (onClick, onMouseenter, etc.) \u2014 these can be replaced by the Action component.\n */\nexport const preferAction = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer the Action component from @studiometa/ui for simple event-triggered effects',\n },\n messages: {\n preferAction:\n 'This component only handles \"{{method}}\" on the root element. ' +\n 'Consider using the Action component from @studiometa/ui instead, ' +\n \"which declaratively wires events to effects via data attributes: import { Action } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n return {\n ClassDeclaration(node: Node) {\n check(node, context);\n },\n ClassExpression(node: Node) {\n check(node, context);\n },\n };\n },\n});\n\nfunction check(node: Node, context: RuleContext) {\n if (!isBaseSubclass(node, context)) return;\n if (isImportedFromUI('Action', context)) return;\n\n const methods = getClassMethods(node);\n\n // Find action-handler methods defined in this class\n const actionMethods: string[] = [];\n const otherMethods: string[] = [];\n\n for (const [name] of methods) {\n if (ACTION_EVENT_METHODS.has(name)) {\n actionMethods.push(name);\n } else if (name !== 'config' && !NON_LOGIC_METHODS.has(name)) {\n otherMethods.push(name);\n }\n }\n\n // Only flag when: exactly one action method, no other logic methods\n if (actionMethods.length !== 1 || otherMethods.length > 0) return;\n\n // Check the method body is simple \u2014 does not access this.$children or this.$refs\n // to avoid false positives on components that orchestrate children\n const method = methods.get(actionMethods[0])!;\n if (hasComplexBody(method)) return;\n\n context.report({\n node: node.id ?? node,\n messageId: 'preferAction',\n data: { method: actionMethods[0] },\n });\n}\n\nfunction hasComplexBody(methodNode: Node): boolean {\n let complex = false;\n\n function walk(n: Node) {\n if (complex) return;\n if (!n || typeof n !== 'object') return;\n\n // Accessing $children or using await suggests complex logic\n if (\n n.type === 'MemberExpression' &&\n n.object?.type === 'ThisExpression' &&\n (n.property?.name === '$children' || n.property?.name === '$root')\n ) {\n complex = true;\n return;\n }\n\n for (const key of Object.keys(n)) {\n if (key === 'parent') continue;\n const child = n[key];\n if (Array.isArray(child)) child.forEach(walk);\n else if (child && typeof child === 'object' && child.type) walk(child);\n }\n }\n\n walk(methodNode.value ?? methodNode);\n return complex;\n}\n", "import { eslintCompatPlugin } from '@oxlint/plugins';\nimport {\n preferUiComponent,\n preferTransition,\n noManualFetch,\n preferDataModel,\n preferAction,\n} from './rules/index.ts';\n\nconst PLUGIN_NAME = 'ui';\n\nconst rules = {\n 'prefer-ui-component': preferUiComponent,\n 'prefer-transition': preferTransition,\n 'no-manual-fetch': noManualFetch,\n 'prefer-data-model': preferDataModel,\n 'prefer-action': preferAction,\n};\n\nconst recommendedRules: Record<string, string> = {\n [`${PLUGIN_NAME}/prefer-ui-component`]: 'warn',\n [`${PLUGIN_NAME}/prefer-transition`]: 'warn',\n [`${PLUGIN_NAME}/no-manual-fetch`]: 'warn',\n [`${PLUGIN_NAME}/prefer-data-model`]: 'warn',\n [`${PLUGIN_NAME}/prefer-action`]: 'warn',\n};\n\nconst base = eslintCompatPlugin({\n meta: {\n name: '@studiometa/eslint-plugin-ui',\n },\n rules,\n});\n\nconst plugin = Object.assign(base, { configs: {} as Record<string, object> });\n\nplugin.configs['recommended']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AAqB;AAAA,EACrB,iBAAiB;AACnB;AAEA,IAAM,mBAA2C;AAAA,EAC/C,CAAC,GAAG,WAAW,sBAAsB,GAAG;AAAA,EACxC,CAAC,GAAG,WAAW,oBAAoB,GAAG;AAAA,EACtC,CAAC,GAAG,WAAW,kBAAkB,GAAG;AAAA,EACpC,CAAC,GAAG,WAAW,oBAAoB,GAAG;AAAA,EACtC,CAAC,GAAG,WAAW,gBAAgB,GAAG;AACpC;AAEA,IAAM,OAAO,mBAAmB;AAAA,EAC9B,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA;AACF,CAAC;AAED,IAAM,SAAS,OAAO,OAAO,MAAM,EAAE,SAAS,CAAC,EAA4B,CAAC;AAE5E,OAAO,QAAQ,aAAa,IAAI;AAAA,EAC9B,SAAS,EAAE,CAAC,WAAW,GAAG,OAAO;AAAA,EACjC,OAAO;AACT;AAEA,IAAO,gBAAQ;",
3
+ "sources": ["../../../node_modules/@oxlint/plugins/index.js", "../src/utils/component-names.ts", "../src/utils/ast.ts", "../src/rules/prefer-ui-component.ts", "../src/rules/prefer-transition.ts", "../src/rules/no-manual-fetch.ts", "../src/rules/prefer-data-model.ts", "../src/rules/prefer-action.ts", "../src/index.ts"],
4
+ "sourcesContent": ["//#region src-js/package/define.ts\n/**\n* Define a plugin.\n*\n* No-op function, just to provide type safety. Input is passed through unchanged.\n*\n* @param plugin - Plugin to define\n* @returns Same plugin as passed in\n*/\nfunction definePlugin(plugin) {\n\treturn plugin;\n}\n/**\n* Define a rule.\n*\n* No-op function, just to provide type safety. Input is passed through unchanged.\n*\n* @param rule - Rule to define\n* @returns Same rule as passed in\n*/\nfunction defineRule(rule) {\n\treturn rule;\n}\n//#endregion\n//#region src-js/package/compat.ts\nconst EMPTY_VISITOR = {};\n/**\n* Convert a plugin which used Oxlint's `createOnce` API to also work with ESLint.\n*\n* If any of the plugin's rules use the Oxlint alternative `createOnce` API,\n* add ESLint-compatible `create` methods to those rules, which delegate to `createOnce`.\n* This makes the plugin compatible with ESLint.\n*\n* The `plugin` object passed in is mutated in-place.\n*\n* @param plugin - Plugin to convert\n* @returns Plugin with all rules having `create` method\n* @throws {Error} If `plugin` is not an object, or `plugin.rules` is not an object\n*/\nfunction eslintCompatPlugin(plugin) {\n\tif (typeof plugin != \"object\" || !plugin) throw Error(\"Plugin must be an object\");\n\tlet { rules } = plugin;\n\tif (typeof rules != \"object\" || !rules) throw Error(\"Plugin must have an object as `rules` property\");\n\tlet afterHooksState = new AfterHooksState();\n\tfor (let ruleName in rules) Object.hasOwn(rules, ruleName) && convertRule(rules[ruleName], afterHooksState);\n\treturn plugin;\n}\n/**\n* Class containing state for tracking if any `after` hooks for a plugin's rules need to be called.\n*\n* # Aims\n*\n* Aims are:\n* 1. `after` hook of each rule runs after all other AST visit functions, and CFG event handlers.\n* 2. `after` hooks for *all* a plugin's rules run after *all* that plugin's rules have completed visiting AST.\n* 3. `after` hooks for *all* a plugin's rules run before *any* of plugin's rules begin linting another file.\n* 4. In the case of an error during AST traversal, `after` hooks are always still run.\n*\n* The above exactly matches the behavior when running a `createOnce` rule in Oxlint.\n*\n* # Why this is important\n*\n* All the complication comes from ensuring `after` hooks run even after an error during AST traversal.\n*\n* In ESLint CLI, an error will crash the process, so it doesn't particularly matter if `after` hooks run or not,\n* but language servers will typically swallow errors, and keep the process running.\n*\n* Rules using `before` and `after` hooks will often rely on both hooks running in a predictable order,\n* to maintain some internal state. For example, they may use `before` and `after` hooks to maintain a per-file\n* cache of data which is shared between rules. The cache use case is why rule (2) above is important.\n*\n* Below is an example of using `before` and `after` hooks to maintain a per-file cache, shared between rules.\n* It relies on all `before` hooks running before any rule starts visiting the AST,\n* and all `after` hooks running after all rules have finished visiting the AST.\n*\n* ```ts\n* let cache: Data | null = null;\n*\n* let numRunningRules = 0;\n*\n* const setupCache = (context) => {\n* if (cache === null) cache = new Data(context);\n* numRunningRules++;\n* };\n*\n* const teardownCache = () => {\n* numRunningRules--;\n* if (numRunningRules === 0) cache = null;\n* };\n*\n* const rule1 = {\n* createOnce(context) {\n* return {\n* before() {\n* setupCache(context);\n* },\n* Identifier(node) {\n* // Use `cache`\n* },\n* after: teardownCache,\n* };\n* },\n* };\n*\n* const rule2 = {\n* // Same as above\n* };\n*\n* const rule3 = {\n* // Same as above\n* };\n* ```\n*\n* If `after` hooks did not always run, the next lint run could get stale state, and malfunction.\n* If `after` hooks ran in the wrong order (e.g. after some `before` hooks for next file),\n* `numRunningRules` would never get to 0, and cache would never be cleared.\n*\n* Note that because all rules run together in a single AST traversal, if a rule from plugin X throws an error,\n* it can disrupt rules from plugin Y. This would make it hard to debug.\n*\n* # Mechanism\n*\n* ## Initialization\n*\n* Rules with an `after` hook register themselves by:\n*\n* 1. Calling `registerResetFunction` to register a function to run `after` hook and clean up internal state.\n* This call adds the reset fn to `resetFunctions`, and adds `AFTER_HOOK_INACTIVE` to `pendingStates`.\n* 2. Adding an `onCodePathEnd` CFG event handler to the visitor which calls `ruleFinished` at end of AST traversal.\n*\n* ## Per-file setup\n*\n* Before linting a file, `create` will call `setupAfterHook` which is created by `createContextAndVisitor`.\n* This registers that the `after` hook for the rule needs to run, by setting `pendingStates[ruleIndex]`\n* to `AFTER_HOOK_PENDING`, and incrementing `pendingCount`.\n*\n* If a cleanup microtask has not been scheduled yet, one is scheduled now (see reason below).\n*\n* ## Normal operation\n*\n* AST traversal for each rule ends with `ruleFinished` hook being called from `onCodePathEnd` CFG event handler.\n* It increments `lintFinishedCount`. If `lintFinishedCount` equals `pendingCount`, all rules have finished linting\n* the file, and `reset` is called, which calls all the pending `after` hooks.\n*\n* ## Error handling\n*\n* If an error is thrown during AST traversal, we ensure that `after` hooks are still run by 2 mechanisms:\n*\n* ### 1. Next microtick\n*\n* Before any rules began linting files, a microtask was scheduled, which runs on next micro-tick.\n* All language servers we're aware of run each lint task in a separate tick, so this microtask will run in next tick\n* after a linting run, before the next lint task starts.\n*\n* If the linting run completed successfully, the microtask does nothing.\n*\n* But if an error was thrown during AST traversal, this will be visible from the state of `pendingCount`.\n* The microtask will run any `after` hooks which need to be run, and reset state to reflect that there are\n* no more pending `after` hooks.\n*\n* ### 2. Fallback: Next lint run\n*\n* Before linting any file, the state of `pendingCount` is checked.\n* If any `after` hooks are still pending, they are run immediately.\n* They're run before the `context` objects in `createOnce` closures are updated to the next file,\n* so they run with access to the old `context` object from the last file.\n*\n* This fallback should not be required, but it's included as \"belt and braces\", to handle if any language server\n* or other environment running ESLint programmatically, does not pause a tick between linting runs.\n*/\nvar AfterHooksState = class {\n\tresetFunctions = [];\n\tpendingStates = [];\n\tpendingCount = 0;\n\tlintFinishedCount = 0;\n\tresetIsScheduled = !1;\n\tsourceCode = null;\n\tresetMicrotask = this.resetMicrotaskImpl.bind(this);\n\t/**\n\t* Register a function to run `after` hook for a rule, and reset state.\n\t* @param reset - Function to run `after` hook and reset state\n\t* @returns Index of rule\n\t*/\n\tregisterResetFunction(reset) {\n\t\tlet { pendingStates } = this, index = pendingStates.length;\n\t\treturn pendingStates.push(0), this.resetFunctions.push(reset), index;\n\t}\n\t/**\n\t* Register that a rule with `after` hook has completed linting a file.\n\t* Called by `onCodePathEnd` CFG event handler which is added to visitor for rules with `after` hooks.\n\t*\n\t* If all rules with an `after` hook which needs to be run have completed linting the file, run all `after` hooks.\n\t*/\n\truleFinished() {\n\t\tthis.lintFinishedCount++, this.lintFinishedCount === this.pendingCount && this.reset(!1);\n\t}\n\t/**\n\t* Call all reset functions where corresponding entry in `pendingStates` is `AFTER_HOOK_PENDING`.\n\t* Should only be called when some `after` hooks are pending.\n\t*\n\t* @param ignoreErrors - `true` to catch and silently ignore any errors which occur in `after` hooks.\n\t* `false` to throw them,\n\t* @throws {unknown} If `ignoreErrors` is `false` and an error occurs in any `after` hooks.\n\t*/\n\treset(ignoreErrors) {\n\t\tthis.pendingCount;\n\t\tlet { resetFunctions, pendingStates } = this, hooksLen = pendingStates.length, hasError = !1, error;\n\t\tfor (let i = 0; i < hooksLen; i++) if (pendingStates[i] !== 0) {\n\t\t\tpendingStates[i] = 0;\n\t\t\ttry {\n\t\t\t\tresetFunctions[i]();\n\t\t\t} catch (e) {\n\t\t\t\thasError === !1 && (hasError = !0, error = e);\n\t\t\t}\n\t\t}\n\t\tif (this.pendingCount = 0, this.lintFinishedCount = 0, this.sourceCode = null, hasError === !0 && ignoreErrors === !1) throw error;\n\t}\n\t/**\n\t* Schedule a microtask to run `reset` functions.\n\t*/\n\tscheduleReset() {\n\t\tqueueMicrotask(this.resetMicrotask), this.resetIsScheduled = !0;\n\t}\n\t/**\n\t* Function which is scheduled as the cleanup microtask.\n\t* `scheduleReset` uses `resetMicrotask` which is this method bound to `this`.\n\t*/\n\tresetMicrotaskImpl() {\n\t\tthis.resetIsScheduled = !1, this.pendingCount !== 0 && this.reset(!0);\n\t}\n};\n/**\n* Convert a rule.\n*\n* The `rule` object passed in is mutated in-place.\n*\n* @param rule - Rule to convert\n* @param afterHooksState - State of `after` hooks\n* @throws {Error} If `rule` is not an object\n*/\nfunction convertRule(rule, afterHooksState) {\n\tif (typeof rule != \"object\" || !rule) throw Error(\"Rule must be an object\");\n\tif (\"create\" in rule) return;\n\tlet context = null, visitor, beforeHook, setupAfterHook;\n\trule.create = (eslintContext) => {\n\t\tcontext === null && ({context, visitor, beforeHook, setupAfterHook} = createContextAndVisitor(rule, afterHooksState));\n\t\tlet eslintFileContext = Object.getPrototypeOf(eslintContext);\n\t\tif (setupAfterHook !== null) {\n\t\t\tlet { sourceCode } = eslintFileContext;\n\t\t\tafterHooksState.sourceCode !== sourceCode && (afterHooksState.sourceCode = sourceCode, afterHooksState.pendingCount !== 0 && afterHooksState.reset(!0));\n\t\t}\n\t\treturn Object.defineProperties(context, {\n\t\t\tid: { value: eslintContext.id },\n\t\t\toptions: { value: eslintContext.options },\n\t\t\treport: { value: eslintContext.report }\n\t\t}), Object.setPrototypeOf(context, eslintFileContext), beforeHook !== null && beforeHook() === !1 ? EMPTY_VISITOR : (setupAfterHook !== null && (setupAfterHook(eslintFileContext.sourceCode.ast), afterHooksState.resetIsScheduled === !1 && afterHooksState.scheduleReset()), visitor);\n\t};\n}\nconst FILE_CONTEXT = Object.freeze({\n\tget filename() {\n\t\tthrow Error(\"Cannot access `context.filename` in `createOnce`\");\n\t},\n\tgetFilename() {\n\t\tthrow Error(\"Cannot call `context.getFilename` in `createOnce`\");\n\t},\n\tget physicalFilename() {\n\t\tthrow Error(\"Cannot access `context.physicalFilename` in `createOnce`\");\n\t},\n\tgetPhysicalFilename() {\n\t\tthrow Error(\"Cannot call `context.getPhysicalFilename` in `createOnce`\");\n\t},\n\tget cwd() {\n\t\tthrow Error(\"Cannot access `context.cwd` in `createOnce`\");\n\t},\n\tgetCwd() {\n\t\tthrow Error(\"Cannot call `context.getCwd` in `createOnce`\");\n\t},\n\tget sourceCode() {\n\t\tthrow Error(\"Cannot access `context.sourceCode` in `createOnce`\");\n\t},\n\tgetSourceCode() {\n\t\tthrow Error(\"Cannot call `context.getSourceCode` in `createOnce`\");\n\t},\n\tget languageOptions() {\n\t\tthrow Error(\"Cannot access `context.languageOptions` in `createOnce`\");\n\t},\n\tget settings() {\n\t\tthrow Error(\"Cannot access `context.settings` in `createOnce`\");\n\t},\n\textend(extension) {\n\t\treturn Object.freeze(Object.assign(Object.create(this), extension));\n\t},\n\tget parserOptions() {\n\t\tthrow Error(\"Cannot access `context.parserOptions` in `createOnce`\");\n\t},\n\tget parserPath() {\n\t\tthrow Error(\"Cannot access `context.parserPath` in `createOnce`\");\n\t}\n});\n/**\n* Call `createOnce` method of rule, and return `Context`, `Visitor`, and `beforeHook` (if any).\n*\n* @param rule - Rule with `createOnce` method\n* @param afterHooksState - State of `after` hooks\n* @returns Object with `context`, `visitor`, and `beforeHook` properties,\n* and `setupAfterHook` function if visitor has an `after` hook\n*/\nfunction createContextAndVisitor(rule, afterHooksState) {\n\tlet { createOnce } = rule;\n\tif (createOnce == null) throw Error(\"Rules must define either a `create` or `createOnce` method\");\n\tif (typeof createOnce != \"function\") throw Error(\"Rule `createOnce` property must be a function\");\n\tlet context = Object.create(FILE_CONTEXT, {\n\t\tid: {\n\t\t\tvalue: null,\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0\n\t\t},\n\t\toptions: {\n\t\t\tvalue: null,\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0\n\t\t},\n\t\treport: {\n\t\t\tvalue() {\n\t\t\t\tthrow Error(\"Cannot report errors in `createOnce`\");\n\t\t\t},\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0\n\t\t}\n\t}), { before: beforeHook, after: afterHook, ...visitor } = createOnce.call(rule, context);\n\tif (beforeHook === void 0) beforeHook = null;\n\telse if (beforeHook !== null && typeof beforeHook != \"function\") throw Error(\"`before` property of visitor must be a function if defined\");\n\tlet setupAfterHook = null;\n\tif (afterHook != null) {\n\t\tif (typeof afterHook != \"function\") throw Error(\"`after` property of visitor must be a function if defined\");\n\t\tlet program = null, ruleIndex = afterHooksState.registerResetFunction(() => {\n\t\t\tprogram = null, afterHook();\n\t\t});\n\t\tsetupAfterHook = (ast) => {\n\t\t\tprogram = ast, afterHooksState.pendingStates[ruleIndex] = 1, afterHooksState.pendingCount++;\n\t\t};\n\t\tlet onCodePathEnd = visitor.onCodePathEnd;\n\t\tvisitor.onCodePathEnd = onCodePathEnd == null ? function(_codePath, node) {\n\t\t\tnode === program && afterHooksState.ruleFinished();\n\t\t} : function(codePath, node) {\n\t\t\tonCodePathEnd.call(this, codePath, node), node === program && afterHooksState.ruleFinished();\n\t\t};\n\t}\n\treturn {\n\t\tcontext,\n\t\tvisitor,\n\t\tbeforeHook,\n\t\tsetupAfterHook\n\t};\n}\n//#endregion\nexport { definePlugin, defineRule, eslintCompatPlugin };\n", "// This file is generated by scripts/generate-manifests.ts. Do not edit.\n\n/** Every component class `@studiometa/ui` exports. */\nexport const UI_COMPONENT_NAMES: ReadonlySet<string> = new Set([\n 'AbstractCarouselChild',\n 'AbstractCarouselComponent',\n 'AbstractFigure',\n 'AbstractFigureDynamic',\n 'AbstractPrefetch',\n 'AbstractTrack',\n 'Action',\n 'ActionEvent',\n 'AnchorNav',\n 'AnchorNavLink',\n 'AnchorNavTarget',\n 'Carousel',\n 'CarouselBtn',\n 'CarouselCount',\n 'CarouselDots',\n 'CarouselDrag',\n 'CarouselItem',\n 'CarouselPlay',\n 'CarouselProgress',\n 'CarouselThumbnails',\n 'CarouselWrapper',\n 'ClickOutside',\n 'Cursor',\n 'DataBind',\n 'DataComputed',\n 'DataEffect',\n 'DataModel',\n 'DataRegistry',\n 'DataScope',\n 'Defer',\n 'Dialog',\n 'Disclosure',\n 'DisclosureGroup',\n 'Draggable',\n 'Fetch',\n 'FetchShopifyPartial',\n 'FetchShopifySection',\n 'Figure',\n 'FigureShopify',\n 'FigureTwicpics',\n 'FigureVideo',\n 'FigureVideoTwicpics',\n 'Hoverable',\n 'InView',\n 'InViewOnce',\n 'Indexable',\n 'Marquee',\n 'Menu',\n 'MenuBtn',\n 'MenuList',\n 'PrefetchOnInteraction',\n 'PrefetchWhenVisible',\n 'ScrollReveal',\n 'ScrollTo',\n 'Sentinel',\n 'Sticky',\n 'Tabs',\n 'Target',\n 'Timer',\n 'TimerProgress',\n 'Toast',\n 'Toaster',\n 'Track',\n 'TrackContext',\n 'TrackEvent',\n 'TrackShopify',\n 'Transition',\n 'ViewTransition',\n]);\n", "export type Node = Record<string, any>;\nexport type RuleContext = Record<string, any>;\n\nexport type RuleMeta = {\n type?: 'problem' | 'suggestion' | 'layout';\n fixable?: 'code' | 'whitespace';\n hasSuggestions?: boolean;\n docs?: { description?: string };\n messages?: Record<string, string>;\n};\n\nexport function createRule<V extends Record<string, (node: Node) => unknown>>(rule: {\n meta?: RuleMeta;\n createOnce(context: RuleContext): V;\n}): { meta?: RuleMeta; createOnce(context: RuleContext): V } {\n return rule;\n}\n\nexport const UI_PACKAGE = '@studiometa/ui';\nexport const TOOLKIT_PACKAGE = '@studiometa/js-toolkit';\n\nexport { UI_COMPONENT_NAMES } from './component-names.ts';\n\n/**\n * Returns the local name of the superclass for a class declaration/expression.\n */\nexport function getSuperClassName(node: Node): string | null {\n if (node.type !== 'ClassDeclaration' && node.type !== 'ClassExpression') return null;\n if (!node.superClass) return null;\n if (node.superClass.type === 'Identifier') return node.superClass.name;\n return null;\n}\n\n/**\n * Returns true when a class extends Base (directly or via a toolkit import).\n */\nexport function isBaseSubclass(node: Node, context: RuleContext): boolean {\n const superName = getSuperClassName(node);\n if (!superName) return false;\n if (superName === 'Base') return true;\n\n const sourceCode = context.sourceCode ?? context.getSourceCode?.();\n const ast = sourceCode?.ast;\n if (!ast) return false;\n\n for (const n of ast.body) {\n if (n.type !== 'ImportDeclaration') continue;\n if (n.source.value !== TOOLKIT_PACKAGE) continue;\n for (const specifier of n.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.local.name === superName) return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true when a class extends a component imported from @studiometa/ui.\n */\nexport function isUISubclass(node: Node, context: RuleContext): boolean {\n const superName = getSuperClassName(node);\n if (!superName) return false;\n\n const sourceCode = context.sourceCode ?? context.getSourceCode?.();\n const ast = sourceCode?.ast;\n if (!ast) return false;\n\n for (const n of ast.body) {\n if (n.type !== 'ImportDeclaration') continue;\n if (n.source.value !== UI_PACKAGE) continue;\n for (const specifier of n.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.local.name === superName) return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true when className is already imported from @studiometa/ui.\n */\nexport function isImportedFromUI(className: string, context: RuleContext): boolean {\n const sourceCode = context.sourceCode ?? context.getSourceCode?.();\n const ast = sourceCode?.ast;\n if (!ast) return false;\n\n for (const n of ast.body) {\n if (n.type !== 'ImportDeclaration') continue;\n if (n.source.value !== UI_PACKAGE) continue;\n for (const specifier of n.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.imported?.name === className)\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Walks up ancestor nodes to find the nearest class declaration/expression.\n */\nexport function findEnclosingClass(ancestors: Node[]): Node | null {\n for (let i = ancestors.length - 1; i >= 0; i--) {\n const node = ancestors[i];\n if (node.type === 'ClassDeclaration' || node.type === 'ClassExpression') return node;\n }\n return null;\n}\n\nexport function getAncestors(context: RuleContext, node: Node): Node[] {\n return context.getAncestors?.() ?? context.sourceCode?.getAncestors?.(node) ?? [];\n}\n\n/**\n * Returns all method definitions in a class body by name.\n */\nexport function getClassMethods(classNode: Node): Map<string, Node> {\n const methods = new Map<string, Node>();\n for (const member of classNode.body?.body ?? []) {\n if (member.type === 'MethodDefinition' && member.key?.type === 'Identifier') {\n methods.set(member.key.name, member);\n }\n }\n return methods;\n}\n", "import {\n UI_COMPONENT_NAMES,\n isBaseSubclass,\n isImportedFromUI,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\nexport const preferUiComponent = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer importing components from @studiometa/ui over reimplementing them from scratch',\n },\n messages: {\n preferImport:\n '\"{{name}}\" is available in @studiometa/ui. ' +\n 'Extend it instead of reimplementing from Base: import { {{name}} } from \\'@studiometa/ui\\'.',\n },\n },\n createOnce(context: RuleContext) {\n return {\n ClassDeclaration(node: Node) {\n check(node, context);\n },\n ClassExpression(node: Node) {\n check(node, context);\n },\n };\n },\n});\n\nfunction check(node: Node, context: RuleContext) {\n const name: string = node.id?.name ?? '';\n if (!name || !UI_COMPONENT_NAMES.has(name)) return;\n if (!isBaseSubclass(node, context)) return;\n // Already importing it from @studiometa/ui \u2014 they're extending it properly\n if (isImportedFromUI(name, context)) return;\n\n context.report({ node: node.id ?? node, messageId: 'preferImport', data: { name } });\n}\n", "import {\n isBaseSubclass,\n isImportedFromUI,\n getClassMethods,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\n/**\n * Detect classes that extend Base and define both open() and close() methods \u2014\n * a pattern that duplicates what Transition (or Dialog) already provides.\n */\nexport const preferTransition = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer @studiometa/ui Transition over manually implementing open/close logic in a Base subclass',\n },\n messages: {\n preferTransition:\n 'This class manually implements open() and close() methods. ' +\n 'Consider extending Transition from @studiometa/ui instead, which handles show/hide with CSS class transitions: ' +\n \"import { Transition } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n return {\n ClassDeclaration(node: Node) {\n check(node, context);\n },\n ClassExpression(node: Node) {\n check(node, context);\n },\n };\n },\n});\n\nfunction check(node: Node, context: RuleContext) {\n if (!isBaseSubclass(node, context)) return;\n // Already using a @studiometa/ui component as the base\n if (isImportedFromUI(node.superClass?.name, context)) return;\n\n const methods = getClassMethods(node);\n if (!methods.has('open') || !methods.has('close')) return;\n\n context.report({ node: node.id ?? node, messageId: 'preferTransition' });\n}\n", "import {\n findEnclosingClass,\n isBaseSubclass,\n isImportedFromUI,\n getAncestors,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\nconst DOM_WRITE_METHODS = new Set(['insertAdjacentHTML', 'insertAdjacentElement']);\n\n/**\n * Detect manual fetch() calls inside Base subclasses that also write to innerHTML\n * or use insertAdjacentHTML \u2014 suggest using the Fetch component from @studiometa/ui.\n */\nexport const noManualFetch = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer the Fetch component from @studiometa/ui over manually fetching and injecting HTML',\n },\n messages: {\n preferFetch:\n 'Manual fetch() with DOM injection detected. ' +\n \"Consider using the Fetch component from @studiometa/ui instead: import { Fetch } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n const classesWithFetch = new WeakSet<Node>();\n const classesWithDomWrite = new WeakSet<Node>();\n const reported = new WeakSet<Node>();\n\n function getEnclosingBaseClass(node: Node): Node | null {\n const ancestors = getAncestors(context, node);\n const cls = findEnclosingClass(ancestors);\n if (!cls || !isBaseSubclass(cls, context)) return null;\n if (isImportedFromUI('Fetch', context)) return null;\n return cls;\n }\n\n function maybeReport(cls: Node) {\n if (reported.has(cls)) return;\n if (classesWithFetch.has(cls) && classesWithDomWrite.has(cls)) {\n reported.add(cls);\n context.report({ node: cls.id ?? cls, messageId: 'preferFetch' });\n }\n }\n\n return {\n CallExpression(node: Node) {\n const callee = node.callee;\n\n // Detect fetch(url)\n const isFetch =\n (callee.type === 'Identifier' && callee.name === 'fetch') ||\n (callee.type === 'MemberExpression' &&\n callee.property?.name === 'fetch' &&\n callee.object?.type === 'ThisExpression');\n\n // Detect el.insertAdjacentHTML / el.insertAdjacentElement\n const isDomWrite =\n callee.type === 'MemberExpression' &&\n DOM_WRITE_METHODS.has(callee.property?.name);\n\n if (!isFetch && !isDomWrite) return;\n\n const cls = getEnclosingBaseClass(node);\n if (!cls) return;\n\n if (isFetch) classesWithFetch.add(cls);\n if (isDomWrite) classesWithDomWrite.add(cls);\n\n maybeReport(cls);\n },\n\n AssignmentExpression(node: Node) {\n const left = node.left;\n if (left.type !== 'MemberExpression') return;\n if (left.property?.name !== 'innerHTML') return;\n\n const cls = getEnclosingBaseClass(node);\n if (!cls) return;\n\n classesWithDomWrite.add(cls);\n maybeReport(cls);\n },\n };\n },\n});\n", "import {\n findEnclosingClass,\n isBaseSubclass,\n isImportedFromUI,\n getAncestors,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\n/**\n * Detect manual input/change event listeners that update DOM \u2014 suggest DataModel/DataEffect.\n *\n * Signal: addEventListener('input', ...) or an onInput* method that writes to\n * textContent / innerHTML / value on another element inside a Base subclass.\n */\n/** Walk up a member expression chain and check if the root is this.$refs / this.$el / this.$children */\nfunction isThisComponentAccess(node: Node): boolean {\n let current = node;\n while (current?.type === 'MemberExpression') {\n if (\n current.object?.type === 'ThisExpression' &&\n (current.property?.name === '$refs' ||\n current.property?.name === '$el' ||\n current.property?.name === '$children')\n ) {\n return true;\n }\n current = current.object;\n }\n return false;\n}\n\nexport const preferDataModel = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer DataModel/DataEffect from @studiometa/ui over manually syncing input values to the DOM',\n },\n messages: {\n preferDataModel:\n 'Manual input\u2192DOM synchronization detected. ' +\n 'Consider using DataModel and DataEffect from @studiometa/ui for reactive bindings: ' +\n \"import { DataModel, DataEffect } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n const classesWithInputListener = new WeakSet<Node>();\n const classesWithDomWrite = new WeakSet<Node>();\n const reported = new WeakSet<Node>();\n\n function getEnclosingBaseClass(node: Node): Node | null {\n const ancestors = getAncestors(context, node);\n const cls = findEnclosingClass(ancestors);\n if (!cls || !isBaseSubclass(cls, context)) return null;\n if (isImportedFromUI('DataModel', context) || isImportedFromUI('DataEffect', context))\n return null;\n return cls;\n }\n\n function maybeReport(cls: Node) {\n if (reported.has(cls)) return;\n if (classesWithInputListener.has(cls) && classesWithDomWrite.has(cls)) {\n reported.add(cls);\n context.report({ node: cls.id ?? cls, messageId: 'preferDataModel' });\n }\n }\n\n return {\n // Detect on-handler methods named onInput*, onChange*, onModelInput, etc.\n MethodDefinition(node: Node) {\n const name: string = node.key?.name ?? '';\n if (!/^on.*(Input|Change|Model)/i.test(name)) return;\n\n const ancestors = getAncestors(context, node);\n const cls = findEnclosingClass(ancestors);\n if (!cls || !isBaseSubclass(cls, context)) return;\n if (isImportedFromUI('DataModel', context)) return;\n\n classesWithInputListener.add(cls);\n maybeReport(cls);\n },\n\n AssignmentExpression(node: Node) {\n const left = node.left;\n if (left.type !== 'MemberExpression') return;\n\n const prop = left.property?.name;\n const isDomWrite =\n prop === 'textContent' || prop === 'innerHTML' || prop === 'value';\n if (!isDomWrite) return;\n\n // Must ultimately access this.$refs, this.$el, or this.$children\n if (!isThisComponentAccess(left.object)) return;\n\n const cls = getEnclosingBaseClass(node);\n if (!cls) return;\n\n classesWithDomWrite.add(cls);\n maybeReport(cls);\n },\n };\n },\n});\n", "import {\n isBaseSubclass,\n getClassMethods,\n isImportedFromUI,\n type Node,\n type RuleContext,\n createRule,\n} from '../utils/ast.ts';\n\n/**\n * Simple event handler method names that the Action component already handles.\n * These are on-handler names on this.$el (root element) \u2014 if the class body\n * contains ONLY these kinds of methods (plus config), it's a good Action candidate.\n */\nconst ACTION_EVENT_METHODS = new Set([\n 'onClick',\n 'onMouseenter',\n 'onMouseleave',\n 'onMouseover',\n 'onMouseout',\n 'onFocus',\n 'onBlur',\n 'onKeydown',\n 'onKeyup',\n 'onKeypress',\n 'onPointerenter',\n 'onPointerleave',\n 'onPointerdown',\n 'onPointerup',\n]);\n\nconst NON_LOGIC_METHODS = new Set(['mounted', 'destroyed', 'updated']);\n\n/**\n * Detect Base subclasses whose only logic is a single simple event handler\n * (onClick, onMouseenter, etc.) \u2014 these can be replaced by the Action component.\n */\nexport const preferAction = createRule({\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Prefer the Action component from @studiometa/ui for simple event-triggered effects',\n },\n messages: {\n preferAction:\n 'This component only handles \"{{method}}\" on the root element. ' +\n 'Consider using the Action component from @studiometa/ui instead, ' +\n \"which declaratively wires events to effects via data attributes: import { Action } from '@studiometa/ui'.\",\n },\n },\n createOnce(context: RuleContext) {\n return {\n ClassDeclaration(node: Node) {\n check(node, context);\n },\n ClassExpression(node: Node) {\n check(node, context);\n },\n };\n },\n});\n\nfunction check(node: Node, context: RuleContext) {\n if (!isBaseSubclass(node, context)) return;\n if (isImportedFromUI('Action', context)) return;\n\n const methods = getClassMethods(node);\n\n // Find action-handler methods defined in this class\n const actionMethods: string[] = [];\n const otherMethods: string[] = [];\n\n for (const [name] of methods) {\n if (ACTION_EVENT_METHODS.has(name)) {\n actionMethods.push(name);\n } else if (name !== 'config' && !NON_LOGIC_METHODS.has(name)) {\n otherMethods.push(name);\n }\n }\n\n // Only flag when: exactly one action method, no other logic methods\n if (actionMethods.length !== 1 || otherMethods.length > 0) return;\n\n // Check the method body is simple \u2014 does not access this.$children or this.$refs\n // to avoid false positives on components that orchestrate children\n const method = methods.get(actionMethods[0])!;\n if (hasComplexBody(method)) return;\n\n context.report({\n node: node.id ?? node,\n messageId: 'preferAction',\n data: { method: actionMethods[0] },\n });\n}\n\nfunction hasComplexBody(methodNode: Node): boolean {\n let complex = false;\n\n function walk(n: Node) {\n if (complex) return;\n if (!n || typeof n !== 'object') return;\n\n // Accessing $children or using await suggests complex logic\n if (\n n.type === 'MemberExpression' &&\n n.object?.type === 'ThisExpression' &&\n (n.property?.name === '$children' || n.property?.name === '$root')\n ) {\n complex = true;\n return;\n }\n\n for (const key of Object.keys(n)) {\n if (key === 'parent') continue;\n const child = n[key];\n if (Array.isArray(child)) child.forEach(walk);\n else if (child && typeof child === 'object' && child.type) walk(child);\n }\n }\n\n walk(methodNode.value ?? methodNode);\n return complex;\n}\n", "import { eslintCompatPlugin } from '@oxlint/plugins';\nimport {\n preferUiComponent,\n preferTransition,\n noManualFetch,\n preferDataModel,\n preferAction,\n} from './rules/index.ts';\n\nconst PLUGIN_NAME = 'ui';\n\nconst rules = {\n 'prefer-ui-component': preferUiComponent,\n 'prefer-transition': preferTransition,\n 'no-manual-fetch': noManualFetch,\n 'prefer-data-model': preferDataModel,\n 'prefer-action': preferAction,\n};\n\nconst recommendedRules: Record<string, string> = {\n [`${PLUGIN_NAME}/prefer-ui-component`]: 'warn',\n [`${PLUGIN_NAME}/prefer-transition`]: 'warn',\n [`${PLUGIN_NAME}/no-manual-fetch`]: 'warn',\n [`${PLUGIN_NAME}/prefer-data-model`]: 'warn',\n [`${PLUGIN_NAME}/prefer-action`]: 'warn',\n};\n\nconst base = eslintCompatPlugin({\n meta: {\n name: '@studiometa/eslint-plugin-ui',\n },\n rules,\n});\n\nconst plugin = Object.assign(base, { configs: {} as Record<string, object> });\n\nplugin.configs['recommended'] = {\n plugins: { [PLUGIN_NAME]: plugin },\n rules: recommendedRules,\n};\n\nexport default plugin;\nexport { plugin as ui };\n"],
5
+ "mappings": ";AAyBA,IAAM,gBAAgB,CAAC;AAcvB,SAAS,mBAAmBA,SAAQ;AACnC,MAAI,OAAOA,WAAU,YAAY,CAACA,QAAQ,OAAM,MAAM,0B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uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,iBAAiB;AACnB;AAEA,IAAM,mBAA2C;AAAA,EAC/C,CAAC,GAAG,WAAW,sBAAsB,GAAG;AAAA,EACxC,CAAC,GAAG,WAAW,oBAAoB,GAAG;AAAA,EACtC,CAAC,GAAG,WAAW,kBAAkB,GAAG;AAAA,EACpC,CAAC,GAAG,WAAW,oBAAoB,GAAG;AAAA,EACtC,CAAC,GAAG,WAAW,gBAAgB,GAAG;AACpC;AAEA,IAAM,OAAO,mBAAmB;AAAA,EAC9B,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA;AACF,CAAC;AAED,IAAM,SAAS,OAAO,OAAO,MAAM,EAAE,SAAS,CAAC,EAA4B,CAAC;AAE5E,OAAO,QAAQ,aAAa,IAAI;AAAA,EAC9B,SAAS,EAAE,CAAC,WAAW,GAAG,OAAO;AAAA,EACjC,OAAO;AACT;AAEA,IAAO,gBAAQ;",
6
6
  "names": ["plugin", "rules", "check", "check"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { type Node, type RuleContext } from '../utils/ast.ts';
2
2
  /**
3
3
  * Detect classes that extend Base and define both open() and close() methods —
4
- * a pattern that duplicates what Transition (or Modal) already provides.
4
+ * a pattern that duplicates what Transition (or Dialog) already provides.
5
5
  */
6
6
  export declare const preferTransition: {
7
7
  meta?: import("../utils/ast.ts").RuleMeta;
@@ -18,11 +18,7 @@ export declare function createRule<V extends Record<string, (node: Node) => unkn
18
18
  };
19
19
  export declare const UI_PACKAGE = "@studiometa/ui";
20
20
  export declare const TOOLKIT_PACKAGE = "@studiometa/js-toolkit";
21
- /**
22
- * All component names exported by @studiometa/ui.
23
- * Keep in sync with packages/ui/index.ts exports.
24
- */
25
- export declare const UI_COMPONENT_NAMES: Set<string>;
21
+ export { UI_COMPONENT_NAMES } from './component-names.ts';
26
22
  /**
27
23
  * Returns the local name of the superclass for a class declaration/expression.
28
24
  */
@@ -0,0 +1,2 @@
1
+ /** Every component class `@studiometa/ui` exports. */
2
+ export declare const UI_COMPONENT_NAMES: ReadonlySet<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/eslint-plugin-ui",
3
- "version": "1.11.1",
3
+ "version": "2.0.0-alpha.0",
4
4
  "description": "ESLint plugin to help developers discover and use @studiometa/ui components",
5
5
  "publishConfig": {
6
6
  "access": "public"