Când lucrăm la un proiect unghiular, când edităm .ts fișiere, este posibil să nu codăm atât de standard, cum ar fi definițiile variabilelor, spațiile, ghilimelele etc.
Putem folosi următoarea comandă pentru a verifica avertismentul generat în proiect.
C:\project\colors>ng lint Linting "culorile"...
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
Erori de scame găsite în fișierele listate.
Așa cum se arată mai jos:
Cum pot corecta aceste avertismente?
Comanda este următoarea:
Erorile care pot fi remediate automat includ: spațiu alb lipsă, punct și virgulă lipsă, " ar trebui să fie ', 'else' plasat greșit, fișierul ar trebui să se termine cu o linie nouă, spațiul alb la final, punct și virgulă inutil, identificatorul 'XXX' nu este niciodată reass
Folosirea comenzii de avertizare auto-fix s-ar putea să nu rezolve toate avertismentele,Dacă nu poate fi corectat automat, trebuie să corectăm manual avertismentul。
|