Search code examples
visual-studio-2013typescriptweb-essentials

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


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.ts compilation failed: TsLint: exceeds maximum line length of 140

The jquery.d.ts file indeed has lines well over 140 in length, but I can't find the tslint config file to edit the max-line-length value.

I'm using WebEssentials 2013, I haven't installed tslint as part of a package (NPM or Nuget).

Can anyone point me in the right direction? I'm thinking it might just be easier to set up compile/linting outside of VS for now..

Thanks.


Solution

  • I believe that the max-line-length warning is for the length of a single line, rather than for the number of lines in a file.

    You can either break the long lines up to make them smaller, or simply ignore files that aren't "your code".

    /* tslint:disable */
    // the jquery type definition
    /* tslint:enable */
    

    or set up your own config:

    -c, --config:
        The location of the configuration file that tslint will use to
        determine which rules are activated and what options to provide
        to the rules. If no option is specified, the config file named
        tslint.json is used, so long as it exists in the path.
        The format of the file is { rules: { /* rules list */ } },
        where /* rules list */ is a key: value comma-seperated list of
        rulename: rule-options pairs. Rule-options can be either a
        boolean true/false value denoting whether the rule is used or not,
        or a list [boolean, ...] where the boolean provides the same role
        as in the non-list case, and the rest of the list are options passed
        to the rule that will determine what it checks for (such as number
        of characters for the max-line-length rule, or what functions to ban
        for the ban rule).
    

    From https://www.npmjs.org/package/tslint