jsx-eslint/eslint-plugin-react

no-direct-mutation-state on references

开放

#747 创建于 2016年8月7日

 (2 条评论) (0 个反应) (0 位负责人)JavaScript (2,731 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (9,293 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Currently no-direct-mutation-state doesn't seem to support hunting down (even simple cases) where a reference to this.state is being used. Luckily I caught my co-workers bug while doing code review but it would be pretty sweet if the rule could detect this case too.

const { product } = this.state;
product.name = name;

I've never written an eslint rule before so I have no clue if this is even possible, if it is, please let me know and I might give it a stab when I have some more free time.

贡献者指南