Skip to content

Commit

Permalink
Merge pull request #75 from Kyutech-C3/feat/eslint-rules-#70
Browse files Browse the repository at this point in the history
Feat/eslint rules #70
  • Loading branch information
tosaken1116 authored Nov 10, 2023
2 parents 103a304 + 9ca9ecb commit 0e27898
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
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));

0 comments on commit 0e27898

Please sign in to comment.