mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-10 07:11:25 +03:00
32 lines
1.1 KiB
YAML
32 lines
1.1 KiB
YAML
id: gui-plugin-no-module-state-tsx
|
|
language: tsx
|
|
severity: error
|
|
message: GUI plugins keep state in ctx, Storage, or setup closures, never at module level.
|
|
note: Module state survives disable and reload and leaks across windows. Create it inside setup or a component.
|
|
files:
|
|
- "packages/gui-plugins/src/*/**/*.tsx"
|
|
rule:
|
|
all:
|
|
- any:
|
|
- pattern: let $A = $$$B
|
|
- pattern: let $A
|
|
- pattern: const $A = new Map($$$B)
|
|
- pattern: const $A = new Map<$$$T>($$$B)
|
|
- pattern: const $A = new Set($$$B)
|
|
- pattern: const $A = new Set<$$$T>($$$B)
|
|
- pattern: const $A = new WeakMap($$$B)
|
|
- pattern: const $A = new WeakMap<$$$T>($$$B)
|
|
- pattern: const $A = new WeakSet($$$B)
|
|
- pattern: const $A = new WeakSet<$$$T>($$$B)
|
|
- pattern: const $A = createStore($$$B)
|
|
- pattern: const $A = createStore<$$$T>($$$B)
|
|
- pattern: const $A = createSignal($$$B)
|
|
- pattern: const $A = createSignal<$$$T>($$$B)
|
|
- any:
|
|
- inside:
|
|
kind: program
|
|
- inside:
|
|
kind: export_statement
|
|
inside:
|
|
kind: program
|