Skip to content

Fix migration of tools for TSX

Antoine requested to merge ZeHiro/kresus:fix-tsx-tools into master

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 with const, and not let (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 with let.
  • 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 the jsx-no-bind rule to raise.
Edited by Antoine

Merge request reports