-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
62 lines (58 loc) · 1.38 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
/*
* @Description:
* @Author: shide
* @Date: 2021-04-19 19:44:12
* @LastEditTime: 2021-04-22 16:43:56
* @FilePath: /taro-cli/.eslintrc.js
*/
const codeConfig = require('./eslint/code')
const styleConfig = require('./eslint/styles')
const reactConfig = require('./eslint/react')
const deepmerge = require('deepmerge');
const isDebug = process.env.LINT_MODE === 'prod' ? 2 : 1;
const defautlConfig = {
env: {
'browser': true,
'node': true,
'mocha': true,
'jest': true
},
extends: [
'eslint:recommended',
'taro/react'
],
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2017
},
globals: {
'JSX': true,
'React': true,
'NodeJS': true
},
rules: {
// 以下重写强制eslint默认规则等级
'no-ex-assign': 2,
'no-empty': isDebug,
'no-invalid-regexp': 2,
'no-misleading-character-class': 2,
'no-sparse-arrays': 2,
'no-unexpected-multiline': 2,
'no-unreachable': 2,
'no-unsafe-finally': 2,
'require-atomic-updates': 2,
'use-isnan': 2,
'no-case-declarations': 2,
'no-empty-pattern': 2,
'no-fallthrough': 2,
'no-useless-escape': 2,
'constructor-super': 2,
'no-class-assign': 2,
'no-dupe-class-members': 2,
'no-this-before-super': 2
}
}
const config = deepmerge.all([defautlConfig, styleConfig, codeConfig, reactConfig])
module.exports = config