ESLint Plugin
eslint-plugin-machina reports machina-inspect findings inline in your editor, with three rules and one import to set up. ESLint 9 flat config only.
Install
Section titled “Install”machina-inspect is pulled in automatically. For TypeScript files, you also need @typescript-eslint/parser:
Recommended preset
Section titled “Recommended preset”With TypeScript
Section titled “With TypeScript”| Rule | Default | Type | Description |
|---|---|---|---|
machina/unreachable-state |
"warn" |
problem | States with no inbound path from initialState |
machina/onenter-loop |
"error" |
problem | Unconditional _onEnter transition cycles |
machina/missing-handler |
"off" |
suggestion | States missing handlers for inputs other states handle |
machina/unreachable-state
Section titled “machina/unreachable-state”The rule reports states that the machine cannot enter from initialState. Unreachable states are dead code.
machina/onenter-loop
Section titled “machina/onenter-loop”Detects unconditional _onEnter transition cycles that will infinite-loop the runtime. Conditional bounces are intentional patterns and are not flagged.
machina/missing-handler
Section titled “machina/missing-handler”Flags states that don’t handle inputs handled by other states. Off by default because many FSMs have asymmetric handlers by design. States with a * catch-all are excluded.
How it works
Section titled “How it works”The plugin listens for createFsm() and createBehavioralFsm() call expressions, builds a StateGraph from the ESLint AST using machina-inspect’s graph IR, then runs the structural checks. Findings are reported as ESLint diagnostics at the call site.
_child resolution
Section titled “_child resolution”The plugin resolves a _child reference when it is an inline createFsm() call or a const identifier bound to such a call in the same module. The plugin silently skips cross-module imports and let/var bindings. A skipped child goes unanalyzed, which avoids false positives from guessing.
See also
Section titled “See also”- machina-inspect, the programmatic API for the same checks
- machina-test, Jest and Vitest matchers that make graph-level assertions in your test suite
- machina-explorer, a paste-and-analyze browser UI