ESLint says array never modified even though elements are pushed into array

前端 未结 1 483
野的像风
野的像风 2020-12-31 06:04

I am converting some existing code to follow ECMA script and I am using ESLint to follow a coding standard. I have the following ecmascript method

static ge         


        
相关标签:
1条回答
  • 2020-12-31 07:01

    To understand this error you must understand that const declared variables hold read-only references to a value. But it does not mean that the value it holds is immutable [mdn article].

    Since you are only changing members of the variable, but not performing a reassignment on the binding the prefer-const rule of es-lint warns you that a const declared variable could be used instead of a let declared variable.

    0 讨论(0)
提交回复
热议问题