@@ -17,27 +17,36 @@ const valids = [
17
17
// allow export default
18
18
'export default () => {}' ,
19
19
'export default defineConfig(() => {})' ,
20
+ // allow one-line arrow function
21
+ 'const foo = (x, y) => x + y' ,
22
+ 'const foo = async (x, y) => x + y' ,
23
+ 'const foo = () => String(123)' ,
24
+ 'const foo = () => ({})' ,
20
25
]
21
26
22
27
const invalids = [
28
+ [
29
+ 'const foo = (x, y) => \nx + y' ,
30
+ 'function foo (x, y) {\n return x + y\n}' ,
31
+ ] ,
23
32
[
24
33
'const foo = (as: string, bar: number) => { return as + bar }' ,
25
34
'function foo (as: string, bar: number) { return as + bar }' ,
26
35
] ,
27
36
[
28
- 'const foo = <K, T extends Boolean>(as: string, bar: number): Omit<T, K> => as + bar' ,
37
+ 'const foo = <K, T extends Boolean>(as: string, bar: number): Omit<T, K> => \nas + bar' ,
29
38
'function foo <K, T extends Boolean>(as: string, bar: number): Omit<T, K> {\n return as + bar\n}' ,
30
39
] ,
31
40
[
32
41
'export const foo = () => {}' ,
33
42
'export function foo () {}' ,
34
43
] ,
35
44
[
36
- 'export const foo = () => ({})' ,
45
+ 'export const foo = () => \n ({})' ,
37
46
'export function foo () {\n return {}\n}' ,
38
47
] ,
39
48
[
40
- 'export const foo = async () => ({})' ,
49
+ 'export const foo = async () => \n ({})' ,
41
50
'export async function foo () {\n return {}\n}' ,
42
51
] ,
43
52
]
0 commit comments