From bfde5b2f11d77d12f04accf87b7aede5a518ee1d Mon Sep 17 00:00:00 2001 From: eps1lon Date: Thu, 29 Sep 2022 19:00:03 +0200 Subject: [PATCH] test: Enable `react/no-unstable-nested-components` --- .eslintrc.js | 2 ++ packages/mui-material-next/src/Button/Button.spec.tsx | 2 +- packages/mui-material/src/Button/Button.spec.tsx | 2 +- .../src/DialogContentText/DialogContentText.spec.tsx | 2 +- packages/mui-material/src/Typography/typography.spec.tsx | 2 +- packages/mui-material/test/typescript/components.spec.tsx | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8df154dca97c8f..db14d6b3d0eced 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -160,6 +160,8 @@ module.exports = { 'react/state-in-constructor': 'off', // stylistic opinion. For conditional assignment we want it outside, otherwise as static 'react/static-property-placement': 'off', + // Currently not in recommended ruleset but catches real bugs. + 'react/no-unstable-nested-components': 'error', }, overrides: [ { diff --git a/packages/mui-material-next/src/Button/Button.spec.tsx b/packages/mui-material-next/src/Button/Button.spec.tsx index bf9d28251ec7eb..e79e0dcacb07d2 100644 --- a/packages/mui-material-next/src/Button/Button.spec.tsx +++ b/packages/mui-material-next/src/Button/Button.spec.tsx @@ -11,7 +11,7 @@ const TestOverride = React.forwardRef((props, re const FakeIcon = () =>
Icon
; -const ButtonTest = () => ( +const buttonTest = () => (
diff --git a/packages/mui-material/src/Button/Button.spec.tsx b/packages/mui-material/src/Button/Button.spec.tsx index 72e294df93bc92..e13daf6220fe9a 100644 --- a/packages/mui-material/src/Button/Button.spec.tsx +++ b/packages/mui-material/src/Button/Button.spec.tsx @@ -11,7 +11,7 @@ const TestOverride = React.forwardRef((props, re const FakeIcon = () =>
Icon
; -const ButtonTest = () => ( +const buttonTest = () => (
diff --git a/packages/mui-material/src/DialogContentText/DialogContentText.spec.tsx b/packages/mui-material/src/DialogContentText/DialogContentText.spec.tsx index aeb4e5f5330167..c5ccfce954335c 100644 --- a/packages/mui-material/src/DialogContentText/DialogContentText.spec.tsx +++ b/packages/mui-material/src/DialogContentText/DialogContentText.spec.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { DialogContentText } from '@mui/material'; -const DialogContentTextTest = () => { +const dialogContentTextTest = () => { const CustomComponent: React.FC<{ prop1: string; prop2: number }> = () =>
; return (
diff --git a/packages/mui-material/src/Typography/typography.spec.tsx b/packages/mui-material/src/Typography/typography.spec.tsx index c2ceff074efc02..fecb3dc159f5cc 100644 --- a/packages/mui-material/src/Typography/typography.spec.tsx +++ b/packages/mui-material/src/Typography/typography.spec.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { Typography } from '@mui/material'; -const TypographyTest = () => { +const typographyTest = () => { const CustomComponent: React.FC<{ prop1: string; prop2: number }> = () =>
; return (
diff --git a/packages/mui-material/test/typescript/components.spec.tsx b/packages/mui-material/test/typescript/components.spec.tsx index cc295d0ae59aa6..14dd590f45f7fe 100644 --- a/packages/mui-material/test/typescript/components.spec.tsx +++ b/packages/mui-material/test/typescript/components.spec.tsx @@ -167,7 +167,7 @@ const BottomNavigationTest = () => { ); }; -const IconButtonTest = () => ( +const iconButtonTest = () => (