Fix migration of tools for TSX
The problem:
- eslint did not use typescript-eslint parser for TSX files, leading to some lint rules not being applied.
UPDATE
Why so many changes in min-max-input ?
- We have set the eslint rule
prefer-const
only on ts files. This means that with this fix, the eslint rules are applied the tsx files. Which means that the handlers have to be declared withconst
, and notlet
(the handlers are not modified). - The rule
jsx-no-bind
raises when there is a risk that handlers are redeclared at each change or prop/state, which could trigger unwanted commits to the DOM. The rule does not seem to apply when the handlers are declared withlet
. - The good practise to prevent undue renders due to changed handlers when using functional components, is to memoise the handler with
useCallback
. This also prevents thejsx-no-bind
rule to raise.
Edited by Antoine