no-addtask-setup.rst (745B)
1 no-addtask-setup 2 ================ 3 4 Reject using ``add_task(async function setup() { ... })`` in favour of 5 ``add_setup(async function() { ... })``. 6 7 Using semantically separate setup functions makes ``.only`` work correctly 8 and will allow for future improvements to setup/cleanup abstractions. 9 10 This option can be autofixed (``--fix``). 11 12 Examples of incorrect code for this rule: 13 ----------------------------------------- 14 15 .. code-block:: js 16 17 add_task(async function setup() { ... }); 18 add_task(function setup() { ... }); 19 add_task(function init() { ... }); 20 21 Examples of correct code for this rule: 22 --------------------------------------- 23 24 .. code-block:: js 25 26 add_setup(async function() { ... }); 27 add_setup(function() { ... });