Skip to content

Commit

Permalink
chore: add eslint-rule to disallow constructed values in context valu…
Browse files Browse the repository at this point in the history
…es (#297)

As discovered in #285 there was a problem with excessive re-renders due to context values not being memoized across renders. The now added eslint-rule `react/jsx-no-constructed-context-values` catches these sort of mistakes and reports them as error.

Co-authored-by: Rodrigo Faria <[email protected]>
  • Loading branch information
rodrigofariow and rodrigo-faria-cartrack authored Apr 3, 2024
1 parent 833933a commit 495ca24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ module.exports = {

'no-undef': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/exhaustive-deps': 'error',
'react/jsx-no-constructed-context-values': 'error',

// We use function hoisting to put exports at top of file
'@typescript-eslint/no-use-before-define': 'off',
Expand Down

0 comments on commit 495ca24

Please sign in to comment.