-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtslintNamingConventionRule.d.ts
More file actions
185 lines (166 loc) · 4.81 KB
/
tslintNamingConventionRule.d.ts
File metadata and controls
185 lines (166 loc) · 4.81 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/* eslint-disable @typescript-eslint/naming-convention */
declare namespace SharedConfig {
export type Severity = 0 | 1 | 2
export type SeverityString = 'error' | 'off' | 'warn'
export type RuleLevel = Severity | SeverityString
export type RuleLevelAndOptions = [RuleLevel, ...unknown[]]
export type RuleEntry = RuleLevel | RuleLevelAndOptions
export type RulesRecord = Partial<Record<string, RuleEntry>>
export type GlobalVariableOptionBase =
| 'off'
| /** @deprecated use `'readonly'` */ 'readable'
| 'readonly'
| 'writable'
| /** @deprecated use `'writable'` */ 'writeable'
export type GlobalVariableOptionBoolean =
| /** @deprecated use `'readonly'` */ false
| /** @deprecated use `'writable'` */ true
export type GlobalVariableOption = GlobalVariableOptionBase | GlobalVariableOptionBoolean
export type GlobalsConfig = Record<string, GlobalVariableOption>
export type EnvironmentConfig = Record<string, boolean>
export interface PluginMeta {
/**
* The meta.name property should match the npm package name for your plugin.
*/
name: string
/**
* The meta.version property should match the npm package version for your plugin.
*/
version: string
}
}
declare enum PredefinedFormats {
camelCase = 1,
strictCamelCase,
PascalCase,
StrictPascalCase,
snake_case,
UPPER_CASE,
}
declare type PredefinedFormatsString = keyof typeof PredefinedFormats
declare enum UnderscoreOptions {
forbid = 1,
allow,
require,
// special cases as it's common practice to use double underscore
requireDouble,
allowDouble,
allowSingleOrDouble,
}
declare type UnderscoreOptionsString = keyof typeof UnderscoreOptions
declare enum Selectors {
// variableLike
variable = 1 << 0,
function = 1 << 1,
parameter = 1 << 2,
// memberLike
parameterProperty = 1 << 3,
classicAccessor = 1 << 4,
enumMember = 1 << 5,
classMethod = 1 << 6,
objectLiteralMethod = 1 << 7,
typeMethod = 1 << 8,
classProperty = 1 << 9,
objectLiteralProperty = 1 << 10,
typeProperty = 1 << 11,
autoAccessor = 1 << 12,
// typeLike
class = 1 << 13,
interface = 1 << 14,
typeAlias = 1 << 15,
enum = 1 << 16,
typeParameter = 1 << 17,
// other
import = 1 << 18,
}
declare type SelectorsString = keyof typeof Selectors
declare enum MetaSelectors {
default = -1,
variableLike = 0 | Selectors.variable | Selectors.function | Selectors.parameter,
memberLike = 0 |
Selectors.classProperty |
Selectors.objectLiteralProperty |
Selectors.typeProperty |
Selectors.parameterProperty |
Selectors.enumMember |
Selectors.classMethod |
Selectors.objectLiteralMethod |
Selectors.typeMethod |
Selectors.classicAccessor |
Selectors.autoAccessor,
typeLike = 0 |
Selectors.class |
Selectors.interface |
Selectors.typeAlias |
Selectors.enum |
Selectors.typeParameter,
method = 0 | Selectors.classMethod | Selectors.objectLiteralMethod | Selectors.typeMethod,
property = 0 |
Selectors.classProperty |
Selectors.objectLiteralProperty |
Selectors.typeProperty,
accessor = 0 | Selectors.classicAccessor | Selectors.autoAccessor,
}
declare type MetaSelectorsString = keyof typeof MetaSelectors
declare type IndividualAndMetaSelectorsString = MetaSelectorsString | SelectorsString
declare enum Modifiers {
// const variable
const = 1 << 0,
// readonly members
readonly = 1 << 1,
// static members
static = 1 << 2,
// member accessibility
public = 1 << 3,
protected = 1 << 4,
private = 1 << 5,
'#private' = 1 << 6,
abstract = 1 << 7,
// destructured variable
destructured = 1 << 8,
// variables declared in the top-level scope
global = 1 << 9,
// things that are exported
exported = 1 << 10,
// things that are unused
unused = 1 << 11,
// properties that require quoting
requiresQuotes = 1 << 12,
// class members that are overridden
override = 1 << 13,
// class methods, object function properties, or functions that are async via the `async` keyword
async = 1 << 14,
// default imports
default = 1 << 15,
// namespace imports
namespace = 1 << 16,
// make sure TypeModifiers starts at Modifiers + 1 or else sorting won't work
}
declare type ModifiersString = keyof typeof Modifiers
declare enum TypeModifiers {
boolean = 1 << 17,
string = 1 << 18,
number = 1 << 19,
function = 1 << 20,
array = 1 << 21,
}
declare type TypeModifiersString = keyof typeof TypeModifiers
interface MatchRegex {
match: boolean
regex: string
}
declare interface Selector {
custom?: MatchRegex
filter?: string | MatchRegex
// format options
format: PredefinedFormatsString[] | null
leadingUnderscore?: UnderscoreOptionsString
modifiers?: ModifiersString[]
prefix?: string[]
// selector options
selector: IndividualAndMetaSelectorsString | IndividualAndMetaSelectorsString[]
suffix?: string[]
trailingUnderscore?: UnderscoreOptionsString
types?: TypeModifiersString[]
}
export type NamingConventionRule = [SharedConfig.RuleEntry, ...Selector[]]