jquery.d.ts compilation failed: TsLint: exceeds maximum line length

前端 未结 2 1652
春和景丽
春和景丽 2021-01-20 03:04

I am using VS 2013 with version 0.95 of TypeScript, but the linter fails the TS compilation with the error:

TsLint: app.ts checked. TsLint: jquery.d.t

2条回答
  •  萌比男神i
    2021-01-20 03:48

    You can modify the tslint configuration file to change the maximum line length threshold. It uses a hierarchical configuration system so you can scope the change depending on where you create/modify the tslint.conf file.

    By default, configuration is loaded from tslint.json, if it exists in the current path, or the user's home directory, in that order. (source...)

    On my windows computer the global configuration file was located in C:\Users\My.Username and changes here will apply to all projects. Creating or modifying the file in the root of the Visual Studio will mean the configuration settings will only apply to that project and will override the global configuration file.

    The specific configuration option you need to modify for the maximum line-length is called max-line-length and would look something like this:

    "max-line-length": [true, 140]
    

    Change the 140 value to extend the allowed length of lines or change true to false to disable the max line length rule.


    Alternatively, you can do what Steve has suggested in the other answer but you don't need to completely disable tslint because you can disable specific rules. The syntax for that is:

    /*tslint:disable:rule1 rule2 rule3*/
    

    So you would use:

    /*tslint:disable:max-line-length*/
    

    to disable the max-line-length rule for that file.

    All of the configuration options and the rule-specific disabling are explained fully on the tslint website.

提交回复
热议问题