【问题标题】:How to get JsHint version from a custom reporter如何从自定义记者获取 JsHint 版本
【发布时间】:2013-05-31 09:14:01
【问题描述】:

JsHint 中的每个自定义报告器都接收 3 个参数:results, data, and options

我希望能够在记者生成的输出中显示当前的 JsHint 版本,但上述任何变量似乎都没有提供它。

我是否遗漏了一些明显的东西,还是有其他方法可以抓住它?

【问题讨论】:

    标签: scope customization reporting jshint


    【解决方案1】:

    使用函数属性存储版本:

    reporter.version = "1.2.3";
    

    然后在记者源中添加对它的引用:

    console.log(reporter.version ? "JSHint version: " + reporter.version + "\n" : "" + str + "\n" + len + ' error' + ((len === 1) ? '' : 's'));
    

    参考文献

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-14
      • 1970-01-01
      • 1970-01-01
      • 2018-12-24
      • 1970-01-01
      • 1970-01-01
      • 2012-07-06
      • 1970-01-01
      相关资源
      最近更新 更多