2017-03-09 71 views
8

在我Angular2程序,我正在導入一個組件是這樣的:打字稿皮棉錯誤「超過120行的最大長度」

import { PersonsSingleAccountComponent} from 
    '../persons-information/fragments/persons-single-account/persons-single-account-bookings/persons-single-account-bookings.component' 

這是給我的皮棉錯誤「超出最大行字符」。如果我試圖在``(反向)中給出語句,那麼就是拋出錯誤。

我怎樣才能解決這個皮棉錯誤

+1

旁邊的錯誤,也許你還需要一點點的重構。在'persons-information'文件夾中,是否需要在所有單個文件夾前添加'persons'?關於你的問題的一些提示:https://github.com/madskristensen/WebEssentials2013/issues/667或http://stackoverflow.com/questions/21868675/jquery-d-ts-compilation-failed-tslint-exceeds-maximum-行長 – mickdev

回答

14

這真的不是你可以改變的,不相關的代碼。

您應該簡單地通過前添加註釋禁用此導入規則:

// tslint:disable-next-line:max-line-length 
import { PersonsSingleAccountComponent} from '../persons-information/fragments/persons-single-account/persons-single-account-bookings/persons-single-account-bookings.component' 
+3

我同意一個級別,但禁用linting檢查是一種代碼味道。我認爲包裝系統是相當多餘的,可以簡化 – alebianco

+0

我非常困惑!我昨天沒有得到這個錯誤,現在我正在將確切的行復制到一個新的項目中,並且我得到這個錯誤。 : -/- 這是新的打字稿2.5也許? –

+0

嗯或者可能昨天我沒有在VSCode中正確安裝的typescript語言插件? –