@rotki/composable-return-readonly
Require returned refs from composables to be wrapped with readonly()
- ✒️️ The
--fixoption on the command line can automatically fix some of the problems reported by this rule.
📖 Rule Details
This rule requires that writable reactive variables (ref, shallowRef) returned from composables are wrapped with readonly() to prevent consumers from mutating internal state.
computed() refs are excluded because they are already readonly by design — wrapping them with readonly() is unnecessary. The rule will flag unnecessary readonly() usage on computed refs.
🔧 Options
json
{
"@rotki/composable-return-readonly": ["error", { "autofix": false }]
}autofix
- Type:
boolean - Default:
false
When true, enables auto-fix via the --fix CLI flag. When false (default), the fix is available only as an editor suggestion.
🚀 Version
This rule was introduced in @rotki/eslint-plugin v1.3.0