Açısal bir proje üzerinde çalışırken, .ts dosyaları düzenlerken, değişken tanımları, boşluklar, tırnak işaretleri gibi standart kod yazmayabiliriz.
Projede oluşturulan uyarı uyarısını kontrol etmek için aşağıdaki komutu kullanabiliriz.
C:\project\colors>ng lint Tüylü "renkler"...
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
Listelenen dosyalarda tüy hataları bulundu.
Aşağıda gösterildiği gibi:
Bu uyarıları nasıl düzeltebilirim?
Komut şöyledir:
Otomatik olarak düzeltilebilen hatalar şunlardır: eksik boşluk, eksik nokta virgül, "should be', yanlış yerleştirilmiş 'else', dosya yeni satırla bitmeli, arkasındaki boşluk, gereksiz nokta virgül, tanımlayıcı 'XXX' asla reass değil
Otomatik düzeltme uyarı komutu tüm uyarıları düzeltmeyebilir,Otomatik olarak düzeltilemezse, uyarıyı manuel olarak düzeltmemiz gerekiyor。
|