@@ -97,33 +97,33 @@ If you are working on a codebase within which you lint non-TypeScript code (i.e.
97
97
98
98
### ` allowArgumentsExplicitlyTypedAsAny `
99
99
100
- Examples of code for this rule with ` { allowArgumentsExplicitlyTypedAsAny: false } ` :
100
+ When this option is ` true ` , the rule ignores arguments that are explicitly typed as any.
101
101
102
102
<Tabs >
103
- <TabItem value = " ❌ Incorrect" >
103
+ <TabItem value = " ❌ Incorrect for `allowArgumentsExplicitlyTypedAsAny: false` " >
104
104
105
105
``` ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
106
106
export const func = (value : any ): number => value + 1 ;
107
107
```
108
108
109
109
</TabItem >
110
- <TabItem value = " ✅ Correct" >
110
+ <TabItem value = " ✅ Correct for `allowArgumentsExplicitlyTypedAsAny: true` " >
111
111
112
- ``` ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
113
- export const func = (value : number ): number => value + 1 ;
112
+ ``` ts option='{ "allowArgumentsExplicitlyTypedAsAny": true }'
113
+ export const func = (value : any ): number => value + 1 ;
114
114
```
115
115
116
116
</TabItem >
117
117
</Tabs >
118
118
119
119
### ` allowDirectConstAssertionInArrowFunctions `
120
120
121
- Examples of code for this rule with ` { allowDirectConstAssertionInArrowFunctions: false } ` :
121
+ When this option is ` true ` , the rule ignores return type annotations on body-less arrow functions that return an ` as const ` type assertion.
122
122
123
123
<Tabs >
124
- <TabItem value = " ❌ Incorrect" >
124
+ <TabItem value = " ❌ Incorrect for `allowDirectConstAssertionInArrowFunctions: false` " >
125
125
126
- ``` ts option='{ "allowArgumentsExplicitlyTypedAsAny ": false }'
126
+ ``` ts option='{ "allowDirectConstAssertionInArrowFunctions ": false }'
127
127
export const func = (value : number ) => ({ type: ' X' , value });
128
128
export const foo = () => ({
129
129
bar: true ,
@@ -132,9 +132,9 @@ export const bar = () => 1;
132
132
```
133
133
134
134
</TabItem >
135
- <TabItem value = " ✅ Correct" >
135
+ <TabItem value = " ✅ Correct for `allowDirectConstAssertionInArrowFunctions: true` " >
136
136
137
- ``` ts option='{ "allowArgumentsExplicitlyTypedAsAny ": false }'
137
+ ``` ts option='{ "allowDirectConstAssertionInArrowFunctions ": true }'
138
138
export const func = (value : number ) => ({ type: ' X' , value }) as const ;
139
139
export const foo = () =>
140
140
({
@@ -163,10 +163,10 @@ You may pass function/method names you would like this rule to ignore, like so:
163
163
164
164
### ` allowHigherOrderFunctions `
165
165
166
- Examples of code for this rule with ` { allowHigherOrderFunctions: false } ` :
166
+ When this option is ` true ` , the rule ignores return type annotations on function, which is immediately returning another function expression.
167
167
168
168
<Tabs >
169
- <TabItem value = " ❌ Incorrect" >
169
+ <TabItem value = " ❌ Incorrect for `allowHigherOrderFunctions: false` " >
170
170
171
171
``` ts option='{ "allowHigherOrderFunctions": false }'
172
172
export const arrowFn = () => () => {};
@@ -181,9 +181,9 @@ export function foo(outer: string) {
181
181
```
182
182
183
183
</TabItem >
184
- <TabItem value = " ✅ Correct" >
184
+ <TabItem value = " ✅ Correct for `allowHigherOrderFunctions: true` " >
185
185
186
- ``` ts option='{ "allowHigherOrderFunctions": false }'
186
+ ``` ts option='{ "allowHigherOrderFunctions": true }'
187
187
export const arrowFn = () => (): void => {};
188
188
189
189
export function fn() {
@@ -200,10 +200,10 @@ export function foo(outer: string) {
200
200
201
201
### ` allowTypedFunctionExpressions `
202
202
203
- Examples of code for this rule with ` { allowTypedFunctionExpressions: false } ` :
203
+ When this option is ` true ` , the rule ignores type annotations on the variable of a function expression.
204
204
205
205
<Tabs >
206
- <TabItem value = " ❌ Incorrect" >
206
+ <TabItem value = " ❌ Incorrect for `allowTypedFunctionExpressions: false` " >
207
207
208
208
``` ts option='{ "allowTypedFunctionExpressions": false }'
209
209
export let arrowFn = () => ' test' ;
@@ -220,9 +220,9 @@ export const foo = bar => {};
220
220
```
221
221
222
222
</TabItem >
223
- <TabItem value = " ✅ Correct" >
223
+ <TabItem value = " ✅ Correct for `allowTypedFunctionExpressions: true` " >
224
224
225
- ``` ts option='{ "allowTypedFunctionExpressions": false }'
225
+ ``` ts option='{ "allowTypedFunctionExpressions": true }'
226
226
type FuncType = () => string ;
227
227
228
228
export let arrowFn: FuncType = () => ' test' ;
0 commit comments