-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
67 lines (66 loc) · 2.03 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
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
// './eslint-rule.js',
// './eslint-rule.js'
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
impliedStrict: true
}
},
plugins: ['react'],
rules: {
// "prettier/prettier": "error",
indent: ['error', 4], // 缩进使用4个空格
'no-unused-vars': 'error', // 不使用未定义的变量
'keyword-spacing': ['error', {after: true}], // 关键字后面要加空格
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'], // 强制使用单引号
eqeqeq: 'error',
'block-scoped-var': 'error',
"operator-linebreak": ["error", "before", {"overrides": {"?": "before", ":": "before"}}],
'comma-dangle': 'off',
'no-eval': 'warn',
'no-console': 'warn',
'no-debugger': 'error',
'no-undef': 'warn',
'no-unused-vars': 'warn',
'operator-linebreak': ['error', 'before'],
indent: [2, 4, {SwitchCase: 1}],
'max-len': ['error', 120],
'object-curly-spacing': ['error', 'never'],
'object-curly-newline': 'off',
'padded-blocks': 'off',
'jsx-quotes': ['error', 'prefer-double'],
'no-lonely-if': 'warn',
'array-callback-return': 'off',
'valid-jsdoc': [
'error',
{
requireReturn: false
}
],
semi: ['error', 'always'], // 始终都要有分号
'operator-linebreak': ['error', 'before'], // 换行时换行符放在操作符前面
},
settings: {
react: {
createClass: 'createReactClass',
pragma: 'React',
version: '16.0',
flowVersion: '0.53'
},
propWrapperFunctions: ['forbidExtraProps']
}
};