From 1b08ba722361eaf8047a05f935f5dae562b9c205 Mon Sep 17 00:00:00 2001 From: gtkatakura Date: Thu, 23 Dec 2021 12:02:31 -0300 Subject: [PATCH] feat(react): defines no-unstable-nested-components rule --- packages/eslint-config-vtex-react/CHANGELOG.md | 2 ++ packages/eslint-config-vtex-react/rules/react.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/packages/eslint-config-vtex-react/CHANGELOG.md b/packages/eslint-config-vtex-react/CHANGELOG.md index 942f3b5..5cb9b25 100644 --- a/packages/eslint-config-vtex-react/CHANGELOG.md +++ b/packages/eslint-config-vtex-react/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Defines react/no-unstable-nested-components as error to prevent performance issues on react apps ## [8.0.0] - 2021-03-25 ### Changed diff --git a/packages/eslint-config-vtex-react/rules/react.js b/packages/eslint-config-vtex-react/rules/react.js index c74fd35..db2bcd2 100644 --- a/packages/eslint-config-vtex-react/rules/react.js +++ b/packages/eslint-config-vtex-react/rules/react.js @@ -118,6 +118,10 @@ module.exports = { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md 'react/no-this-in-sfc': 'error', + // Prevent creating unstable components inside components + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md, + 'react/no-unstable-nested-components': 'error', + // Enforce the style attribute to be an object // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md // TODO maybe enable? it's annoying for the style prop of react-intl components