Avoid no-shadow eslint error with mapDispatchToProps

前端 未结 6 1476
说谎
说谎 2020-12-23 02:06

I have the following component that triggers a no-shadow ESlint error on the FilterButton props.



        
6条回答
  •  一生所求
    2020-12-23 02:55

    A fifth option:

    5. Allow a specific exception via eslintrc rules.

    module.exports = {
      rules: {
        'no-shadow': [
          'error',
          {
            allow: ['setFilter'],
          },
        ],
      }
    }
    

    Why?

    You don't want variable shadowing but can't get around it in certain cases.

    Why Not?

    You really don't want variable shadowing in your code base.

提交回复
热议问题