-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
52 lines (52 loc) · 1.79 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
module.exports = {
// 指定校验的ECMAScript的版本及特性
"parserOptions": {
"ecmaVersion": 7, // ECMAScript版本,7为ES7
"sourceType": "module", //默认script,如果代码是ECMAScript模块,设置为module
"ecmaFeatures": { // 使用额外的语言特性
"jsx": true // 启用JSX
}
},
// 当访问未定义的变量时,no-undef 规则将发出警告
// 指定脚本的运行环境。每种环境都有一组特定的预定义全局变量
"env": {
"es6": true,
"node": true,
"browser": true,
},
// 当访问未定义的变量时,no-undef 规则将发出警告
// 脚本在执行期间访问的额外的全局变量
"globals": {
"document": true,
"navigator": true,
"window":true,
"node":true
},
// 使用第三方airbnb开发配置合集
// "extends": "airbnb",
// eslint-config-airbnb包括了以下3个插件
"plugins": [
"react",
"jsx-a11y",
"import"
],
// 定义自己的规则
"rules": {
"comma-dangle": ["error", "never"], // 要求或禁止末尾逗号:不允许逗号
"indent": ["error", 4], // JavaScript代码强制使用一致的缩进:4格缩进,
"react/jsx-indent": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"no-use-before-define": 0,
"jsx-a11y/anchor-is-valid": 0,
"react/prop-types": 0,
"no-unused-vars": 0,
"semi": ["error", "never"],
"no-console": 0,
"class-methods-use-this": 0,
"import/prefer-default-export": 0,
"react/no-unused-state": 0,
"array-callback-return": 0,
"arrow-body-style": ["error", "as-needed", { "requireReturnForObjectLiteral": true }],
"no-unused-expressions": 0
}
};