Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/eslint rules #70 #75

Merged
merged 3 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["react", "import", "unused-imports", "jsx-a11y"],
"plugins": [
"react",
"import",
"unused-imports",
"jsx-a11y",
"@typescript-eslint"
],
"rules": {
// 関数の戻り値の型を明示的に指定する
"@typescript-eslint/explicit-function-return-type": "error",
Expand Down Expand Up @@ -77,17 +83,28 @@
// modelコンポーネントにおいて、pageのimportを禁止する
{
"target": "./src/components/model",
"from": ["./src/components/page"]
"from": [
"./src/components/page",
"./node_modules/@radix-ui/",
"./node_modules/react-error-boundary"
]
},
// pageコンポーネントにおいて、他のpageコンポーネントからのimportを禁止する
{
"target": "./src/components/page/**/index.tsx",
"from": ["./src/components/page/**/index.tsx"]
"from": [
"./src/components/page/**/index.tsx",
"./node_modules/@radix-ui/"
]
},
// appディレクトリ配下においてmodel,uiのimportを禁止する
{
"target": "./src/app/**/page.tsx",
"from": ["./src/components/model", "./src/components/ui"]
"from": [
"./src/components/model",
"./src/components/ui",
"./node_modules/@radix-ui/"
]
}
]
}
Expand Down Expand Up @@ -178,8 +195,13 @@
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports"
"prefer": "type-imports",
"disallowTypeAnnotations": false,
"fixStyle": "inline-type-imports"
}
]
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],

"@typescript-eslint/no-import-type-side-effects": ["error"]
}
}
3 changes: 2 additions & 1 deletion src/components/ui/Tag/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { FC, HTMLAttributes, ReactNode } from 'react';

import { cva, type VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import Link from 'next/link';

import type { VariantProps } from 'class-variance-authority';
import type { LinkProps as NextLinkProps } from 'next/link';

import { cn } from '@/libs/utils';
Expand Down
4 changes: 3 additions & 1 deletion src/libs/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { type ClassValue, clsx } from 'clsx';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';

import type { ClassValue } from 'clsx';

export const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));