jsx-eslint/eslint-plugin-react

no-direct-mutation-state on references

Open

#747 aberto em 7 de ago. de 2016

Ver no GitHub
 (2 comments) (0 reactions) (0 assignees)JavaScript (2.797 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (8.630 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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.

Guia do colaborador