@checkdigit/eslint-plugin 7.6.0-PR.75-1b09 → 7.6.0-PR.75-04b9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,20 +8,9 @@
8
8
 
9
9
  import { strict as assert } from 'node:assert';
10
10
 
11
- import type {
12
- AwaitExpression,
13
- CallExpression,
14
- Expression,
15
- ExpressionStatement,
16
- MemberExpression,
17
- Node,
18
- ObjectExpression,
19
- ObjectPattern,
20
- ReturnStatement,
21
- SimpleCallExpression,
22
- VariableDeclaration,
23
- } from 'estree';
24
- import { type Rule, type Scope, SourceCode } from 'eslint';
11
+ import { AST_NODE_TYPES, ESLintUtils, TSESTree } from '@typescript-eslint/utils';
12
+ import type { Scope, ScopeManager, Variable } from '@typescript-eslint/scope-manager';
13
+ import type { SourceCode } from '@typescript-eslint/utils/ts-eslint';
25
14
 
26
15
  import {
27
16
  getEnclosingFunction,
@@ -29,7 +18,7 @@ import {
29
18
  getEnclosingStatement,
30
19
  getParent,
31
20
  isUsedInArrayOrAsArgument,
32
- } from '../library/tree';
21
+ } from '../library/ts-tree';
33
22
  import getDocumentationUrl from '../get-documentation-url';
34
23
  import { getIndentation } from '../library/format';
35
24
  import { isValidPropertyName } from '../library/variable';
@@ -40,86 +29,91 @@ import { replaceEndpointUrlPrefixWithBasePath } from './url';
40
29
  export const ruleId = 'no-fixture';
41
30
 
42
31
  interface FixtureCallInformation {
43
- rootNode: AwaitExpression | ReturnStatement | VariableDeclaration | SimpleCallExpression | ExpressionStatement;
44
- fixtureNode: AwaitExpression | SimpleCallExpression;
45
- variableDeclaration?: VariableDeclaration;
46
- variableAssignment?: ExpressionStatement;
47
- requestBody?: Expression;
48
- requestHeaders?: { name: Expression; value: Expression }[];
49
- requestHeadersObjectLiteral?: ObjectExpression;
50
- assertions?: Expression[][];
51
- inlineStatementNode?: Node;
52
- inlineBodyReference?: MemberExpression;
53
- inlineHeadersReference?: MemberExpression;
32
+ rootNode:
33
+ | TSESTree.AwaitExpression
34
+ | TSESTree.ReturnStatement
35
+ | TSESTree.VariableDeclaration
36
+ | TSESTree.CallExpression
37
+ | TSESTree.ExpressionStatement;
38
+ fixtureNode: TSESTree.AwaitExpression | TSESTree.CallExpression;
39
+ variableDeclaration?: TSESTree.VariableDeclaration;
40
+ variableAssignment?: TSESTree.ExpressionStatement;
41
+ requestBody?: TSESTree.Expression;
42
+ requestHeaders?: { name: TSESTree.Expression; value: TSESTree.Expression }[];
43
+ requestHeadersObjectLiteral?: TSESTree.ObjectExpression;
44
+ assertions?: TSESTree.Expression[][];
45
+ inlineStatementNode?: TSESTree.Node;
46
+ inlineBodyReference?: TSESTree.MemberExpression;
47
+ inlineHeadersReference?: TSESTree.MemberExpression;
54
48
  }
55
49
 
56
50
  // recursively analyze the fixture/supertest call chain to collect information of request/response
57
51
  // eslint-disable-next-line sonarjs/cognitive-complexity
58
- function analyzeFixtureCall(call: SimpleCallExpression, results: FixtureCallInformation, sourceCode: SourceCode) {
52
+ function analyzeFixtureCall(call: TSESTree.CallExpression, results: FixtureCallInformation, sourceCode: SourceCode) {
59
53
  const parent = getParent(call);
60
54
  assert.ok(parent, 'parent should exist for fixture/supertest call node');
61
55
 
62
56
  let nextCall;
63
- if (parent.type === 'ReturnStatement') {
57
+ if (parent.type === AST_NODE_TYPES.ReturnStatement) {
64
58
  // direct return, no variable declaration or await
65
59
  results.fixtureNode = call;
66
60
  results.rootNode = parent;
67
61
  } else if (
68
- parent.type === 'ArrayExpression' ||
69
- parent.type === 'CallExpression' ||
70
- parent.type === 'ArrowFunctionExpression'
62
+ parent.type === AST_NODE_TYPES.ArrayExpression ||
63
+ parent.type === AST_NODE_TYPES.CallExpression ||
64
+ parent.type === AST_NODE_TYPES.ArrowFunctionExpression
71
65
  ) {
72
66
  // direct return, no variable declaration or await
73
67
  results.fixtureNode = call;
74
68
  results.rootNode = call;
75
- } else if (parent.type === 'AwaitExpression') {
69
+ } else if (parent.type === AST_NODE_TYPES.AwaitExpression) {
76
70
  results.fixtureNode = call;
77
71
  const enclosingStatement = getEnclosingStatement(parent);
78
72
  assert.ok(enclosingStatement);
79
73
  const awaitParent = getParent(parent);
80
- if (awaitParent?.type === 'MemberExpression') {
74
+ if (awaitParent?.type === AST_NODE_TYPES.MemberExpression) {
81
75
  results.rootNode = parent;
82
76
  results.inlineStatementNode = enclosingStatement;
83
- if (awaitParent.property.type === 'Identifier' && awaitParent.property.name === 'body') {
77
+ if (awaitParent.property.type === AST_NODE_TYPES.Identifier && awaitParent.property.name === 'body') {
84
78
  results.inlineBodyReference = awaitParent;
85
79
  }
86
80
  if (
87
- awaitParent.property.type === 'Identifier' &&
81
+ awaitParent.property.type === AST_NODE_TYPES.Identifier &&
88
82
  (awaitParent.property.name === 'header' || awaitParent.property.name === 'headers')
89
83
  ) {
90
84
  results.inlineHeadersReference = awaitParent;
91
85
  }
92
- } else if (enclosingStatement.type === 'VariableDeclaration') {
86
+ } else if (enclosingStatement.type === AST_NODE_TYPES.VariableDeclaration) {
93
87
  results.variableDeclaration = enclosingStatement;
94
88
  results.rootNode = enclosingStatement;
95
89
  } else if (
96
- enclosingStatement.type === 'ExpressionStatement' &&
97
- enclosingStatement.expression.type === 'AssignmentExpression'
90
+ enclosingStatement.type === AST_NODE_TYPES.ExpressionStatement &&
91
+ enclosingStatement.expression.type === AST_NODE_TYPES.AssignmentExpression
98
92
  ) {
99
93
  results.variableAssignment = enclosingStatement;
100
94
  results.rootNode = enclosingStatement;
101
95
  } else {
102
96
  results.rootNode = parent;
103
97
  }
104
- } else if (parent.type === 'MemberExpression' && parent.property.type === 'Identifier') {
98
+ } else if (parent.type === AST_NODE_TYPES.MemberExpression && parent.property.type === AST_NODE_TYPES.Identifier) {
105
99
  if (parent.property.name === 'expect') {
106
100
  // supertest assertions
107
101
  const assertionCall = getParent(parent);
108
- assert.ok(assertionCall && assertionCall.type === 'CallExpression');
109
- results.assertions = [...(results.assertions ?? []), assertionCall.arguments as Expression[]];
102
+ assert.ok(assertionCall && assertionCall.type === AST_NODE_TYPES.CallExpression);
103
+ results.assertions = [...(results.assertions ?? []), assertionCall.arguments as TSESTree.Expression[]];
110
104
  nextCall = assertionCall;
111
105
  } else if (parent.property.name === 'send') {
112
106
  // request body
113
107
  const sendRequestBodyCall = getParent(parent);
114
- assert.ok(sendRequestBodyCall && sendRequestBodyCall.type === 'CallExpression');
115
- results.requestBody = sendRequestBodyCall.arguments[0] as Expression;
108
+ assert.ok(sendRequestBodyCall && sendRequestBodyCall.type === AST_NODE_TYPES.CallExpression);
109
+ results.requestBody = sendRequestBodyCall.arguments[0] as TSESTree.Expression;
116
110
  nextCall = sendRequestBodyCall;
117
111
  } else if (parent.property.name === 'set') {
118
112
  // request headers
119
113
  const setRequestHeaderCall = getParent(parent);
120
- assert.ok(setRequestHeaderCall && setRequestHeaderCall.type === 'CallExpression');
121
- const [arg1, arg2] = setRequestHeaderCall.arguments as [Expression, Expression];
122
- if (arg1.type === 'ObjectExpression') {
114
+ assert.ok(setRequestHeaderCall && setRequestHeaderCall.type === AST_NODE_TYPES.CallExpression);
115
+ const [arg1, arg2] = setRequestHeaderCall.arguments as [TSESTree.Expression, TSESTree.Expression];
116
+ if (arg1.type === AST_NODE_TYPES.ObjectExpression) {
123
117
  results.requestHeadersObjectLiteral = arg1;
124
118
  } else {
125
119
  results.requestHeaders = [...(results.requestHeaders ?? []), { name: arg1, value: arg2 }];
@@ -139,7 +133,7 @@ function createResponseAssertions(
139
133
  fixtureCallInformation: FixtureCallInformation,
140
134
  sourceCode: SourceCode,
141
135
  responseVariableName: string,
142
- destructuringResponseHeadersVariable: Scope.Variable | undefined,
136
+ destructuringResponseHeadersVariable: Variable | undefined,
143
137
  ) {
144
138
  let statusAssertion: string | undefined;
145
139
  const nonStatusAssertions: string[] = [];
@@ -148,20 +142,20 @@ function createResponseAssertions(
148
142
  const [assertionArgument] = expectArguments;
149
143
  assert.ok(assertionArgument);
150
144
  if (
151
- (assertionArgument.type === 'MemberExpression' &&
152
- assertionArgument.object.type === 'Identifier' &&
145
+ (assertionArgument.type === AST_NODE_TYPES.MemberExpression &&
146
+ assertionArgument.object.type === AST_NODE_TYPES.Identifier &&
153
147
  assertionArgument.object.name === 'StatusCodes') ||
154
- assertionArgument.type === 'Literal' ||
155
- sourceCode.getText(assertionArgument).includes('StatusCodes.')
148
+ assertionArgument.type === AST_NODE_TYPES.Literal ||
149
+ sourceCode.getText(assertionArgument as TSESTree.Node).includes('StatusCodes.')
156
150
  ) {
157
151
  // status code assertion
158
152
  statusAssertion = `assert.equal(${responseVariableName}.status, ${sourceCode.getText(assertionArgument)})`;
159
- } else if (assertionArgument.type === 'ArrowFunctionExpression') {
153
+ } else if (assertionArgument.type === AST_NODE_TYPES.ArrowFunctionExpression) {
160
154
  // callback assertion using arrow function
161
155
  let functionBody = sourceCode.getText(assertionArgument.body);
162
156
 
163
157
  const [originalResponseArgument] = assertionArgument.params;
164
- assert.ok(originalResponseArgument?.type === 'Identifier');
158
+ assert.ok(originalResponseArgument?.type === AST_NODE_TYPES.Identifier);
165
159
  const originalResponseArgumentName = originalResponseArgument.name;
166
160
  if (originalResponseArgumentName !== responseVariableName) {
167
161
  functionBody = functionBody.replace(
@@ -170,12 +164,15 @@ function createResponseAssertions(
170
164
  );
171
165
  }
172
166
  nonStatusAssertions.push(`assert.doesNotThrow(()=>${functionBody})`);
173
- } else if (assertionArgument.type === 'Identifier') {
167
+ } else if (assertionArgument.type === AST_NODE_TYPES.Identifier) {
174
168
  // callback assertion using function reference
175
169
  nonStatusAssertions.push(
176
170
  `assert.doesNotThrow(()=>${sourceCode.getText(assertionArgument)}(${responseVariableName}))`,
177
171
  );
178
- } else if (assertionArgument.type === 'ObjectExpression' || assertionArgument.type === 'CallExpression') {
172
+ } else if (
173
+ assertionArgument.type === AST_NODE_TYPES.ObjectExpression ||
174
+ assertionArgument.type === AST_NODE_TYPES.CallExpression
175
+ ) {
179
176
  // body deep equal assertion
180
177
  nonStatusAssertions.push(
181
178
  `assert.deepEqual(await ${responseVariableName}.json(), ${sourceCode.getText(assertionArgument)})`,
@@ -191,7 +188,7 @@ function createResponseAssertions(
191
188
  destructuringResponseHeadersVariable !== undefined
192
189
  ? destructuringResponseHeadersVariable.name
193
190
  : `${responseVariableName}.headers`;
194
- if (headerValue.type === 'Literal' && headerValue.value instanceof RegExp) {
191
+ if (headerValue.type === AST_NODE_TYPES.Literal && headerValue.value instanceof RegExp) {
195
192
  nonStatusAssertions.push(
196
193
  `assert.ok(${headersReference}.get(${sourceCode.getText(headerName)}).match(${sourceCode.getText(headerValue)}))`,
197
194
  );
@@ -209,21 +206,22 @@ function createResponseAssertions(
209
206
  }
210
207
 
211
208
  function getResponseVariableNameToUse(
212
- scopeManager: Scope.ScopeManager,
209
+ scopeManager: ScopeManager,
213
210
  fixtureCallInformation: FixtureCallInformation,
214
- scopeVariablesMap: Map<Scope.Scope, string[]>,
211
+ scopeVariablesMap: Map<Scope, string[]>,
215
212
  ) {
216
213
  if (fixtureCallInformation.variableAssignment) {
217
214
  assert.ok(
218
- fixtureCallInformation.variableAssignment.expression.type === 'AssignmentExpression' &&
219
- fixtureCallInformation.variableAssignment.expression.left.type === 'Identifier',
215
+ fixtureCallInformation.variableAssignment.expression.type === AST_NODE_TYPES.AssignmentExpression &&
216
+ fixtureCallInformation.variableAssignment.expression.left.type === AST_NODE_TYPES.Identifier,
220
217
  );
221
218
  return fixtureCallInformation.variableAssignment.expression.left.name;
222
219
  }
223
220
 
224
221
  if (fixtureCallInformation.variableDeclaration) {
225
222
  const firstDeclaration = fixtureCallInformation.variableDeclaration.declarations[0];
226
- if (firstDeclaration && firstDeclaration.id.type === 'Identifier') {
223
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
224
+ if (firstDeclaration !== undefined && firstDeclaration.id.type === AST_NODE_TYPES.Identifier) {
227
225
  return firstDeclaration.id.name;
228
226
  }
229
227
  }
@@ -252,12 +250,15 @@ function getResponseVariableNameToUse(
252
250
  return responseVariableNameToUse;
253
251
  }
254
252
 
255
- function isResponseBodyRedefinition(responseBodyReference: MemberExpression): boolean {
253
+ function isResponseBodyRedefinition(responseBodyReference: TSESTree.MemberExpression): boolean {
256
254
  const parent = getParent(responseBodyReference);
257
- return parent?.type === 'VariableDeclarator' && parent.id.type === 'Identifier';
255
+ return parent?.type === AST_NODE_TYPES.VariableDeclarator && parent.id.type === AST_NODE_TYPES.Identifier;
258
256
  }
259
257
 
260
- const rule: Rule.RuleModule = {
258
+ const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
259
+
260
+ const rule: ESLintUtils.RuleModule<'unknownError' | 'preferNativeFetch'> = createRule({
261
+ name: ruleId,
261
262
  meta: {
262
263
  type: 'suggestion',
263
264
  docs: {
@@ -271,16 +272,18 @@ const rule: Rule.RuleModule = {
271
272
  fixable: 'code',
272
273
  schema: [],
273
274
  },
275
+ defaultOptions: [],
274
276
  // eslint-disable-next-line max-lines-per-function
275
277
  create(context) {
276
278
  const sourceCode = context.sourceCode;
277
279
  const scopeManager = sourceCode.scopeManager;
278
- const scopeVariablesMap = new Map<Scope.Scope, string[]>();
280
+ assert.ok(scopeManager !== null);
281
+ const scopeVariablesMap = new Map<Scope, string[]>();
279
282
 
280
283
  return {
281
284
  // eslint-disable-next-line max-lines-per-function
282
285
  'CallExpression[callee.object.object.name="fixture"][callee.object.property.name="api"]': (
283
- fixtureCall: CallExpression,
286
+ fixtureCall: TSESTree.CallExpression,
284
287
  // eslint-disable-next-line sonarjs/cognitive-complexity
285
288
  ) => {
286
289
  try {
@@ -292,9 +295,8 @@ const rule: Rule.RuleModule = {
292
295
  return;
293
296
  }
294
297
 
295
- assert.ok(fixtureCall.type === 'CallExpression');
296
298
  const fixtureFunction = fixtureCall.callee; // e.g. fixture.api.get
297
- assert.ok(fixtureFunction.type === 'MemberExpression');
299
+ assert.ok(fixtureFunction.type === AST_NODE_TYPES.MemberExpression);
298
300
  const indentation = getIndentation(fixtureCall, sourceCode);
299
301
 
300
302
  const [urlArgumentNode] = fixtureCall.arguments; // e.g. `/sample-service/v1/ping`
@@ -318,7 +320,7 @@ const rule: Rule.RuleModule = {
318
320
 
319
321
  // fetch request argument
320
322
  const methodNode = fixtureFunction.property; // get/put/etc.
321
- assert.ok(methodNode.type === 'Identifier');
323
+ assert.ok(methodNode.type === AST_NODE_TYPES.Identifier);
322
324
  const methodName = methodNode.name.toUpperCase();
323
325
 
324
326
  const fetchRequestArgumentLines = [
@@ -336,7 +338,7 @@ const rule: Rule.RuleModule = {
336
338
  ...fixtureCallInformation.requestHeaders.map(
337
339
  ({ name, value }) =>
338
340
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, no-nested-ternary, sonarjs/no-nested-template-literals
339
- ` ${name.type === 'Literal' ? (isValidPropertyName(name.value) ? name.value : `'${name.value}'`) : `[${sourceCode.getText(name)}]`}: ${sourceCode.getText(value)},`,
341
+ ` ${name.type === AST_NODE_TYPES.Literal ? (isValidPropertyName(name.value) ? name.value : `'${name.value}'`) : `[${sourceCode.getText(name)}]`}: ${sourceCode.getText(value)},`,
340
342
  ),
341
343
  ` },`,
342
344
  ]
@@ -359,7 +361,7 @@ const rule: Rule.RuleModule = {
359
361
  const isResponseHeadersVariableRedefinitionNeeded =
360
362
  (destructuringResponseHeadersVariable !== undefined &&
361
363
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
362
- (destructuringResponseHeadersVariable as ObjectPattern).type === 'ObjectPattern') ||
364
+ (destructuringResponseHeadersVariable as TSESTree.ObjectPattern).type === AST_NODE_TYPES.ObjectPattern) ||
363
365
  fixtureCallInformation.inlineHeadersReference !== undefined;
364
366
  const redefineResponseHeadersVariableName = `${responseVariableNameToUse}Headers`;
365
367
 
@@ -376,7 +378,7 @@ const rule: Rule.RuleModule = {
376
378
  ...(destructuringResponseBodyVariable
377
379
  ? [
378
380
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
379
- `${fixtureCallInformation.variableDeclaration?.kind ?? 'const'} ${(destructuringResponseBodyVariable as ObjectPattern).type === 'ObjectPattern' ? sourceCode.getText(destructuringResponseBodyVariable as ObjectPattern) : (destructuringResponseBodyVariable as Scope.Variable).name} = ${getResponseBodyRetrievalText(responseVariableNameToUse)}`,
381
+ `${fixtureCallInformation.variableDeclaration?.kind ?? 'const'} ${(destructuringResponseBodyVariable as TSESTree.ObjectPattern).type === AST_NODE_TYPES.ObjectPattern ? sourceCode.getText(destructuringResponseBodyVariable as TSESTree.ObjectPattern) : (destructuringResponseBodyVariable as Variable).name} = ${getResponseBodyRetrievalText(responseVariableNameToUse)}`,
380
382
  ]
381
383
  : isResponseBodyVariableRedefinitionNeeded
382
384
  ? [
@@ -386,15 +388,16 @@ const rule: Rule.RuleModule = {
386
388
  // eslint-disable-next-line no-nested-ternary
387
389
  ...(destructuringResponseHeadersVariable
388
390
  ? // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
389
- (destructuringResponseHeadersVariable as ObjectPattern).type === 'ObjectPattern'
390
- ? (destructuringResponseHeadersVariable as ObjectPattern).properties.map((property) => {
391
- assert.ok(property.type === 'Property');
392
- assert.equal(property.value.type, 'Identifier');
391
+ (destructuringResponseHeadersVariable as TSESTree.ObjectPattern).type ===
392
+ AST_NODE_TYPES.ObjectPattern
393
+ ? (destructuringResponseHeadersVariable as TSESTree.ObjectPattern).properties.map((property) => {
394
+ assert.ok(property.type === AST_NODE_TYPES.Property);
395
+ assert.equal(property.value.type, AST_NODE_TYPES.Identifier);
393
396
  // eslint-disable-next-line sonarjs/no-nested-template-literals
394
- return `${fixtureCallInformation.variableDeclaration?.kind ?? 'const'} ${property.value.name} = ${getResponseHeadersRetrievalText(responseVariableNameToUse)}.get(${property.key.type === 'Literal' ? sourceCode.getText(property.key) : `'${sourceCode.getText(property.key)}'`})`;
397
+ return `${fixtureCallInformation.variableDeclaration?.kind ?? 'const'} ${property.value.name} = ${getResponseHeadersRetrievalText(responseVariableNameToUse)}.get(${property.key.type === AST_NODE_TYPES.Literal ? sourceCode.getText(property.key) : `'${sourceCode.getText(property.key)}'`})`;
395
398
  })
396
399
  : [
397
- `${fixtureCallInformation.variableDeclaration?.kind ?? 'const'} ${(destructuringResponseHeadersVariable as Scope.Variable).name} = ${getResponseHeadersRetrievalText(responseVariableNameToUse)}`,
400
+ `${fixtureCallInformation.variableDeclaration?.kind ?? 'const'} ${(destructuringResponseHeadersVariable as Variable).name} = ${getResponseHeadersRetrievalText(responseVariableNameToUse)}`,
398
401
  ]
399
402
  : isResponseHeadersVariableRedefinitionNeeded
400
403
  ? [
@@ -408,7 +411,7 @@ const rule: Rule.RuleModule = {
408
411
  fixtureCallInformation,
409
412
  sourceCode,
410
413
  responseVariableNameToUse,
411
- destructuringResponseHeadersVariable as Scope.Variable | undefined,
414
+ destructuringResponseHeadersVariable as Variable | undefined,
412
415
  );
413
416
 
414
417
  // add variable declaration if needed
@@ -466,12 +469,12 @@ const rule: Rule.RuleModule = {
466
469
  const parent = getParent(responseHeadersReference);
467
470
  assert.ok(parent);
468
471
  let headerName;
469
- if (parent.type === 'MemberExpression') {
472
+ if (parent.type === AST_NODE_TYPES.MemberExpression) {
470
473
  const headerNameNode = parent.property;
471
474
  headerName = parent.computed
472
475
  ? sourceCode.getText(headerNameNode)
473
476
  : `'${sourceCode.getText(headerNameNode)}'`;
474
- } else if (parent.type === 'CallExpression') {
477
+ } else if (parent.type === AST_NODE_TYPES.CallExpression) {
475
478
  const headerNameNode = parent.arguments[0];
476
479
  headerName = sourceCode.getText(headerNameNode);
477
480
  }
@@ -482,7 +485,7 @@ const rule: Rule.RuleModule = {
482
485
  // convert response.statusCode to response.status
483
486
  for (const responseStatusReference of responseStatusReferences) {
484
487
  if (
485
- responseStatusReference.property.type === 'Identifier' &&
488
+ responseStatusReference.property.type === AST_NODE_TYPES.Identifier &&
486
489
  responseStatusReference.property.name === 'statusCode'
487
490
  ) {
488
491
  yield fixer.replaceText(responseStatusReference.property, `status`);
@@ -491,7 +494,7 @@ const rule: Rule.RuleModule = {
491
494
 
492
495
  // handle direct return statement without await, e.g. "return fixture.api.get(...);"
493
496
  if (
494
- fixtureCallInformation.rootNode.type === 'ReturnStatement' &&
497
+ fixtureCallInformation.rootNode.type === AST_NODE_TYPES.ReturnStatement &&
495
498
  fixtureCallInformation.assertions !== undefined
496
499
  ) {
497
500
  yield fixer.insertTextAfter(
@@ -516,6 +519,6 @@ const rule: Rule.RuleModule = {
516
519
  },
517
520
  };
518
521
  },
519
- };
522
+ });
520
523
 
521
524
  export default rule;