@@ -3,12 +3,13 @@ const {visitIf} = require('enhance-visitors');
3
3
const createAvaRule = require ( '../create-ava-rule' ) ;
4
4
const util = require ( '../util' ) ;
5
5
6
- function report ( { node, context } ) {
6
+ function report ( { node, context} ) {
7
7
context . report ( {
8
- node : node ,
8
+ node,
9
9
message : 'Assertions should not be called from an inline function'
10
- } )
10
+ } ) ;
11
11
}
12
+
12
13
const create = context => {
13
14
const ava = createAvaRule ( ) ;
14
15
@@ -28,24 +29,23 @@ const create = context => {
28
29
return ;
29
30
}
30
31
31
- const { body } = functionArg ;
32
- if ( body . type === " CallExpression" ) {
33
- report ( { node, context } ) ;
32
+ const { body} = functionArg ;
33
+ if ( body . type === ' CallExpression' ) {
34
+ report ( { node, context} ) ;
34
35
return ;
35
36
}
36
37
37
- if ( body . type === " BlockStatement" ) {
38
+ if ( body . type === ' BlockStatement' ) {
38
39
if ( body . loc . start . line !== body . loc . end . line ) {
39
40
return ;
40
41
}
41
42
42
- if ( ! body . body . length ) {
43
+ if ( body . body . length === 0 ) {
43
44
return ;
44
45
}
45
46
46
- report ( { node, context } ) ;
47
+ report ( { node, context} ) ;
47
48
}
48
-
49
49
} )
50
50
} ) ;
51
51
} ;
0 commit comments