Auto fix TSLint Warnings
You can use the --fix
option of TSLint to automatically fix most warnings. This might look something like this in a common use case:
tslint --fix -c ./config/tslint.json 'src/**/*{.ts,.tsx}'
Keep in mind that this will overwrite your source code. While this is safe 99.9% of the time, I recommend the following workflow:
- Commit the changes you have made to your code
- Run TSLint with the
--fix
flag like above - Quickly review the changes TSLint has made
- Make a new commit with these changes, or simply amend them to your previous commit
This way, you'll never be taken surprise by a rogue autocorrection gone wrong.
tslint --fix --project ./tsconfig.json
This is auto fix all Error is root folder