forked from MetaMask/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
88 lines (87 loc) · 2.47 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
module.exports = {
extends: ['../../.eslintrc.js'],
overrides: [
{
files: [
'src/PermissionController.test.ts',
'src/rpc-methods/revokePermissions.test.ts',
],
rules: {
// This is taken directly from @metamask/[email protected]
'@typescript-eslint/naming-convention': [
'error',
// We have to disable the default selector for our objectLiteralProperty
// filter to work.
// {
// selector: 'default',
// format: ['camelCase'],
// leadingUnderscore: 'allow',
// trailingUnderscore: 'forbid',
// },
{
selector: 'enumMember',
format: ['PascalCase'],
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
{
selector: 'objectLiteralMethod',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
},
// This option is modified by the addition of a filter.
{
selector: 'objectLiteralProperty',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
filter: {
// Match RPC method names like foo_bar, foo_barBaz, etc., and metamask.io
regex: '(^[a-z]+_[a-z]+[a-zA-Z0-9]*)|metamask\\.io$',
match: false,
},
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'typeParameter',
format: ['PascalCase'],
custom: {
regex: '^.{3,}',
match: true,
},
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: [
'classProperty',
'objectLiteralProperty',
'typeProperty',
'classMethod',
'objectLiteralMethod',
'typeMethod',
'accessor',
'enumMember',
],
format: null,
modifiers: ['requiresQuotes'],
},
],
},
},
],
};