forked from Tencent/Hippy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
129 lines (117 loc) · 3.04 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
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'airbnb',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
plugins: [
'@typescript-eslint',
],
env: {
browser: true,
node: true,
},
globals: {
__PLATFORM__: true,
__GLOBAL__: true,
Hippy: true,
},
rules: {
// Ignore the dependency by each package
'import/no-unresolved': 'off',
// Allow comment or require align with space
'no-multi-spaces': 'off',
// Allow import name different with file name
'import/no-named-as-default': 'off',
// Allow imoprt cycle
'import/no-cycle': 'off',
// Disable prop-types
'react/prop-types': 'off',
// Turn of extensions checking temporary
'import/extensions': 'off',
// Note you must disable the base rule as it can report incorrect errors
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false
},
],
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules/namespace.md#allowcomputed
'import/namespace': [
'error',
{
allowComputed: true,
},
],
// Allow import from devDependencies
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'scripts/*.js',
'packages/**/types/*.d.ts', // FIXME: seems not working
'packages/**/__tests__/*.test.js',
'examples/**/scripts/*.js',
],
},
],
// Allow tsx as the jsx file
'react/jsx-filename-extension': [
'error',
{
extensions: ['.tsx', '.jsx'],
},
],
// Allow global underscore in dangle
'no-underscore-dangle': [
'error',
{
allow: [
'__GLOBAL__',
'__HIPPYNATIVEGLOBAL__',
'__instanceId__',
'_reactInternalFiber',
]
}
]
},
settings: {
'import/resolver': {
alias: {
map: [
['vue', 'vue/src/core/index'],
['compiler', 'vue/src/compiler'],
['web', 'vue/src/platforms/web'],
['core', 'vue/src/core'],
['shared', 'vue/src/shared'],
['sfc', 'vue/src/sfc'],
['he', './packages/hippy-vue/util/entity-decoder'],
['@localTypes', './types'],
['@vue', './packages/hippy-vue/src'],
['@router', './packages/hippy-vue-router/src'],
['@css-loader', './packages/hippy-vue-css-loader/src'],
['@native-components', './packages/hippy-vue-native-components/src'],
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json']
}
}
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
// Allow interface export
'no-undef': 'off',
// Disable props checking
'react/prop-types': 'off',
// Force use 2 space for indent
'@typescript-eslint/indent': ['error', 2],
}
}
]
}