@alexlit/config-eslint 41.0.2 → 41.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/CHANGELOG.md +2 -0
- package/dictionaries/default.js +16 -0
- package/package.json +2 -2
- package/plugins/typescript/allow-boolean-property-list.const.js +37 -0
- package/plugins/typescript/boolean-prefixes.const.js +11 -0
- package/plugins/typescript/english-verbs.const.js +3359 -0
- package/plugins/typescript/index.js +167 -0
- package/plugins/typescript.js +0 -1318
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
const ALLOW_BOOLEAN_PROPERTY_LIST = require('./allow-boolean-property-list.const');
|
|
2
|
+
const BOOLEAN_PREFIXES = require('./boolean-prefixes.const');
|
|
3
|
+
const ENGLISH_VERBS = require('./english-verbs.const');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @see [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
extends: ['plugin:@typescript-eslint/recommended'],
|
|
10
|
+
|
|
11
|
+
overrides: [
|
|
12
|
+
{
|
|
13
|
+
files: ['*.d.ts'],
|
|
14
|
+
|
|
15
|
+
rules: {
|
|
16
|
+
'@typescript-eslint/naming-convention': 'off',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
plugins: ['@typescript-eslint'],
|
|
22
|
+
|
|
23
|
+
rules: {
|
|
24
|
+
'@typescript-eslint/array-type': ['error', { default: 'array' }],
|
|
25
|
+
|
|
26
|
+
'@typescript-eslint/consistent-type-assertions': [
|
|
27
|
+
'error',
|
|
28
|
+
{
|
|
29
|
+
assertionStyle: 'as',
|
|
30
|
+
objectLiteralTypeAssertions: 'allow-as-parameter',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
35
|
+
|
|
36
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
37
|
+
'error',
|
|
38
|
+
{ prefer: 'type-imports' },
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
42
|
+
|
|
43
|
+
'@typescript-eslint/member-ordering': 'off', // delegate to sort-class-members plugin
|
|
44
|
+
|
|
45
|
+
'@typescript-eslint/method-signature-style': ['error', 'method'],
|
|
46
|
+
|
|
47
|
+
'@typescript-eslint/naming-convention': [
|
|
48
|
+
'error',
|
|
49
|
+
|
|
50
|
+
{
|
|
51
|
+
format: ['camelCase'],
|
|
52
|
+
selector: 'default',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
format: ['camelCase' /* 'UPPER_CASE' */],
|
|
56
|
+
selector: 'variable',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
format: ['camelCase'],
|
|
60
|
+
leadingUnderscore: 'allow',
|
|
61
|
+
selector: 'parameter',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
format: ['camelCase'],
|
|
65
|
+
leadingUnderscore: 'require',
|
|
66
|
+
modifiers: ['private'],
|
|
67
|
+
selector: 'memberLike',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
format: ['PascalCase'],
|
|
71
|
+
selector: 'typeLike',
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
custom: {
|
|
76
|
+
match: false,
|
|
77
|
+
regex: '^I[A-Z]',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
format: ['PascalCase'],
|
|
81
|
+
selector: 'interface',
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
{
|
|
85
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase', 'snake_case'],
|
|
86
|
+
leadingUnderscore: 'allow',
|
|
87
|
+
selector: 'objectLiteralProperty',
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
{
|
|
91
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
92
|
+
selector: 'objectLiteralMethod',
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
{
|
|
96
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
97
|
+
modifiers: ['destructured'],
|
|
98
|
+
selector: 'parameter',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
{
|
|
102
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
103
|
+
modifiers: ['const'],
|
|
104
|
+
selector: 'variable',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
format: ['camelCase'],
|
|
108
|
+
leadingUnderscore: 'allow',
|
|
109
|
+
modifiers: ['destructured'],
|
|
110
|
+
selector: 'variable',
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
filter: {
|
|
115
|
+
match: false,
|
|
116
|
+
regex: `(${ALLOW_BOOLEAN_PROPERTY_LIST.join('|')})`,
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
format: ['PascalCase'],
|
|
120
|
+
|
|
121
|
+
leadingUnderscore: 'allow',
|
|
122
|
+
|
|
123
|
+
prefix: BOOLEAN_PREFIXES,
|
|
124
|
+
|
|
125
|
+
selector: ['variable', 'parameter', 'property', 'accessor'],
|
|
126
|
+
|
|
127
|
+
types: ['boolean'],
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
{
|
|
131
|
+
format: ['PascalCase'],
|
|
132
|
+
|
|
133
|
+
leadingUnderscore: 'allow',
|
|
134
|
+
|
|
135
|
+
prefix: [
|
|
136
|
+
...ENGLISH_VERBS,
|
|
137
|
+
...ENGLISH_VERBS.map((verb) => `re${verb}`),
|
|
138
|
+
|
|
139
|
+
'on',
|
|
140
|
+
],
|
|
141
|
+
|
|
142
|
+
selector: [
|
|
143
|
+
'function',
|
|
144
|
+
'classMethod',
|
|
145
|
+
// 'objectLiteralMethod',
|
|
146
|
+
// 'typeMethod',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
|
|
151
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
152
|
+
|
|
153
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
154
|
+
'error',
|
|
155
|
+
{
|
|
156
|
+
ignoreParameters: true,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
|
|
160
|
+
'@typescript-eslint/no-shadow': ['error'],
|
|
161
|
+
'@typescript-eslint/no-unused-vars': 'off', // delegate to eslint-plugin-unused-imports
|
|
162
|
+
'@typescript-eslint/no-use-before-define': ['warn'],
|
|
163
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
164
|
+
'@typescript-eslint/sort-type-union-intersection-members': ['error'],
|
|
165
|
+
'@typescript-eslint/unified-signatures': ['error'],
|
|
166
|
+
},
|
|
167
|
+
};
|