Draft: Add an eslint rule to enforce async\await when using nextTick
What does this MR do and why?
This MR intends to increase conformity to the async\await RFC for frontend testing.
In order to do that several eslint rules were added to restrict undesired common code patterns regarding nextTick
.
Cases that this MR intends to handle:
- Returning
nextTick
to indicate an async callback:return nextTick();
return nextTick;
.then(() => nextTick)
.then(() => nextTick())
- Using
nextTick
thenable interface:nextTick().then(callback)
- Using
nextTick
callback:nextTick(callback)
The preferred way of using nextTick
within frontend tests should now be async\await
:
it('...', async () => {
// ...
await nextTick();
// ...
})
This MR also touches on the frontend testing code quality improvement initiative.
Screenshots or screen recordings
How to set up and validate locally
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.