From c2406868909bda55cc90ef51638ea1d0bec9e641 Mon Sep 17 00:00:00 2001 From: TinsFox Date: Sun, 3 Nov 2024 21:41:37 +0800 Subject: [PATCH] fix(eslint): restrict react-refresh rule to pages directory only - Disable react-refresh/only-export-components rule globally - Configure the rule specifically for pages/**/*.tsx files - Resolve Fast Refresh warnings in components directory --- eslint.config.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 9d35a8c..de0e908 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -12,7 +12,6 @@ export default defineConfig( lessOpinionated: true, preferESM: false, ignores: [ - "public/mockServiceWorker.js", "src/components/ui", "pnpm-lock.yaml", ], @@ -23,10 +22,16 @@ export default defineConfig( whitelist: ["center"], }, }, + rules: { + "react-refresh/only-export-components": "off", + }, + }, + { + files: ["**/pages/**/*.tsx"], rules: { "react-refresh/only-export-components": [ "warn", - { allowExportNames: ["loader"] }, + { allowExportNames: ["loader", "Component", "action"] }, ], }, },