vuejs-templates / webpack

A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
MIT License
9.7k stars 4.39k forks source link

Eslint Error #1449

Open shirshak55 opened 6 years ago

shirshak55 commented 6 years ago

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 :(

nfer commented 6 years ago

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
      ]
    }],
shirshak55 commented 6 years ago

i havd done clean install. there should be some issue with airbnb standard

On Sat, Sep 29, 2018, 9:13 PM Nfer Zhuang notifications@github.com 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 .

shirshak55 commented 6 years ago

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 shirshak55@gmail.com wrote:

i havd done clean install. there should be some issue with airbnb standard

On Sat, Sep 29, 2018, 9:13 PM Nfer Zhuang notifications@github.com 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 .

nfer commented 6 years ago

you can disable this eslint-rule in .vue files or in .eslintrc, they are both not hacks.