简体   繁体   English

Eslint no-return-assing 和 no-param-reassign 错误

[英]Eslint no-return-assing and no-param-reassign error

const someId = data.id;
                values.some_id = someId;
                values.updateParams.map(
                    params => params.some_another_id = someId,
                );

In the above code, eslint is throwing some error and won't be able to understand those.在上面的代码中,eslint 抛出了一些错误并且无法理解这些错误。 Here I added the screenshots of the error.这里我添加了错误的截图。

在此处输入图片说明 在此处输入图片说明

const someId = data.id;
values.some_id = someId;
values.updateParams.map(
    params => ({ ...params,  serviceable_port_pair_id: someId,})
);

you are supposed to return the Object, how it should look like, but not mutate the parameter inside the arrow function你应该返回对象,它应该是什么样子,但不要改变箭头函数内的参数

and for the first error message.以及第一条错误信息。 The insutructions couldnt be clearer.说明再清楚不过了。 You shouldnt reassign already defined params你不应该重新分配已经定义的参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React 代码中的 ESLint no-return-assign 和 no-param-reassign 错误 - ESLint no-return-assign and no-param-reassign error in React code 如何解决“无参数重新分配”的错误? - How to fix “no-param-reassign” eslint error? 如何修复我的过滤器中的此ESlint(无参数重新分配)错误 - How to fix this ESlint (no-param-reassign) error in my Filter 摆脱无参数重新分配错误(eslint)的最佳方法是什么? - What is the best way to get rid of no-param-reassign error (eslint)? 修复 function 中的无参数重新分配 Eslint 问题 - Fixing no-param-reassign Eslint issue in function 解决由于`no-param-ressign`和`prefer-rest-params`导致的ESLint错误 - Resolving ESLint error due to `no-param-reassign` and `prefer-rest-params` 如何解决 function 中的无参数重新分配错误 - How to resolve no-param-reassign error in a function 如何修复无参数重新分配 - How to fix no-param-reassign 为什么只要重新分配对象,ESlint 就乐意让我修改对象属性? 无参数重新分配 - Why is ESlint happy for me to modify object properties as long as the object is reassigned? no-param-reassign 在减少 function 中添加到累加器时修复 ESLint no-plusplus 和 no-param-reassign linter 错误 - Fix ESLint no-plusplus and no-param-reassign linter errors when adding to accumulator in reduce function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM