@@ -52,10 +52,10 @@ type MessageIds =
52
52
| 'suggestAddingAssertions'
53
53
| 'suggestRemovingExtraArguments' ;
54
54
55
- const suggestions : Array < [ MessageIds , string ] > = [
56
- [ 'suggestAddingHasAssertions' , 'expect.hasAssertions();' ] ,
57
- [ 'suggestAddingAssertions' , 'expect.assertions();' ] ,
58
- ] ;
55
+ // const suggestions: Array<[MessageIds, string]> = [
56
+ // ['suggestAddingHasAssertions', 'expect.hasAssertions();'],
57
+ // ['suggestAddingAssertions', 'expect.assertions();'],
58
+ // ];
59
59
60
60
export default createRule < [ RuleOptions ] , MessageIds > ( {
61
61
name : __filename ,
@@ -248,14 +248,7 @@ export default createRule<[RuleOptions], MessageIds>({
248
248
249
249
const [ , testFn ] = node . arguments ;
250
250
251
- if (
252
- ! isFunction ( testFn ) ||
253
- testFn . body . type !== AST_NODE_TYPES . BlockStatement
254
- ) {
255
- return ;
256
- }
257
-
258
- if ( ! shouldCheckFunction ( testFn ) ) {
251
+ if ( ! isFunction ( testFn ) || ! shouldCheckFunction ( testFn ) ) {
259
252
return ;
260
253
}
261
254
@@ -268,6 +261,15 @@ export default createRule<[RuleOptions], MessageIds>({
268
261
return ;
269
262
}
270
263
264
+ const suggestions : Array < [ MessageIds , string ] > = [ ] ;
265
+
266
+ if ( testFn . body . type === AST_NODE_TYPES . BlockStatement ) {
267
+ suggestions . push (
268
+ [ 'suggestAddingHasAssertions' , 'expect.hasAssertions();' ] ,
269
+ [ 'suggestAddingAssertions' , 'expect.assertions();' ] ,
270
+ ) ;
271
+ }
272
+
271
273
context . report ( {
272
274
messageId : 'haveExpectAssertions' ,
273
275
node,
0 commit comments