@@ -130,33 +130,29 @@ If you are working on a codebase within which you lint non-TypeScript code (i.e.
130
130
131
131
### ` allowArgumentsExplicitlyTypedAsAny `
132
132
133
- Examples of ** incorrect** code for this rule with ` { allowArgumentsExplicitlyTypedAsAny: true } ` :
133
+ Examples of ** incorrect** code for this rule with ` { allowArgumentsExplicitlyTypedAsAny: false } ` :
134
134
135
135
``` ts
136
- export const func = (value : any ): void => ({ type: ' X' , value });
137
- export function foo(value : any ): void {}
136
+ export const func = (value : any ): number => value + 1 ;
138
137
```
139
138
140
139
Examples of ** correct** code for this rule with ` { allowArgumentsExplicitlyTypedAsAny: true } ` :
141
140
142
141
``` ts
143
- export const func = (value : number ): void => ({ type: ' X' , value });
144
- export function foo(value : number ): void {}
142
+ export const func = (value : number ): number => value + 1 ;
145
143
```
146
144
147
145
### ` allowDirectConstAssertionInArrowFunctions `
148
146
149
- Examples of ** incorrect** code for this rule with ` { allowDirectConstAssertionInArrowFunctions: true } ` :
147
+ Examples of ** incorrect** code for this rule with ` { allowDirectConstAssertionInArrowFunctions: false } ` :
150
148
151
149
``` ts
152
150
export const func = (value : number ) => ({ type: ' X' , value });
153
- export const foo = () => {
154
- return {
151
+ export const foo = () =>
152
+ ( {
155
153
bar: true ,
156
- } as const ;
157
- };
154
+ } as const );
158
155
export const bar = () => 1 ;
159
- export const baz = arg => arg as const ;
160
156
```
161
157
162
158
Examples of ** correct** code for this rule with ` { allowDirectConstAssertionInArrowFunctions: true } ` :
@@ -168,7 +164,6 @@ export const foo = () =>
168
164
bar: true ,
169
165
} as const );
170
166
export const bar = () => 1 as const ;
171
- export const baz = (arg : string ) => arg as const ;
172
167
```
173
168
174
169
### ` allowedNames `
@@ -188,24 +183,24 @@ You may pass function/method names you would like this rule to ignore, like so:
188
183
189
184
### ` allowHigherOrderFunctions `
190
185
191
- Examples of ** incorrect** code for this rule with ` { allowHigherOrderFunctions: true } ` :
186
+ Examples of ** incorrect** code for this rule with ` { allowHigherOrderFunctions: false } ` :
192
187
193
188
``` ts
194
- export var arrowFn = () => () => {};
189
+ export const arrowFn = () => (): void => {};
195
190
196
191
export function fn() {
197
- return function () {};
192
+ return function (): void {};
198
193
}
199
194
200
- export function foo(outer ) {
201
- return function (inner ): void {};
195
+ export function foo(outer : string ) {
196
+ return function (inner : string ): void {};
202
197
}
203
198
```
204
199
205
200
Examples of ** correct** code for this rule with ` { allowHigherOrderFunctions: true } ` :
206
201
207
202
``` ts
208
- export var arrowFn = () => (): void => {};
203
+ export const arrowFn = () => (): void => {};
209
204
210
205
export function fn() {
211
206
return function (): void {};
@@ -218,7 +213,7 @@ export function foo(outer: string) {
218
213
219
214
### ` allowTypedFunctionExpressions `
220
215
221
- Examples of ** incorrect** code for this rule with ` { allowTypedFunctionExpressions: true } ` :
216
+ Examples of ** incorrect** code for this rule with ` { allowTypedFunctionExpressions: false } ` :
222
217
223
218
``` ts
224
219
export let arrowFn = () => ' test' ;
0 commit comments