@fictjs/eslint-plugin ships guardrails that mirror compiler diagnostics. Install and enable the recommended config to catch issues before build time.
pnpm add -D @fictjs/eslint-plugin.eslintrc:
{
"plugins": ["fict"],
"extends": ["plugin:fict/recommended"]
}| Rule | Diagnostic | Level | What it catches |
|---|---|---|---|
no-state-in-loop |
error | P0 | $state declared inside loops |
no-state-destructure-write |
error | P0 | Writes to destructured $state aliases |
no-state-outside-component |
placement validation | P0 | $state declared at module level or outside components |
no-nested-components |
FICT-C003 | P0 | Components defined inside components |
require-list-key |
FICT-J002 | P0 | .map() returning JSX without key |
no-direct-mutation |
warn | P1 | Deep mutations on $state objects |
no-empty-effect |
FICT-E001 | warn | $effect with no reactive reads |
no-inline-functions |
FICT-X003 | warn | Inline functions in JSX props (perf footgun) |
no-memo-side-effects |
FICT-M003 | warn | Side effects inside $memo callbacks |
require-component-return |
FICT-C004 | warn | Component functions missing a return |
no-unsafe-props-spread |
FICT-P005 | warn | JSX spreads with dynamic or unsafe sources |
no-unsupported-props-destructure |
FICT-P001–P004 | warn | Props destructuring patterns that lose reactivity |
no-computed-props-key |
FICT-P003 | warn | Computed keys in props destructuring |
no-third-party-props-spread |
FICT-P005 | warn | Spreads of third-party objects into props |
require-list-keyonly checks elements returned directly from.map(...).no-empty-effectlooks for identifiers captured from outer scope; empty effects or purely local work are flagged.no-memo-side-effectswarns on assignments/updates or$effectcalls inside$memo.FICT-S002is the compiler warning for state value escape (for example passing$statedirectly as a function argument), not declaration placement.- Keep compiler and ESLint diagnostics aligned for the best DX; see
docs/diagnostic-codes.mdfor the full code list.
Optionally treat imported accessors as safe spread sources when they come from other modules.
{
"rules": {
"fict/no-unsafe-props-spread": [
"warn",
{
"accessorNames": ["count", "getProps"],
"accessorModules": ["./state", "@app/state"]
}
]
}
}Flags JSX spreads that are directly rooted in imports from non-relative modules (excluding the allowlist and internal prefixes).
This rule is intentionally conservative: it ignores call expressions and does not chase local aliases to avoid false positives.
Set includeCallExpressions if you want to warn on ...thirdParty() or ...thirdParty.getProps() patterns.
{
"rules": {
"fict/no-third-party-props-spread": [
"warn",
{
"allow": ["@fictjs/runtime", "shared-config"],
"internalPrefixes": ["@/", "~/"],
"includeCallExpressions": true
}
]
}
}