feat(ui): add eslint rule react/jsx-no-bind

This rule enforces no arrow functions in component props. In practice, it means all functions passed as component props must be wrapped in `useCallback()`.

This is a performance optimization to prevent unnecessary rerenders.

The rule is added and all violations have been fixed, whew!
This commit is contained in:
psychedelicious
2023-11-13 10:01:14 +11:00
parent 5eaea9dd64
commit 3a0ec635c9
65 changed files with 932 additions and 526 deletions

View File

@ -24,6 +24,7 @@ module.exports = {
root: true,
rules: {
curly: 'error',
'react/jsx-no-bind': ['error', { allowBind: true }],
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never' },