ADR 0010: Govern autofix behavior with safe defaults and plugin-level kill switches
- Status: Accepted
- Date: 2026-02-28
Context
This plugin includes migration rules where some transformations are fully safe while others are context-sensitive.
The codebase already implements runtime controls in settings.typefest and wraps rule contexts to strip fix callbacks when global autofixes are disabled.
Relevant implementation points include:
settings.typefest.disableAllAutofixessettings.typefest.disableImportInsertionFixescreateContextWithoutAutofixes(...)insrc/_internal/typed-rule.ts- parsed/memoized settings in
src/_internal/plugin-settings.ts
Decision
Adopt a formal autofix governance model:
- Rules should only emit
fixwhen safety is deterministic. - Rules should emit
suggestfor behavior-sensitive migrations. - Global settings can suppress autofixes at runtime:
disableAllAutofixesremoves allfixcallbacks,disableImportInsertionFixesdisables import-insertion helpers.
Rationale
- Operational safety: large migrations need a hard stop mechanism for automated rewrites.
- Predictable rollout: teams can start with diagnostics/suggestions before enabling broad fixing.
- Centralized control: settings-based suppression avoids rule-by-rule ad hoc toggles.
Consequences
- Fix behavior is intentionally policy-driven, not purely rule-local.
- Rule authors must classify fixes as deterministic (
fix) vs contextual (suggest). - Migration playbooks can use settings to stage risk and reduce churn.
Revisit Triggers
Re-evaluate if:
- ESLint introduces stronger first-class fix governance primitives,
- the plugin requires finer-grained per-rule fix policy controls,
- or contributors report current kill-switch granularity as insufficient.