-
Notifications
You must be signed in to change notification settings - Fork 111
/
.eslintrc.js
156 lines (153 loc) · 5.3 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
module.exports = {
root: true,
ignorePatterns: ['node_modules', 'dist'],
extends: ['plugin:prettier/recommended', 'prettier'],
rules: {
/* common */
'no-underscore-dangle': 'off',
'no-plusplus': 'off',
'class-method-use-this': 'off',
eqeqeq: ['error', 'smart'],
complexity: 'error',
'no-empty': ['error'],
'no-restricted-globals': 'error',
'no-param-reassign': 'off',
'no-prototype-builtins': 'off',
/* styles */
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
indent: 'off',
'max-classes-per-file': 'error',
radix: ['error', 'as-needed'],
'no-return-assign': 'off',
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
'no-console': [
'warn',
{
allow: ['debug', 'error', 'info']
}
]
},
overrides: [
{
files: ['**/*.ts'],
parserOptions: {
parser: '@typescript-eslint/parser',
sourceType: 'module',
ecmaVersion: 'latest'
}
},
{
files: ['src/**/*.tsx', 'tests/**/*.tsx'],
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
},
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
parserOptions: {
project: './tsconfig.json'
}
},
{
files: ['tests/**/*.ts', 'tests/**/*.tsx'],
parserOptions: {
project: './tsconfig.test.json'
}
},
{
files: ['src/**/*.ts', 'src/**/*.tsx', 'tests/**/*.ts', 'tests/**/*.tsx'],
plugins: [
'react',
'react-hooks',
'@typescript-eslint',
'import',
'unused-imports',
'chakra-ui',
'i18next'
],
extends: [
'airbnb-typescript/base',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:i18next/recommended'
],
rules: {
/* imports */
'import/extensions': [
'error',
'never',
{
scss: 'always',
css: 'always',
json: 'always',
svg: 'always'
}
],
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: false, optionalDependencies: false, peerDependencies: false }
],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
args: 'all',
ignoreRestSiblings: false,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
/* typescript */
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'enumMember',
format: ['UPPER_CASE']
}
],
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/comma-dangle': ['error', 'never'],
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
/* react */
'react/react-in-jsx-scope': 'off',
'i18next/no-literal-string': [
'warn',
{
exclude: ['Ton Console']
}
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'off',
'react/display-name': 'off',
'react/prop-types': 'off'
},
settings: {
react: {
version: 'detect'
}
}
},
{
files: ['tests/**/*.ts', 'tests/**/*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }]
}
}
]
};