-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
89 lines (89 loc) · 2.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
const isDev = process.env.NODE_ENV !== 'production';
const jsRules = {
// eslint-disable-next-line global-require
'prettier/prettier': ['error', require('./.prettierrc.js')],
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-shadow': 'off',
'import/no-extraneous-dependencies': 'off',
'no-restricted-exports': 'off',
'func-names': 'off',
'class-methods-use-this': 'off',
'import/extensions': 'off',
'global-require': 'off',
'import/no-unresolved': 'off', // tsc can check this
'no-promise-executor-return': 'off',
'default-param-last': 'off',
'import/no-cycle': 'error',
'@typescript-eslint/require-await': 'off',
'max-classes-per-file': 'off',
camelcase: 'off',
'no-continue': 'off',
'no-console': 'warn',
};
const tsRules = {
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': [isDev ? 'warn' : 'error'],
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'sort-imports': [
'error',
{
ignoreMemberSort: false,
ignoreDeclarationSort: true,
},
],
'import/order': [
'warn',
{
groups: [
'builtin',
'internal',
'index',
'external',
'parent',
'sibling',
'object',
'type',
],
pathGroups: [
{
pattern: '@onekey/**',
group: 'external',
position: 'after',
},
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
pathGroupsExcludedImportTypes: ['builtin'],
warnOnUnassignedImports: true,
},
],
'no-process-env': 'error',
};
module.exports = {
extends: './node_modules/mwts/',
ignorePatterns: ['node_modules', 'dist', 'test', 'jest.config.js', 'typings'],
env: {
jest: true,
},
plugins: ['eslint-plugin-import'],
overrides: [
{
files: ['*.ts'],
rules: {
...jsRules,
...tsRules,
},
},
],
};