简体   繁体   English

如何使用JSHint指定自定义报告程序

[英]How to specify custom reporter with JSHint

I'm using JSHint (in grunt tasks) on a project and currently have it setup to use "jshint-stylish" as the reporter. 我在项目上使用JSHint(在繁琐的任务中),当前将其设置为使用“ jshint-stylish”作为报告者。 It's defined in the jshint.js file as seen in the following code 如下面的代码所示,它在jshint.js文件中定义

module.exports = {

options: {
    reporter: require('jshint-stylish'),

but I'd like to use my own custom reporter. 但我想使用自己的自定义记者。 How do I define the reporter to identify the custom reporter? 如何定义报告者以标识自定义报告者?

Using the structure identified in https://stackoverflow.com/a/17493367/5144741 , I figured out that my relative path was incorrect. 使用https://stackoverflow.com/a/17493367/5144741中标识的结构,我发现我的相对路径不正确。 Important to note: don't include the extension when identifying the reporter. 重要说明:识别报告者时不要包括扩展名。 And the require statement isn't needed in this case either. 在这种情况下,也不需要require语句。

module.exports = {

options: {
    reporter: './example/folder/src/reporters/my_reporter',

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM