Skip to content

Commit f218e26

Browse files
committed
fix(fixer): remove space from replaced text in fixer
1 parent 459d02f commit f218e26

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Diff for: lib/rules/no-await-sync-queries.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default createTestingLibraryRule<Options, MessageIds>({
5252
},
5353
fix: (fixer) => {
5454
const awaitRangeStart = awaitExpression.range[0];
55-
const awaitRangeEnd = awaitExpression.range[0] + 'await '.length;
55+
const awaitRangeEnd = awaitExpression.range[0] + 'await'.length;
5656

5757
return fixer.replaceTextRange(
5858
[awaitRangeStart, awaitRangeEnd],

Diff for: tests/lib/rules/no-await-sync-queries.test.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ ruleTester.run(RULE_NAME, rule, {
143143
},
144144
],
145145
output: `async () => {
146-
const element = ${query}('foo')
146+
const element = ${query}('foo')
147147
}
148148
`,
149149
} as const)
@@ -158,6 +158,7 @@ ruleTester.run(RULE_NAME, rule, {
158158
errors: [{ messageId: 'noAwaitSyncQuery', line: 3, column: 31 }],
159159
output: `
160160
async () => {
161+
const element = getByIcon('search')
161162
const element = getByIcon('search')
162163
}
163164
`,
@@ -171,7 +172,7 @@ ruleTester.run(RULE_NAME, rule, {
171172
errors: [{ messageId: 'noAwaitSyncQuery', line: 3, column: 31 }],
172173
output: `
173174
async () => {
174-
const element = queryByIcon('search')
175+
const element = queryByIcon('search')
175176
}
176177
`,
177178
},
@@ -184,7 +185,7 @@ ruleTester.run(RULE_NAME, rule, {
184185
errors: [{ messageId: 'noAwaitSyncQuery', line: 3, column: 38 }],
185186
output: `
186187
async () => {
187-
const element = screen.getAllByIcon('search')
188+
const element = screen.getAllByIcon('search')
188189
}
189190
`,
190191
},
@@ -197,7 +198,7 @@ ruleTester.run(RULE_NAME, rule, {
197198
errors: [{ messageId: 'noAwaitSyncQuery', line: 3, column: 38 }],
198199
output: `
199200
async () => {
200-
const element = screen.queryAllByIcon('search')
201+
const element = screen.queryAllByIcon('search')
201202
}
202203
`,
203204
},
@@ -217,7 +218,7 @@ ruleTester.run(RULE_NAME, rule, {
217218
},
218219
],
219220
output: `async () => {
220-
expect(${query}('foo')).toBeEnabled()
221+
expect( ${query}('foo')).toBeEnabled()
221222
}
222223
`,
223224
} as const)
@@ -239,7 +240,7 @@ ruleTester.run(RULE_NAME, rule, {
239240
},
240241
],
241242
output: `async () => {
242-
const element = screen.${query}('foo')
243+
const element = screen.${query}('foo')
243244
}
244245
`,
245246
} as const)
@@ -261,7 +262,7 @@ ruleTester.run(RULE_NAME, rule, {
261262
},
262263
],
263264
output: `async () => {
264-
expect(screen.${query}('foo')).toBeEnabled()
265+
expect( screen.${query}('foo')).toBeEnabled()
265266
}
266267
`,
267268
} as const)
@@ -283,7 +284,7 @@ ruleTester.run(RULE_NAME, rule, {
283284
output: `
284285
import { screen } from '${testingFramework}'
285286
() => {
286-
const element = screen.getByRole('button')
287+
const element = screen.getByRole('button')
287288
}
288289
`,
289290
} as const)
@@ -301,7 +302,7 @@ ruleTester.run(RULE_NAME, rule, {
301302
output: `
302303
import { screen } from 'test-utils'
303304
() => {
304-
const element = screen.getByRole('button')
305+
const element = screen.getByRole('button')
305306
}
306307
`,
307308
},
@@ -319,7 +320,7 @@ ruleTester.run(RULE_NAME, rule, {
319320
errors: [{ messageId: 'noAwaitSyncQuery', line: 3, column: 31 }],
320321
output: `
321322
test('A valid example test', async () => {
322-
const element = queryByIcon('search')
323+
const element = queryByIcon('search')
323324
})
324325
`,
325326
},

0 commit comments

Comments
 (0)