-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.mjs
97 lines (94 loc) · 2.7 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { includeIgnoreFile } from '@eslint/compat';
import pluginJs from '@eslint/js';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import unusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';
import tseslint from 'typescript-eslint';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');
/** @type {import('eslint').Linter.Config[]} */
export default [
includeIgnoreFile(gitignorePath),
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.serviceworker,
},
},
settings: { react: { version: 'detect' } },
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
'react/forbid-dom-props': [
'warn',
{
forbid: [
{
propName: 'style',
message:
'CSP 문제로 style prop은 직접 사용할 수 없습니다. tailwind className 혹은 useStyle을 사용하세요.',
},
],
},
],
},
},
pluginReact.configs.flat['jsx-runtime'],
{
plugins: { 'react-hooks': pluginReactHooks, 'simple-import-sort': simpleImportSort },
rules: {
...pluginReactHooks.configs.recommended.rules,
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
{
rules: {
'no-restricted-imports': [
'error',
{
name: 'next/link',
message: 'Please import from `@/i18n/routing` instead.',
},
{
name: 'next/navigation',
importNames: ['redirect', 'permanentRedirect', 'useRouter', 'usePathname'],
message: 'Please import from `@/i18n/routing` instead.',
},
{
name: 'next/image',
importNames: ['default'],
message: 'CSP 문제로 @/components/common/image를 사용해주세요.',
},
],
},
},
{
plugins: {
'unused-imports': unusedImports,
},
rules: {
'unused-imports/no-unused-imports': 'error',
},
},
jsxA11y.flatConfigs.recommended,
{
rules: {
'jsx-a11y/label-has-associated-control': 'warn',
'jsx-a11y/click-events-have-key-events': 'warn',
'jsx-a11y/no-static-element-interactions': 'warn',
'jsx-a11y/no-noninteractive-element-interactions': 'warn',
},
},
];