本文介绍了jquery.d.ts 编译失败:TsLint:超过最大行长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VS 2013 和 0.95 版的 TypeScript,但 linter 未能通过 TS 编译并出现错误:

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

TsLint:已检查 app.ts.TsLint:jquery.d.ts 编译失败:TsLint:超过最大行长度 140

jquery.d.ts 文件确实有超过 140 行的长度,但我找不到 tslint 配置文件来编辑 max-line-length 值.

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.

我使用的是 WebEssentials 2013,我没有将 tslint 作为软件包(NPM 或 Nuget)的一部分安装.

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

谁能指出我正确的方向?我认为现在在 VS 之外设置编译/linting 可能更容易..

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..

谢谢.

推荐答案

我认为 max-line-length 警告是针对单行的长度,而不是针对行数在一个文件中.

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 */

或设置您自己的配置:

-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).

来自 https://www.npmjs.org/package/tslint

这篇关于jquery.d.ts 编译失败:TsLint:超过最大行长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 06:55