spec.ts 超过最大行长度 140

spec.ts Exceeds maximum line length of 140

我有 Angular2 组件的单元测试规范文件。
这个规范文件导入 files/components 喜欢 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 个问题,但没有帮助。我不想更改配置

我知道我在 Whosebug 上回复这个问题已经很晚了。但是如果有人正在寻找这个问题的答案(像我一样),那么这里是解决方案 -

    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';