webpack
webpack copied to clipboard
Eslint Error
For this code in vuex module
mutations: {
setBooks: (state, books) => {
state.all = books;
},
},
It shows red in state.all and shows this error message.
Module Warning (from ./node_modules/eslint-loader/index.js):
error: Assignment to property of function parameter 'state' (no-param-reassign) at src/store.js:13:7:
11 | mutations: {
12 | setBooks: (state, books) => {
> 13 | state.all = books;
| ^
14 | },
15 | },
16 | actions: {
Style is airbnb. I know i can hide it but there are show many such messages :(
please check you .eslintrc file, do it has below config:
// disallow reassignment of function parameters
// disallow parameter object manipulation except for specific exclusions
'no-param-reassign': ['error', {
props: true,
ignorePropertyModificationsFor: [
'state', // for vuex state
'acc', // for reduce accumulators
'e' // for e.returnvalue
]
}],
i havd done clean install. there should be some issue with airbnb standard
On Sat, Sep 29, 2018, 9:13 PM Nfer Zhuang [email protected] wrote:
please check you .eslintrc file, do it has below config:
// disallow reassignment of function parameters // disallow parameter object manipulation except for specific exclusions 'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: [ 'state', // for vuex state 'acc', // for reduce accumulators 'e' // for e.returnvalue ] }],— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vuejs-templates/webpack/issues/1449#issuecomment-425653425, or mute the thread https://github.com/notifications/unsubscribe-auth/AHuOYeive5EXXQuNaJOpcIg0aUCBZ_-4ks5uf5GJgaJpZM4W8tBJ .
and there is no such config and ususally i dont like hacks because in future it may be hard to maintain. Is there no effective solution
On Sun, Sep 30, 2018, 1:50 AM shirshak bajgain [email protected] wrote:
i havd done clean install. there should be some issue with airbnb standard
On Sat, Sep 29, 2018, 9:13 PM Nfer Zhuang [email protected] wrote:
please check you .eslintrc file, do it has below config:
// disallow reassignment of function parameters // disallow parameter object manipulation except for specific exclusions 'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: [ 'state', // for vuex state 'acc', // for reduce accumulators 'e' // for e.returnvalue ] }],— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vuejs-templates/webpack/issues/1449#issuecomment-425653425, or mute the thread https://github.com/notifications/unsubscribe-auth/AHuOYeive5EXXQuNaJOpcIg0aUCBZ_-4ks5uf5GJgaJpZM4W8tBJ .
you can disable this eslint-rule in .vue files or in .eslintrc, they are both not hacks.