如何使用Maven配置JSHint

如何使用Maven配置JSHint

本文介绍了如何使用Maven配置JSHint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Maven项目中使用JSHint(执行mvn jshint:lint将显示警告).在 http://www.jshint.com/docs/

I am using JSHint for my maven project (Executing mvn jshint:lint will display warnings). There are two configuration methods provided on http://www.jshint.com/docs/

当前我正在使用Inline configuration,但是我对使用他们在Configuration中提到的package.json文件感兴趣,但是我不知道将该文件放在何处.

Currently i am using the Inline configuration, but i am interested in using package.json file which they have mentioned in Configuration, but i don't know where to put this file.

如何将Maven项目配置为与jshint一起使用package.json.jshintrc配置文件?

How to configure the maven project to use package.json or .jshintrc config file with jshint?

推荐答案

这里是我的Maven配置,也许有帮助:

Here my maven config, maybe it helps:

    <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

The plugin documentation is quite hard to find. Please try here: https://github.com/cjdev/jshint-mojo

这篇关于如何使用Maven配置JSHint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:29