Angular-cli: Using ng lint

I know that angular-cli uses codelizer which uses lint.js

When using the command: ng lint

Can it automatically fix the formatting? or will it only report formatting errors?

ng lint --help displays all help commands for angular-cli.

+23
source share
4 answers

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

ng lint <project-name> --fix

where <project_name> is the "name:" from package.json

- answer for Angular CLI v1.x -

ng lint -fix

- Original answer below -

tslint , . , , let → const, "" → ' ..

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

-fix let → const . , .

+38

Angular 6. 0+ ng lint :

ng lint <project> --fix

<project> - , ng new.

: https://github.com/angular/angular-cli/wiki/lint

+8

, , VS TSLint, ( ) TSLint .

, .

+4

-, Angular 6.0 .


6.0:

ng lint tslint (TypeScript linter), linting. AFAIK, ( 16 )

There are projects under the name tslint-fixthat are aimed at fixing a number of so-called automatically fixed problems.

+2
source

Source: https://habr.com/ru/post/1659569/


All Articles