Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/philmander/ant-jshint

Ant task for jshint
https://github.com/philmander/ant-jshint

Last synced: 2 months ago
JSON representation

Ant task for jshint

Awesome Lists containing this project

README

        

#This project is deprecated

I won't being performing any maintanence on this project other than merging pull requests that merge automatically.

My personal preference is now to use gulp + jshint instead.

---

#Ant task for JSHint

Easily automate JSHint (http://www.jshint.com/) validation on your Javascript code base with Apache Ant.

To get started [download](https://github.com/philmander/ant-jshint/tree/master/release) the ant-jshint jar file and include the following code in your Ant build file.

```xml




```

There is also a zip containing all the jars. To use them, unpack the zip and include the following code in your Ant build file.

```xml






```

##Parameters

###Task attributes

Attribute | Description | Required
----------- | ----------- | ------------------
dir | The directory to scan for files to validate | yes
options | A comma separated list of jshint options. E.g. `evil: true, maxlen: 100` | no
optionsFile | A java properties file containing a list of jshint options (Files with a '.json' extension will be interpreted as JSON). You may prefer this for managing a larger amount of options. The options parameter will override options specified in the options file | no
globals | A comma separated list of jshint globals. E.g. `jQuery: true, myApp: true` | no
globalsFile | A java properties file containing a list of jshint globals. You may prefer this for managing a larger amount of globals. The globals parameter will override options specified in the globals file | no
fail | Instructs the task to fail the build if any jshint errors are found | no (defaults to true)
jshintSrc | The task is packaged with jshint embedded, but an alternative jshint src file can be specified here | no

The task is an implicit fileset. See http://ant.apache.org/manual/Types/fileset.html for more parameters used for file matching or see the usage examples below.

If a .jshintrc file is present in the base directory of the project and no optionsFile attribute is specified, this will automatically be loaded
as the optionsFile (interpreted as JSON)

###Nested elements

####report

Attribute | Description | Required
------------ | ----------- | ------------------
type | The type of report. Available values are `plain`, `xml` and `jslint-xml` (for compatibility with the JSLint plugins) | no (defaults to 'plain')
destFile | The file to write the report to | yes

##Usage examples

###Typical fileset
Lint all JS except minimized source files

```xml


```

###Setting JSHint options

```xml


```

###Setting options in an external file

```xml


```
`jshint/options.properties`:

evil=true
forin=true
devel=false

###Specifying global variables

```xml


```

###Use for reporting purposes
The task will not fail upon jshint errors and will write results to a file in xml format:

```xml



```

## Running the task in Maven ##

Ant-Jshint isn't deployed to the Maven Central Repository yet, but you can install locally either by cloning the
project and running

`mvn install`

or downloading the jar release and running

`mvn install:install-file -Dfile=/path/to/ant-jshint-0.3.6-SNAPSHOT-deps.jar -DgroupId=com.philmander.jshint -DartifactId=ant-jshint -Dversion=0.3.6 -Dpackaging=jar`

Now use the antrun plugin to add jshint to your Maven build

```xml

org.apache.maven.plugins
maven-antrun-plugin
1.7


jshint
validate









run





com.philmander.jshint
ant-jshint
0.3

```
## Fork and run locally ##

Ant-Jshint is built using Apache Maven.

To run tests against your code run `mvn test`

To create a jar file run `mvn package`