|
|
Paskelbta 2020-05-26 17:36:47
|
|
|
|

Kai dirbame su kampiniu projektu, redaguodami .ts failus, galime ne taip standartiškai koduoti, pvz., kintamųjų apibrėžimus, tarpus, kabutes ir kt.
Norėdami patikrinti projekte sugeneruotą įspėjimą, galime naudoti šią komandą.
C:\project\colors>ng lint Pūkų "spalvos"...
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
Išvardytuose failuose rasta pūkų klaidų.
Kaip parodyta žemiau:
Kaip ištaisyti šiuos įspėjimus?
Komanda yra tokia:
Klaidos, kurios gali būti automatiškai ištaisytos, yra šios: trūksta tarpų, trūksta kabliataškio, " turėtų būti ", netinkamoje vietoje "kitaip", failas turėtų baigtis nauja eilute, galinis tarpas, nereikalingas kabliataškis, identifikatorius "XXX" niekada nėra reass
Naudojant automatinio taisymo įspėjimo komandą gali būti neištaisyti visi įspėjimai,Jei jo negalima ištaisyti automatiškai, įspėjimą turime ištaisyti rankiniu būdu。
|
Ankstesnis:cmd, kad nustatytumėte komandą Constant Environment VariableKitą:js eilutės inversija
|