我正在使用JSHint作为我的maven项目(执行mvn jshint:lint将显示警告)。 http://www.jshint.com/docs/
提供了两种配置方法目前我正在使用Inline configuration
,但我有兴趣使用他们在package.json
中提到的Configuration
文件,但我不知道该文件放在何处。< / p>
如何配置maven项目以使用jshint使用package.json
或.jshintrc
配置文件?
答案 0 :(得分:0)
您可以创建一个grunt任务,Maven客户端可以调用该任务来运行您的jshint内容。参见:
答案 1 :(得分:0)
这里是我的Maven配置,也许有帮助:
<build>
<plugins>
<!-- ... -->
<plugin>
<groupId>com.cj.jshintmojo</groupId>
<artifactId>jshint-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<configuration>
<version>2.5.6</version>
<failOnError>false</failOnError>
<configFile>src/main/javascript/jshint.package.json</configFile>
<directories>
<directory>src/main/javascript</directory>
</directories>
<!--<reporter>jslint</reporter><reportFile>target/jslint.xml</reportFile>-->
<!--<reporter>html</reporter><reportFile>target/jshint.html</reportFile>-->
<reporter>checkstyle</reporter>
<reportFile>target/checkstyle-jshint.xml</reportFile>
<failOnError>false</failOnError> <!-- this seems to be ignored -->
</configuration>
<goals>
<goal>lint</goal> <!-- jshint:lint -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
很难找到插件文档。请在这里尝试:https://github.com/cjdev/jshint-mojo