From 977b7ba118e661b68befae1fb92f244dd18f3c35 Mon Sep 17 00:00:00 2001 From: Andrey Polischuk Date: Tue, 13 Aug 2024 17:29:39 +0300 Subject: [PATCH] feat(eslint-config): add react rules * react/jsx-fragments * react/jsx-no-useless-fragment * react/hook-use-state * react/jsx-handler-names * react/no-unstable-nested-components --- packages/eslint-config/react.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/eslint-config/react.js b/packages/eslint-config/react.js index e546784..03751f1 100644 --- a/packages/eslint-config/react.js +++ b/packages/eslint-config/react.js @@ -24,13 +24,31 @@ module.exports = { rules: { 'react/prop-types': 'off', 'react/jsx-pascal-case': 'error', + 'react/jsx-fragments': 'error', + 'react/jsx-no-useless-fragment': 'error', 'react/no-multi-comp': 'error', + 'react/hook-use-state': 'error', + 'react/jsx-handler-names': [ + 'error', + { + eventHandlerPrefix: 'handle', + eventHandlerPropPrefix: 'on', + checkLocalVariables: true, + checkInlineFunction: true + } + ], 'react-hooks/exhaustive-deps': [ 'warn', { additionalHooks: '(useDeferCallback)' } ], + 'react/no-unstable-nested-components': [ + 'error', + { + allowAsProps: true + } + ], 'jsx-a11y/no-autofocus': [ 'error', {