From 3d165ec7d9a1fb0994ceec7446533a9157e999b2 Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Tue, 22 Oct 2024 13:49:39 +0800 Subject: [PATCH] build: eslint plugin react-refresh --- web/eslint.config.mjs | 13 +++++++++++++ web/package.json | 2 +- web/pnpm-lock.yaml | 8 ++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs index efd3cac12a..389c064e0b 100644 --- a/web/eslint.config.mjs +++ b/web/eslint.config.mjs @@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url' import js from '@eslint/js' import { FlatCompat } from '@eslint/eslintrc' import globals from 'globals' +import reactRefresh from "eslint-plugin-react-refresh" const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) @@ -172,4 +173,16 @@ export default combine( }, }, }, + { + files: [ + GLOB_TSX, + GLOB_JSX, + ], + plugins: { + "react-refresh": reactRefresh, + }, + rules: { + "react-refresh/only-export-components": "warn", + }, + } ) diff --git a/web/package.json b/web/package.json index a56f218696..7a66208bbb 100644 --- a/web/package.json +++ b/web/package.json @@ -152,7 +152,7 @@ "eslint": "^9.13.0", "eslint-config-next": "^15.0.0-canary.202", "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-react-refresh": "^0.4.12", + "eslint-plugin-react-refresh": "^0.4.13", "eslint-plugin-storybook": "^0.9.0", "husky": "^8.0.3", "jest": "^29.7.0", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 600e7061c4..f051851e7a 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -393,7 +393,7 @@ importers: specifier: ^5.0.0 version: 5.0.0(eslint@9.13.0(jiti@1.21.6)) eslint-plugin-react-refresh: - specifier: ^0.4.12 + specifier: ^0.4.13 version: 0.4.13(eslint@9.13.0(jiti@1.21.6)) eslint-plugin-storybook: specifier: ^0.9.0 @@ -12822,7 +12822,7 @@ snapshots: debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 9.13.0(jiti@1.21.6) - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0(jiti@1.21.6)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.3.1(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-plugin-import@2.31.0)(eslint@9.13.0(jiti@1.21.6)))(eslint@9.13.0(jiti@1.21.6)) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 @@ -12840,7 +12840,7 @@ snapshots: dependencies: eslint: 9.13.0(jiti@1.21.6) - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0(jiti@1.21.6)): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.3.1(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-plugin-import@2.31.0)(eslint@9.13.0(jiti@1.21.6)))(eslint@9.13.0(jiti@1.21.6)): dependencies: debug: 3.2.7 optionalDependencies: @@ -12896,7 +12896,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.13.0(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0(jiti@1.21.6)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.11.0(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.3.1(eslint@9.13.0(jiti@1.21.6))(typescript@4.9.5))(eslint-plugin-import@2.31.0)(eslint@9.13.0(jiti@1.21.6)))(eslint@9.13.0(jiti@1.21.6)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3