JSHint 和 JSCS 内联忽略相同的下一行

JSHint and JSCS inline ignore for the same next line

是否有可能以某种方式使 JSHint 和 JSCS 在同一下一行的内联忽略上很好地协同工作?

我想做这样的事情:

/* jshint camelcase: false, jscs requireCamelCaseOrUpperCaseIdentifiers: false */

我尝试了几个不同的变体(分开 "comment blocks",中间有分号,忽略不同的行),但无法使其工作。也许我错过了一些明显的东西?还是根本不可能?谢谢。

JSHint 不允许禁用单行的特定规则,但可以禁用一行的所有验证:

var do_something; /* jshint ignore:line */

对于 JSCS,enable/disable 单个规则的语法如下所示:

// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
...
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers

放在一起,要禁用特定行的 JSHint 和 JSCS 验证,可以结合使用上述注释:

// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var var_name_with_underscores; /* jshint ignore:line */
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers

如果在一个块内的多行中使用非驼峰式标识符(这是通常的规则),可能需要将整个函数包含在注释中。

// jscs: disable requireCamelCaseOrUpperCaseIdentifiers
/* jshint ignore:start */
function foo()
{
    var var_name_with_underscores;
    ...
    var_name_with_underscores = 123;
    ...
}
/* jshint ignore:end */
// jscs: enable requireCamelCaseOrUpperCaseIdentifiers