Vuex Mutations and Airbnb eslint
No, sorry.
Since a Vuex store's state is made reactive by Vue, when we mutate the state, Vue components observing the state will update automatically. This also means Vuex mutations are subject to the same reactivity caveats when working with plain Vue [...]
Source: https://vuex.vuejs.org/en/mutations.html
It does mean that you must mutate the parameter to get any change into your actual state. The only solution there is to turn off that rule.
Addendum:
I may have a better solution. Note that this is the actual rule as enforced by their ESLint:
'no-param-reassign': ['error', {
props: true,
ignorePropertyModificationsFor: [
'acc', // for reduce accumulators
'e', // for e.returnvalue
'ctx', // for Koa routing
'req', // for Express requests
'request', // for Express requests
'res', // for Express responses
'response', // for Express responses
'$scope', // for Angular 1 scopes
]
}],
You may add 'state'
to the ignorePropertyModificationsFor
array, so you won't encounter error when modifying your state properties.