Kui töötame nurkprojekti kallal ja .ts faile toimetades, ei pruugi me koodi nii standardselt, näiteks muutujate definitsioonid, tühikud, jutumärgid jne.
Saame kasutada järgmist käsku, et kontrollida projektis tekkinud hoiatust.
C:\project\colors>ng lint Värvid "värvid"...
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
Lint-vead leiti loetletud failides.
Nagu allpool näidatud:
Kuidas ma saan neid hoiatusi parandada?
Käsk on järgmine:
Vead, mida saab automaatselt parandada, on: puuduv tühik, puuduv semikoolon, "peaks olema ', valesti paigutatud 'muu'", fail peaks lõppema uue reaga, tühiku tühikuga, tarbetu semikoolon, identifikaator 'XXX' ei ole kunagi reass
Automaatse parandamise hoiatuskäsu kasutamine ei pruugi kõiki hoiatusi parandada,Kui seda ei saa automaatselt parandada, peame hoiatuse käsitsi parandama。
|