Angular-cli : Using ng lint

Updated answer for Angular CLI v6.x, 7.x, 8.x:

ng lint <project-name> --fix

where <project-name> is “name:” from package.json

— answer for Angular CLI v1.x

ng lint -fix

— Original answer below —

To have tslint autofix many errors run the following in the root of your code. Obviously it can only autofix simpler issues like let -> const, “” -> ‘ etc.

npx tslint src/**/*.ts --fix

Yesterday I did this to auto-fix hundreds of let -> const issues in our fairly large code bases. Just reviewing the changes before committing took long enough, manually fixing them all would have taken over a day.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)