From 495ca24ba9f93b4b9c769d914236db8d4b657576 Mon Sep 17 00:00:00 2001 From: Rodrigo Faria Date: Wed, 3 Apr 2024 15:41:02 +0100 Subject: [PATCH] chore: add eslint-rule to disallow constructed values in context values (#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 --- .eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 62fb722..6e01a12 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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',