You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
add codefix that rewrites var to let to const where appropriate #13133
We can do a refactoring for this. will have to think about cases where the var declaration is used outside the block where it is defined, we will need to hoist the declaration as well as change it to block-scoped declaration.
btw are refactorings even a thing that is somehow different from codefixes (i am asking because i see different tags are used to label similar issues)?
A code fix usually implies something is wrong - there's an error that can be amended. A refactoring implies rewriting working code in some manner. I think they both fall under the umbrella of "code actions".
btw are refactorings even a thing that is somehow different from codefixes (i am asking because i see different tags are used to label similar issues)?
Code Fix is tied to a diagnostic message, e.g. an error. If the error is shown, the editor shows you the option to "fix" it.
Refactoring are more free form. you would right-click on a position and ask for possible refactorings.
it is possible that you have the same change available as a Fix and as a refactoring.
Activity
mhegazy commentedon Dec 22, 2016
We can do a refactoring for this. will have to think about cases where the
vardeclaration is used outside the block where it is defined, we will need to hoist the declaration as well as change it to block-scoped declaration.zpdDG4gta8XKpMCd commentedon Dec 22, 2016
btw are refactorings even a thing that is somehow different from codefixes (i am asking because i see different tags are used to label similar issues)?
DanielRosenwasser commentedon Dec 22, 2016
A code fix usually implies something is wrong - there's an error that can be amended. A refactoring implies rewriting working code in some manner. I think they both fall under the umbrella of "code actions".
In general, I've been sloppy with the terminology with Paul van Brenk (@paulvanbrenk) correcting me every so often.
mhegazy commentedon Dec 22, 2016
Code Fix is tied to a diagnostic message, e.g. an error. If the error is shown, the editor shows you the option to "fix" it.
Refactoring are more free form. you would right-click on a position and ask for possible refactorings.
it is possible that you have the same change available as a Fix and as a refactoring.
angelozerr commentedon Apr 19, 2017
tslint supports that. I have started to write a tslint plugin (for TypeScript 2.2.1) https://github.com/angelozerr/tslint-language-service . Here a demo with Eclipse but it works too with other IDE like VSCode:
zpdDG4gta8XKpMCd commentedon Apr 19, 2017
why does it turn into
letinstead ofconston the annimation?jessetrinity commentedon Oct 21, 2020
ESLint already has a fix that does this - I don't think we should overlap.