You can use the --fix for TSLint to automatically fix most warnings. This might look something like this in the general case:
tslint --fix -c ./config/tslint.json 'src/**/*{.ts,.tsx}'
Keep in mind that this will overwrite your source code. Although it is safe in 99.9% of cases, I recommend the following workflow:
- Commit the changes made to your code.
- Run TSLint with the
--fix flag as above - Quick view of changes made by TSLint
- Make a new commit with these changes, or simply change them to the previous commit.
Thus, you will never be surprised that the auto-correction of the rogue went wrong.
source share