-
Notifications
You must be signed in to change notification settings - Fork 52
/
.eslintrc.js
114 lines (114 loc) · 2.89 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
/** @type {import('eslint').Linter.Config} */
module.exports = {
plugins: ['lodash'],
ignorePatterns: ['node_modules', 'release', 'html-report'],
globals: {
page: true,
browser: true,
jestPuppeteer: true,
_HOST_URI__: true,
__JWT_TOKEN__: true,
__THIRD_PARTY_URI__: true,
__TEST_SMS_RECEIVER_NUMBER__: true,
},
overrides: [
// js ts files
{
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
extends: [
'plugin:import/recommended',
'plugin:prettier/recommended',
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
'lodash/import-scope': 'error',
'react/no-array-index-key': 'warn',
'import/no-cycle': 'error',
'import/order': 'error',
'import/no-duplicates': 'error',
'import/named': 'off',
'no-console': 'warn',
'@typescript-eslint/no-empty-function': 'off',
},
},
// js files
{
files: ['*.js', '*.jsx'],
extends: [],
rules: {
'@typescript-eslint/no-empty-function': 'off',
},
},
// ts files
{
files: ['*.ts', '*.tsx'],
extends: ['plugin:import/typescript'],
rules: {
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
// * close that for current eslint still not support metadata https://github.com/typescript-eslint/typescript-eslint/issues/5468
// '@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/ban-types': [
'error',
{
types: {
'{}': false,
},
extendDefaults: true,
},
],
'@typescript-eslint/ban-ts-comment': 'off',
'no-alert': 'error',
},
},
// react files
{
files: ['*.jsx', '*.tsx'],
extends: [],
rules: {
// a11y still not need in our app
'jsx-a11y/anchor-is-valid': 'off',
},
},
// test files
{
files: [
'**/*.test.ts',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.test.tsx',
'**/*.test.js',
'**/*.test.jsx',
'**/*.spec.js',
'**/*.spec.jsx',
],
plugins: ['jest'],
rules: {
'react-hooks/rules-of-hooks': 'off',
'no-undef': 'off',
},
},
{
files: ['*.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
// for i18n folder, ignore prettier format
{
files: ['**/i18n/**/*'],
rules: {
quotes: ['error', 'single', { avoidEscape: true }],
},
},
],
};