Each then() should return a value or throw when using Promises

前端 未结 4 1704
粉色の甜心
粉色の甜心 2020-12-05 23:12

I have a few async methods that I need to wait for completion before I return from the request. I\'m using Promises, but I keep getting the error:

Each then(         


        
4条回答
  •  误落风尘
    2020-12-05 23:53

    If you can't fix this issue but still want to run your code...

    open   : eslintrc.json file (search from project root directory)
    search : 'promise/always-return'
    change : Case 1: if (existing value is 2) => change to 1
             Case 2: else if(existing value is "error" => change to "warn")
    

    It will make this error into warning, but be careful with it... Also use eslint plungin in your editor to remind of good practice. Otherwise you won't get any promise/always-return related warnings.

    Also make sure you find the right eslintrc.json if more than 1 appears on your search

提交回复
热议问题