-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_base.js
128 lines (125 loc) · 3.83 KB
/
_base.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
const browser = require('./tools/browser')
const __import = require('./tools/import')
const jest = require('./tools/jest')
const lang = require('./tools/lang')
const promise = require('./tools/promise')
const base = ({ isBrowser } = {}) => {
return {
plugins: [
...__import.plugins,
...jest.plugins,
...lang.plugins,
...promise.plugins,
isBrowser && 'compat',
'regexp',
'unicorn',
].filter(Boolean),
env: isBrowser ? browser.env : {},
rules: {
...__import.rules,
...jest.rules,
...lang.rules,
...promise.rules,
'unicorn/filename-case': [
'error',
{
cases: {
camelCase: true,
pascalCase: true,
},
},
],
'unicorn/no-this-assignment': 'error',
'unicorn/no-new-array': 'error',
'unicorn/no-array-instanceof': 'error',
'unicorn/no-for-loop': 'off',
'unicorn/no-empty-file': 'error',
'unicorn/no-nested-ternary': 'error',
'unicorn/no-useless-undefined': 'error',
'unicorn/no-useless-spread': 'error',
'unicorn/no-useless-length-check': 'error',
'unicorn/no-unsafe-regex': 'error',
'unicorn/prefer-date-now': 'warn',
'unicorn/prefer-event-target': 'warn',
'unicorn/better-regex': 'warn',
'unicorn/prefer-flat-map': 'warn',
'unicorn/prefer-includes': 'error',
'unicorn/prefer-node-protocol': 'warn',
'unicorn/prefer-switch': 'error',
'unicorn/error-message': 'error',
'unicorn/catch-error-name': 'error',
'unicorn/expiring-todo-comments': 'warn',
'unicorn/no-array-for-each': 'error',
'unicorn/escape-case': 'error',
'unicorn/no-invalid-remove-event-listener': 'error',
'unicorn/no-abusive-eslint-disable': 'error',
'unicorn/empty-brace-spaces': 'error',
'unicorn/no-array-method-this-argument': 'error',
'unicorn/consistent-function-scoping': 'warn',
'unicorn/consistent-destructuring': 'warn',
'unicorn/no-array-push-push': 'error',
'unicorn/no-process-exit': 'error',
'unicorn/no-console-spaces': 'error',
'unicorn/no-await-expression-member': 'warn',
'unicorn/no-document-cookie': 'error',
'unicorn/prefer-logical-operator-over-ternary': 'warn',
'unicorn/no-thenable': 'error',
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/no-array-reduce': [
'error',
{
allowSimpleOperations: true,
},
],
'unicorn/no-keyword-prefix': 'off',
'unicorn/no-lonely-if': 'error',
'unicorn/prevent-abbreviations': [
'error',
{
allowList: {
props: true,
getInitialProps: true,
e: false,
p: false,
res: false,
req: false,
ctx: false,
arg: false,
err: true,
Props: true,
},
},
],
'no-lonely-if': 'error',
'no-else-return': 'error',
quotes: ['error', 'single'],
'no-console': 'warn',
'no-debugger': 'warn',
'no-var': 'error',
'prefer-const': 'error',
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
'no-alert': 'error',
semi: ['error', 'never'],
'@typescript-eslint/semi': ['error', 'never'],
'no-unused-vars': 'off',
'no-useless-escape': 'off',
'no-useless-constructor': 'error',
'no-useless-concat': 'error',
'no-useless-call': 'error',
},
parser: lang.parser,
parserOptions: {
...lang.parserOptions,
},
extends: [
'eslint:recommended',
isBrowser && 'plugin:compat/recommended',
'plugin:regexp/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:jest/recommended',
].filter(Boolean),
}
}
module.exports = base