-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.js
97 lines (96 loc) · 2.93 KB
/
.eslintrc.js
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
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['next', 'prettier', 'plugin:import/recommended', 'plugin:import/typescript'],
plugins: ['prettier', 'import', '@typescript-eslint', 'simple-import-sort', 'ygt-rules'],
ignorePatterns: [
'.next/',
'node_modules/',
'.pnp.cjs',
'.pnp.loader.mjs',
'public',
'.yarn',
'@types',
],
settings: {
'import/resolver': 'node',
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
selector: 'variable',
leadingUnderscore: 'allow',
},
{ format: ['camelCase', 'PascalCase'], selector: 'function' },
{ format: ['PascalCase'], selector: 'interface' },
{ format: ['PascalCase'], selector: 'typeAlias' },
],
'no-implicit-coercion': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true, argsIgnorePattern: '_', varsIgnorePattern: '_' },
],
'prefer-const': 'error',
'no-var': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react/jsx-no-target-blank': 'error',
'import/no-duplicates': 'error',
'import/newline-after-import': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [
// react > next > @ > ~ > a~z
['^react$', '^next', '^@', '^[a-z]'],
// `../` > './'
['^~'],
['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Side effect imports
['^\\u0000'],
],
},
],
'simple-import-sort/exports': 'error',
'import/default': 'off',
'import/namespace': 'off',
'import/no-unresolved': 'off',
'@next/next/no-img-element': 'off',
'ygt-rules/internal-router-passhref': 'warn',
},
overrides: [
{
env: {
jest: true,
},
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(test).[jt]s?(x)'],
extends: ['plugin:testing-library/react', 'plugin:jest/recommended'],
rules: {
// 테스트 환경에서 devDependency 사용을 위해
'import/no-extraneous-dependencies': [
'off',
{ devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'] },
],
'react/display-name': 'off',
},
},
{
files: ['**/cypress/**/*.[jt]s?(x)', '**/?(*.)+(spec).[jt]s?(x)'],
rules: {
// 테스트 환경에서 devDependency 사용을 위해
'import/no-extraneous-dependencies': [
'off',
{ devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'] },
],
'react/display-name': 'off',
},
},
],
};