no-param-reassign rule makes the Airbnb Eslint config incompatible with Vuex. In Vuex parameters mutation is required - this is how Vuex works.
So In order to fix this issue, the following override is needed:
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": [
"state",
"acc",
"e",
"ctx",
"req",
"request",
"res",
"response",
"$scope"
]
}
],
PS
All properties except state are in the ignorePropertyModificationsFor array by default.
I used to disable this rule by adding eslint-disable for each vuex file, and your config seems better. I think we could use eslint conf's overrides field to make a finer restriction.
Sorry for asking here (I think this should be addressed in eslint repo), but I just installed the webpack template and this rule does not seem to be working at all. I've tried many different rules apart from the default ones and my parameter reassigns are always lint with error.
All the rules works, except for the 'no-param-reassign' one. Is this happening only with me?
This worked for me, after restarting dev environment.
I created a new .eslintrc.js file in my store folder and added them there
// airbnb eslint is incompatible with vuex, so we add:
"no-shadow": ["error", { "allow": ["state"] }],
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": [ // All properties except state are in the ignorePropertyModificationsFor array by default.
"state",
"acc",
"e",
"ctx",
"req",
"request",
"res",
"response",
"$scope"
]
}
],
This worked for me, after restarting dev environment.
Thanks for this comment. Errors went away in my IDE but project still wasn't working and I couldn't see why until I saw this.
Most helpful comment
Sorry for asking here (I think this should be addressed in eslint repo), but I just installed the webpack template and this rule does not seem to be working at all. I've tried many different rules apart from the default ones and my parameter reassigns are always lint with error.
All the rules works, except for the 'no-param-reassign' one. Is this happening only with me?