Skip to content

@rotki/composable-return-readonly

Require returned refs from composables to be wrapped with readonly()

  • ✒️️ The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule requires that reactive variables (ref, shallowRef, computed) returned from composables are wrapped with readonly() to prevent consumers from mutating internal state.

🔧 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

🔍 Implementation