Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2013 jquery.d.ts编译失败:TsLint:超过最大行长度_Visual Studio 2013_Typescript_Web Essentials - Fatal编程技术网

Visual studio 2013 jquery.d.ts编译失败:TsLint:超过最大行长度

Visual studio 2013 jquery.d.ts编译失败:TsLint:超过最大行长度,visual-studio-2013,typescript,web-essentials,Visual Studio 2013,Typescript,Web Essentials,我将VS 2013与TypeScript的版本0.95一起使用,但linter未能通过TS编译,错误如下: TsLint:app.ts已选中。TsLint:jquery.d.ts编译失败: TsLint:超过最大行长度140 jquery.d.ts文件确实有超过140行的长度,但是我找不到tslint配置文件来编辑max line length值 我使用的是WebEssentials 2013,我还没有将tslint作为包(NPM或Nuget)的一部分安装 谁能给我指出正确的方向吗?我想现在在V

我将VS 2013与TypeScript的版本0.95一起使用,但linter未能通过TS编译,错误如下:

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

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

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

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


谢谢。

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

您可以将长的行拆分成更小的行,或者干脆忽略不是“您的代码”的文件

或设置您自己的配置:

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

中,您可以修改tslint配置文件以更改最大行长度阈值。它使用分层配置系统,因此您可以根据创建/修改
tslint.conf
文件的位置来确定更改的范围

默认情况下,配置是从tslint.json加载的,如果它存在于 当前路径或用户的主目录,按该顺序

在我的windows计算机上,全局配置文件位于
C:\Users\my.Username
中,此处的更改将应用于所有项目。在Visual Studio的根目录中创建或修改文件将意味着配置设置将仅应用于该项目,并将覆盖全局配置文件

需要为最大线长度修改的特定配置选项称为
max line length
,如下所示:

"max-line-length": [true, 140]
更改
140
值以延长允许的行长度,或将
true
更改为
false
以禁用最大行长度规则


或者,您可以按照Steve在另一个答案中的建议执行,但不需要完全禁用tslint,因为您可以禁用特定的规则。其语法是:

/*tslint:disable:rule1 rule2 rule3*/
因此,您可以使用:

/*tslint:disable:max-line-length*/
禁用该文件的最大行长度规则


所有配置选项和特定于规则的禁用都在上有详细说明。

抱歉,Steve,您误解了我的问题。1) 我知道这是线的长度(“线的长度远远超过140”-从上面)。2) 我不会更改jquery.d.ts文件,因为它是在DefinitelyTyped repo([link])上创建和存储的第三方标准。3) 它在Visual Studio 2013中,没有--config开关。嗨,Steve,我想我会尝试在上编辑该文件,并启动了一个pull请求,但TS不理解重构几个接口定义。我优先考虑的是不必更改默认值(因为,为什么)和开箱即用的W.E.2013集成。如果TSLint获得支持,项目可能愿意在默认情况下将忽略规则添加到
.d.ts
文件中。您希望TSLint检查您的代码而不是外部代码和定义,对吗?这是一个公平的观点。但是,如果根本没有必要检查它们,那么TSLint应该完全忽略它们。我的猜测是,您可能想知道定义文件正在完成它们的工作(在VS中提供intellisense等),但不会以在每个构建中的所有外部资源上运行linter为代价。现在,我将使用排除注释绕过它:/*tslint:disable:max line length*/。你能更新你的答案以包括它(作为以VS为中心的解决方案)吗?我会同意你的?谢谢
/*tslint:disable:max-line-length*/