Skip to content

Commit 6e38a7d

Browse files
authored
Update create-ava-rule.js
1 parent 5fdfcd5 commit 6e38a7d

File tree

1 file changed

+152
-139
lines changed

1 file changed

+152
-139
lines changed

create-ava-rule.js

Lines changed: 152 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -4,166 +4,179 @@ const enhance = require('enhance-visitors');
44
const deepStrictEqual = require('deep-strict-equal');
55
const util = require('./util');
66

7-
const avaImportDeclarationAsts = [{
8-
type: 'ImportDeclaration',
9-
specifiers: [
10-
{
11-
type: 'ImportDefaultSpecifier',
12-
local: {
13-
type: 'Identifier',
14-
name: 'test'
7+
const avaImportDeclarationAsts = [
8+
{
9+
type: 'ImportDeclaration',
10+
specifiers: [
11+
{
12+
type: 'ImportDefaultSpecifier',
13+
local: {
14+
type: 'Identifier',
15+
name: 'test'
16+
}
1517
}
18+
],
19+
source: {
20+
type: 'Literal',
21+
value: 'ava'
1622
}
17-
],
18-
source: {
19-
type: 'Literal',
20-
value: 'ava'
21-
}
22-
}, {
23-
type: 'ImportDeclaration',
24-
specifiers: [
25-
{
26-
type: 'ImportSpecifier',
27-
imported: {
28-
type: 'Identifier',
29-
name: 'serial'
30-
},
31-
local: {
32-
type: 'Identifier',
33-
name: 'test'
23+
},
24+
{
25+
type: 'ImportDeclaration',
26+
specifiers: [
27+
{
28+
type: 'ImportSpecifier',
29+
imported: {
30+
type: 'Identifier',
31+
name: 'serial'
32+
},
33+
local: {
34+
type: 'Identifier',
35+
name: 'test'
36+
}
3437
}
38+
],
39+
source: {
40+
type: 'Literal',
41+
value: 'ava'
3542
}
36-
],
37-
source: {
38-
type: 'Literal',
39-
value: 'ava'
40-
}
41-
}, {
42-
type: 'ImportDeclaration',
43-
specifiers: [
44-
{
45-
type: 'ImportSpecifier',
46-
imported: {
47-
type: 'Identifier',
48-
name: 'serial'
49-
},
50-
local: {
51-
type: 'Identifier',
52-
name: 'test'
43+
},
44+
{
45+
type: 'ImportDeclaration',
46+
specifiers: [
47+
{
48+
type: 'ImportSpecifier',
49+
imported: {
50+
type: 'Identifier',
51+
name: 'serial'
52+
},
53+
local: {
54+
type: 'Identifier',
55+
name: 'test'
56+
}
5357
}
58+
],
59+
source: {
60+
type: 'Literal',
61+
value: 'ava'
5462
}
55-
],
56-
source: {
57-
type: 'Literal',
58-
value: 'ava'
59-
}
60-
}, {
61-
type: 'ImportDeclaration',
62-
specifiers: [
63-
{
64-
type: 'ImportSpecifier',
65-
imported: {
66-
type: 'Identifier',
67-
name: 'serial'
68-
},
69-
local: {
70-
type: 'Identifier',
71-
name: 'serial'
63+
},
64+
{
65+
type: 'ImportDeclaration',
66+
specifiers: [
67+
{
68+
type: 'ImportSpecifier',
69+
imported: {
70+
type: 'Identifier',
71+
name: 'serial'
72+
},
73+
local: {
74+
type: 'Identifier',
75+
name: 'serial'
76+
}
7277
}
78+
],
79+
source: {
80+
type: 'Literal',
81+
value: 'ava'
7382
}
74-
],
75-
source: {
76-
type: 'Literal',
77-
value: 'ava'
7883
}
79-
}];
84+
];
8085

81-
const avaVariableDeclaratorAsts = [{
82-
type: 'VariableDeclarator',
83-
id: {
84-
type: 'Identifier',
85-
name: 'test'
86-
},
87-
init: {
88-
type: 'CallExpression',
89-
callee: {
86+
const avaVariableDeclaratorAsts = [
87+
{
88+
type: 'VariableDeclarator',
89+
id: {
9090
type: 'Identifier',
91-
name: 'require'
91+
name: 'test'
9292
},
93-
arguments: [
94-
{
95-
type: 'Literal',
96-
value: 'ava'
97-
}
98-
]
99-
}
100-
}, {
101-
type: 'VariableDeclarator',
102-
id: {
103-
type: 'ObjectPattern',
104-
properties: [{
105-
type: 'Property',
106-
key: {
107-
type: 'Identifier',
108-
name: 'serial'
109-
},
110-
value: {
93+
init: {
94+
type: 'CallExpression',
95+
callee: {
11196
type: 'Identifier',
112-
name: 'serial'
97+
name: 'require'
11398
},
114-
kind: 'init',
115-
method: false,
116-
shorthand: true,
117-
computed: false
118-
}]
99+
arguments: [
100+
{
101+
type: 'Literal',
102+
value: 'ava'
103+
}
104+
]
105+
}
119106
},
120-
init: {
121-
type: 'CallExpression',
122-
callee: {
123-
type: 'Identifier',
124-
name: 'require'
107+
{
108+
type: 'VariableDeclarator',
109+
id: {
110+
type: 'ObjectPattern',
111+
properties: [
112+
{
113+
type: 'Property',
114+
key: {
115+
type: 'Identifier',
116+
name: 'serial'
117+
},
118+
value: {
119+
type: 'Identifier',
120+
name: 'serial'
121+
},
122+
kind: 'init',
123+
method: false,
124+
shorthand: true,
125+
computed: false
126+
}
127+
]
125128
},
126-
arguments: [
127-
{
128-
type: 'Literal',
129-
value: 'ava'
130-
}
131-
]
132-
}
133-
}, {
134-
type: 'VariableDeclarator',
135-
id: {
136-
type: 'ObjectPattern',
137-
properties: [{
138-
type: 'Property',
139-
key: {
140-
type: 'Identifier',
141-
name: 'serial'
142-
},
143-
value: {
129+
init: {
130+
type: 'CallExpression',
131+
callee: {
144132
type: 'Identifier',
145-
name: 'test'
133+
name: 'require'
146134
},
147-
kind: 'init',
148-
method: false,
149-
shorthand: false,
150-
computed: false
151-
}]
135+
arguments: [
136+
{
137+
type: 'Literal',
138+
value: 'ava'
139+
}
140+
]
141+
}
152142
},
153-
init: {
154-
type: 'CallExpression',
155-
callee: {
156-
type: 'Identifier',
157-
name: 'require'
143+
{
144+
type: 'VariableDeclarator',
145+
id: {
146+
type: 'ObjectPattern',
147+
properties: [
148+
{
149+
type: 'Property',
150+
key: {
151+
type: 'Identifier',
152+
name: 'serial'
153+
},
154+
value: {
155+
type: 'Identifier',
156+
name: 'test'
157+
},
158+
kind: 'init',
159+
method: false,
160+
shorthand: false,
161+
computed: false
162+
}
163+
]
158164
},
159-
arguments: [
160-
{
161-
type: 'Literal',
162-
value: 'ava'
163-
}
164-
]
165+
init: {
166+
type: 'CallExpression',
167+
callee: {
168+
type: 'Identifier',
169+
name: 'require'
170+
},
171+
arguments: [
172+
{
173+
type: 'Literal',
174+
value: 'ava'
175+
}
176+
]
177+
}
165178
}
166-
}];
179+
];
167180

168181
function isTestFunctionCall(node) {
169182
if (node.type === 'Identifier') {

0 commit comments

Comments
 (0)