@@ -92,6 +92,54 @@ test('export', (t): void => {
92
92
minimumDescriptionLength : 3
93
93
} ] ,
94
94
'@typescript-eslint/ban-tslint-comment' : 'error' ,
95
+ '@typescript-eslint/ban-types' : [ 'error' , {
96
+ extendDefaults : false ,
97
+ types : {
98
+ String : {
99
+ message : 'Use string instead' ,
100
+ fixWith : 'string'
101
+ } ,
102
+ Boolean : {
103
+ message : 'Use boolean instead' ,
104
+ fixWith : 'boolean'
105
+ } ,
106
+ Number : {
107
+ message : 'Use number instead' ,
108
+ fixWith : 'number'
109
+ } ,
110
+ Symbol : {
111
+ message : 'Use symbol instead' ,
112
+ fixWith : 'symbol'
113
+ } ,
114
+ BigInt : {
115
+ message : 'Use bigint instead' ,
116
+ fixWith : 'bigint'
117
+ } ,
118
+ Function : {
119
+ message : [
120
+ 'The `Function` type accepts any function-like value.' ,
121
+ 'It provides no type safety when calling the function, which can be a common source of bugs.' ,
122
+ 'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.' ,
123
+ 'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
124
+ ] . join ( '\n' )
125
+ } ,
126
+ // object typing
127
+ Object : {
128
+ message : [
129
+ 'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.' ,
130
+ '- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.' ,
131
+ '- If you want a type meaning "any value", you probably want `unknown` instead.'
132
+ ] . join ( '\n' )
133
+ } ,
134
+ '{}' : {
135
+ message : [
136
+ '`{}` actually means "any non-nullish value".' ,
137
+ '- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.' ,
138
+ '- If you want a type meaning "any value", you probably want `unknown` instead.'
139
+ ] . join ( '\n' )
140
+ }
141
+ }
142
+ } ] ,
95
143
'@typescript-eslint/brace-style' : [ 'error' , '1tbs' , { allowSingleLine : true } ] ,
96
144
'@typescript-eslint/comma-dangle' : [ 'error' , {
97
145
arrays : 'never' ,
@@ -371,7 +419,6 @@ test('all plugin rules are considered', (t) => {
371
419
// This serves as a todo list and should ideally eventually end up empty
372
420
// and then fail upon plugin upgrades where new rules are released.
373
421
const notYetConsideredRules : string [ ] = [
374
- 'ban-types' ,
375
422
'class-literal-property-style' ,
376
423
'consistent-generic-constructors' ,
377
424
'consistent-type-exports' ,
0 commit comments