开发者

wro4j maven plugin and jshint

开发者 https://www.devze.com 2023-04-04 00:44 出处:网络
I have just tried to use the wro4j maven plugin to get my js checked using jshint on build time. I have configure the options used by jshint, and the console lists them correctly, but in the code eval

I have just tried to use the wro4j maven plugin to get my js checked using jshint on build time. I have configure the options used by jshint, and the console lists them correctly, but in the code evaluation they are ignored.

Here's the content of my wro.xml

<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd">

    <group name="shop">
        <js>/static/js_source/myjs.js</js>
    </group>
</groups>

And here's the plugin code:

        <plugin>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
                <execution>                        
                    <goals>
                        <goal>jshint</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>                    
                <targetGroups>shop</targetGroups>
                <minimize>false</minimize>
                <options>browser,jquery,curly,eqnull,evil,forin,noarg</options>
            </configura开发者_C百科tion>
        </plugin>

I have played around with different options but nothing seems to work.

Ideas anyone?

Thanks!


Alex, I'm sorry, I actually misinterpreted both types of errors. eqnull only deals with "== null" and not "== 0" (which is what has thrown the error, and which is different of course). And forin actually -enforces- the use of hasOwnProperty, while I thought it would allow to leave it out.


I'm not sure if this is relavent but I was just attempting to do a very similar thing and having very similar problems (my option choices were being ignored)

I have found that running:

wro4j:jshint

does not seem to apply the supplied options, however, it applies the options when run as part of the verify phase:

mvn verify

This at least, was the reason why I was not seeing my options applied and how I got it to work.

By the sounds of things you tried something similar and had no joy, however, I am posting this answer as I believe others may run in to the same problem I did and come upon this page for the same reasons.

0

精彩评论

暂无评论...
验证码 换一张
取 消