我正在为Angular2组件提供单元测试规范文件
这个spec文件导入文件/组件之类的
import { DeviceProtocolModifiedLabelComponent } from
'../../../../../src/app/device/deviceProtocol/deviceProtocolList/deviceProtocolWidget/deviceProtocolModifiedLabel/device-protocol-modified-label.component';
import { DeviceProtocolTagsComponent } from
'../../../../../src/app/device/deviceProtocol/deviceProtocolList/deviceProtocolWidget/deviceProtocolTags/device-protocol-tags.component';
但是上面的行在一行中超过140个字符,并在控制台上显示以下错误。
test/specs/app/device/deviceProtocol/device-protocol.component.spec.ts[25, 1]: Exceeds maximum line length of 140
我经历了this问题,但没有帮助。我不想更改配置
答案 0 :(得分:0)
我知道我很晚才在 stackoverflow 上回答这个问题。但是如果有人正在寻找这个问题的答案(像我一样),那么这里是解决方案 -
1. Write your code in this way -
import {
DeviceProtocolTagsComponentA,
DeviceProtocolTagsComponentB,
DeviceProtocolTagsComponentC
} from
'../../../../../../../../../../../../device-protocol-tags.component';
2. OR Go to tslint.json file and change this -
"max-line-length": [
true,
140 // increase this value
]
3. OR Add below line just above your code, like this -
// tslint:disable-next-line:max-line-length
import { DeviceProtocolModifiedLabelComponent } from '../../../../../src/app/device/deviceProtocol/deviceProtocolList/deviceProtocolWidget/deviceProtocolModifiedLabel/device-protocol-modified-label.component';