Quando lavoriamo su un progetto angolare, quando modifichiamo .ts file, potremmo non programmare in modo così standard, come definizioni di variabili, spazi, virgolette, ecc.
Possiamo usare il seguente comando per controllare l'avviso di avviso generato nel progetto.
C:\project\colors>ng lint Linting "colori"...
ERROR: C:/project/colors/src/app/app.component.ts:1497:17 - Unnecessarily quoted property 'strength' found.
ERROR: C:/project/colors/src/app/app.component.ts:1497:17 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1517:1 - space indentation expected
ERROR: C:/project/colors/src/app/app.component.ts:1517:6 - Identifier 'a' is never reassigned; use 'const' instead of 'let'.
ERROR: C:/project/colors/src/app/app.component.ts:1517:10 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1518:5 - statements are not aligned
ERROR: C:/project/colors/src/app/app.component.ts:1519:5 - statements are not aligned
ERROR: C:/project/colors/src/app/app.component.ts:1522:25 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1523:1 - space indentation expected
ERROR: C:/project/colors/src/app/app.component.ts:1523:2 - statements are not aligned
ERROR: C:/project/colors/src/app/app.component.ts:1523:4 - missing whitespace
ERROR: C:/project/colors/src/app/app.component.ts:1523:17 - == should be ===
ERROR: C:/project/colors/src/app/app.component.ts:1523:20 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1523:24 - missing whitespace
ERROR: C:/project/colors/src/app/app.component.ts:1524:1 - space indentation expected
ERROR: C:/project/colors/src/app/app.component.ts:1524:15 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1525:1 - space indentation expected
Errori di lanugine trovati nei file elencati.
Come mostrato di seguito:
Come posso risolvere questi avvertimenti?
Il comando è il seguente:
Gli errori che possono essere risolti automaticamente includono: spazi bianchi mancanti, punto e virgola mancante, " dovrebbe essere ', 'else' spostato male, file dovrebbe terminare con una nuova linea, spazi bianchi finali, punto e virgola non necessario, identificatore 'XXX' non è mai rilevato
Usare il comando di avviso auto-fix potrebbe non risolvere tutti gli avvisi,Se non può essere corretta automaticamente, dobbiamo correggere manualmente l'avviso。
|