Configuration of react/jsx-no-bind allows to use arrow functions, while the style guide prohibits it
- Lingua principale
- JavaScript
- Stelle
- 148k
- Fork
- 26.6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The current configuration of `react/jsx-no-bind` allows to use arrow functions as event handlers (and ignores the use of bind in DOM components too): https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react.js#L104

However, here's what the style guide has to say bout this:
---

---
1. I agree with the guide's argument and belive that it would be best to update the rule configuration to match it. Using arrow function to initialize an event handler creates a brand new function on each render same as `bind()` does, which can lead to unnecessary re-renders.
2. To be honest, I'd even turn `ignoreDOMComponents` to `false` too — it is unclear why DOM components deserve a different treatment. I'd say the reasoning from the style guide fully applies to them too.
3. If, however, there is some reasoning behind these exceptions — then the style guide should probably reflect it.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia da packages/eslint-config-airbnb/rules/react.js#L104 e confronta le eccezioni di react/jsx-no-bind con le indicazioni del JavaScript style guide di riferimento. Esamina le questioni aperte sulle funzioni freccia e sui componenti DOM; il lavoro è completato quando la configurazione e la guida sono coerenti, oppure quando è documentata la motivazione per mantenere un'eccezione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- eslint, javascript
- Ambito
- documentation, tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100