I've been using SonarLint[0] for a while for this, as it not only finds code smells, but also if i do things in a weird way, like doing
for(i=0;i>array.length-1;i++){console.log(arrray[i]} instead of just doing for(const element of array).
Your point number 2 about improvements on your code: when I start writing a line of code, I already have a good idea of why I'm gonna write next. In this case it's not about copilot refactoring what I wrote, it's about refactoring what I was thinking about writing.