This is a snippet of my code:
const data = await fetch(url, options)
.then(res => res.json())
.then(json => {
const payID = json.data.id
sessionStorage.setItem('payID', payID)
return true
})
.catch(err => console.error(`error: ${err}`))
What is your best practice? Do you retain the .catch in development and staging but remove it from PROD? Linter does not want console error in my code.
So about the Eslint thingy, I will suggest you turn it off in the eslint file, and just be conscious of the rule of not putting unnecessary console. For me what I do before committing code for pull-request is to do: SHIFT + CTRL+ F and then type "console.log" to know which files have the console.log method in my VS-CODE and then I remove them.
We can't leave a linter decide everything for us, I'd recommend leaving the console.error because most of the cases we need to see these errors in the console and read them, they exist for a reason.
And for the style of writing of course we can use the point free style
.catch(console.error)
And for the linter, it most likely have a rule(at their documentation) to mute that error.