-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
111 lines (106 loc) · 3.57 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: { project: './tsconfig.json' },
settings: {},
plugins: ['simple-import-sort', 'sort-destructure-keys', 'import-access', 'testing-library'],
extends: ['plugin:@typescript-eslint/recommended', 'next/core-web-vitals', 'prettier'],
rules: {
curly: 'error',
'no-console': ['error', { allow: ['warn', 'info', 'error'] }],
'no-restricted-syntax': ['error', { selector: 'TSEnumDeclaration', message: "Don't declare enums" }],
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
// 'arrow-body-style': ['error', 'as-needed', { requireReturnForObjectLiteral: true }],
'no-restricted-imports': ['error', { paths: [{ name: 'react', importNames: ['default'] }] }],
// react
'react-hooks/exhaustive-deps': 'off',
'react/display-name': 'off',
'react/jsx-handler-names': [
'error',
{
eventHandlerPrefix: 'handle',
eventHandlerPropPrefix: 'on',
checkLocalVariables: false,
checkInlineFunction: true
}
],
'react/destructuring-assignment': ['error', 'always'],
// next
'@next/next/no-img-element': 'off',
'jsx-a11y/alt-text': 'off',
// sort
// 'import/newline-after-import': 'error',
'import/no-default-export': 'error',
'import-access/jsdoc': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'sort-destructure-keys/sort-destructure-keys': 2,
// @typescript-eslint
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }],
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['typeAlias', 'typeParameter'],
format: ['PascalCase', 'UPPER_CASE']
},
{ selector: ['method'], format: ['camelCase', 'PascalCase'] },
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['no', 'is', 'has', 'should'],
filter: { regex: '^_', match: false }
}
],
// jsx-a11y
'jsx-a11y/no-autofocus': 'off',
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton']
}
]
},
overrides: [
{
files: [
'playwright.config.ts',
'pages/**/*.tsx',
'pages/**/*.ts',
'src/createEmotionCache.ts',
'src/theme/base.ts',
'next.config.mjs'
],
rules: { 'import/no-default-export': 'off' }
},
{
files: ['pages/**/*.tsx', 'pages/**/*.ts', 'next.config.js', 'src/type/**/*.d.ts'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{ selector: ['typeAlias', 'typeParameter'], format: ['PascalCase'] },
{ selector: ['classProperty', 'method'], format: ['camelCase'] },
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'has', 'should']
}
]
}
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react']
}
]
}