Wanneer we aan een hoekproject werken, coderen we bij het bewerken van .ts bestanden misschien niet zo standaard, zoals variabelendefinities, spaties en aanhalingstekens, enzovoort.
We kunnen het volgende commando gebruiken om de waarschuwingswaarschuwing die in het project wordt gegenereerd te controleren.
C:\project\colors>ng lint Linten van "kleuren"...
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
Pluisfouten gevonden in de vermelde bestanden.
Zoals hieronder getoond:
Hoe los ik deze waarschuwingen op?
Het commando is als volgt:
Fouten die automatisch kunnen worden opgelost zijn onder andere: ontbrekende witspatie, ontbrekende puntkomma, " should be '", verkeerd geplaatste 'else', bestand moet eindigen met een nieuwe regel, achterliggende witspatie, onnodige puntkomma, identificatie 'XXX' wordt nooit reass
Het gebruik van het auto-fix waarschuwingscommando kan niet alle waarschuwingen oplossen,Als het niet automatisch kan worden gecorrigeerd, moeten we de waarschuwing handmatig aanpassen。
|