From b35b92a6d06a3162fc90e25222915a1cb4963408 Mon Sep 17 00:00:00 2001 From: tosaken1116 Date: Mon, 6 Nov 2023 01:57:42 +0900 Subject: [PATCH] chore: add eslint rule of React import --- .eslintrc.json | 13 ++++++++++++- src/components/ui/Tag/index.tsx | 1 - 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4b0b528..4b738c4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -43,7 +43,18 @@ "html": true } ], - + // Reactの明示的なimportを禁止する + "no-restricted-imports": [ + "error", + { + "paths": [ + { + "name": "react", + "importNames": ["default"] + } + ] + } + ], // 型の名前をパスカルケースにする "@typescript-eslint/naming-convention": [ "error", diff --git a/src/components/ui/Tag/index.tsx b/src/components/ui/Tag/index.tsx index 6be84aa..ab74890 100644 --- a/src/components/ui/Tag/index.tsx +++ b/src/components/ui/Tag/index.tsx @@ -1,5 +1,4 @@ import type { FC, HTMLAttributes, ReactNode } from 'react'; -import React from 'react'; import { cva, type VariantProps } from 'class-variance-authority'; import Link from 'next/link';