forked from kubesphere/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
116 lines (114 loc) · 3.07 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
/*
* This file is part of KubeSphere Console.
* Copyright (C) 2019 The KubeSphere Console Authors.
*
* KubeSphere Console is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* KubeSphere Console is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
modules: true,
},
},
env: {
es6: true,
commonjs: true,
browser: true,
jest: true,
},
extends: ['airbnb-base', 'plugin:prettier/recommended'],
// https://github.com/yannickcr/eslint-plugin-react
plugins: ['react', 'babel', 'promise'],
// check if imports actually resolve
settings: {
'import/resolver': {
webpack: {
config: 'scripts/webpack.base.js',
},
},
},
// add your custom rules here
rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
'import/no-extraneous-dependencies': 0,
'import/no-dynamic-require': 0,
'import/no-cycle': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'global-require': 0,
'no-console': ["error", { allow: ["warn", "error"] }],
'dot-notation': 0,
'no-underscore-dangle': 0,
'no-param-reassign': 0,
'no-unused-expressions': 0,
'no-mixed-operators': 0,
'no-return-await': 0,
'no-restricted-syntax': 0,
'no-await-in-loop': 0,
'no-restricted-globals': 0,
'no-empty': [
2,
{
allowEmptyCatch: true,
},
],
camelcase: 0,
'max-len': [
1,
{
code: 100,
tabWidth: 2,
ignoreUrls: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreTrailingComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignorePattern:
"^(\\s*[a-zA-Z_]+: '[^']+'[,;]*)|(.*require.*)$",
},
],
'import/prefer-default-export': 0,
'no-eval': 0,
'no-plusplus': 0,
'func-names': 0,
'consistent-return': 0,
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2,
'class-methods-use-this': 0,
'no-nested-ternary': 0,
'no-use-before-define': 0,
'prefer-destructuring': 0,
'max-classes-per-file': 0,
'prefer-promise-reject-errors': 0,
},
parserOptions: {
ecmaFeatures: {
legacyDecorators: true
}
},
globals: {
t: true,
globals: true,
request: true,
},
}