forked from Tencent/Hippy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
134 lines (121 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
130
131
132
133
134
module.exports = {
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaFeatures: {
jsx: true,
legacyDecorators: true,
experimentalObjectRestSpread: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
extends: [
'eslint-config-tencent',
'plugin:react/recommended',
'plugin:vue/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
plugins: [
'vue',
'@typescript-eslint',
'jsx-a11y',
],
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],
// Note you must disable the base rule as it can report incorrect errors
'no-unused-vars': 'off',
},
},
],
env: {
browser: true,
node: true,
es6: true,
},
globals: {
__PLATFORM__: 'readonly',
__GLOBAL__: 'readonly',
Hippy: 'readonly',
WebSocket: 'readonly',
},
rules: {
semi: ['error', 'always'],
// Allow more than one component per file
'vue/one-component-per-file': 'off',
// Allow no default value
'vue/require-default-prop': 'off',
// Allow no prop type
'vue/require-prop-types': 'off',
// Allow event name not kebab-case
'vue/custom-event-name-casing': 'off',
'import/no-unresolved': 'off',
// Allow import name different with file name
'import/no-named-as-default': 'off',
// Allow import cycle
'import/no-cycle': 'off',
// Disable prop-types
'react/prop-types': 'off',
// Disable deprecated
'react/no-deprecated': 'off',
// Turn of extensions checking temporary
'import/extensions': 'off',
// 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',
// FIXME: seems not working
'packages/**/types/*.d.ts',
'packages/**/__tests__/*.test.js',
'examples/**/scripts/*.js',
],
},
],
// Allow tsx as the jsx file
'react/jsx-filename-extension': [
'error',
{
extensions: ['.tsx', '.jsx'],
},
],
// Auto range order of imported module
'import/order': ['error'],
// Allow global underscore in dangle
'no-underscore-dangle': [
'warn',
{
allow: [
'__ISHIPPY__',
'__GLOBAL__',
'__HIPPYNATIVEGLOBAL__',
'__instanceId__',
'_reactInternalFiber',
'_reactInternals',
],
},
],
},
settings: {
react: {
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
},
};