diff --git a/eslint.config.mjs b/eslint.config.mjs index 056631b78df..ca4fcc0bd4f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -10,6 +10,7 @@ import githubPlugin from 'eslint-plugin-github' import storybook from 'eslint-plugin-storybook' import react from 'eslint-plugin-react' import reactHooks from 'eslint-plugin-react-hooks' +import reactRefreshPlugin from 'eslint-plugin-react-refresh' import {unsupportedPatterns as reactCompilerUnsupported} from './packages/react/script/react-compiler.mjs' import playwright from 'eslint-plugin-playwright' import prettierRecommended from 'eslint-plugin-prettier/recommended' @@ -58,6 +59,23 @@ const config = defineConfig([ ...fixupConfigRules([react.configs.flat.recommended, react.configs.flat['jsx-runtime']]), reactHooks.configs.flat['recommended-latest'], + { + files: ['**/*.{jsx,tsx}'], + ignores: ['packages/styled-react/src/index.tsx'], + plugins: { + 'react-refresh': reactRefreshPlugin, + }, + rules: { + 'react-refresh/only-export-components': [ + 'error', + { + allowConstantExport: true, + allowExportNames: ['metadata'], + extraHOCs: ['assign', 'fixedForwardRef'], + }, + ], + }, + }, // Disable react-compiler rule for files not yet migrated { files: reactCompilerUnsupported.map(p => `packages/react/${p}`),