Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gruntjs/grunt-contrib-jshint
Browse files Browse the repository at this point in the history
* 'master' of github.com:gruntjs/grunt-contrib-jshint:
  v0.12.0
  Bump JSHint to v2.9.1.
  formatting
  make relative reporterOutput paths optional
  • Loading branch information
shama committed Jan 30, 2016
2 parents 36b45ae + baa5913 commit 3b3fed2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.12.0:
date: 2016-01-17
changes:
- Update to JSHint ~2.9.0.
v0.11.3:
date: 2015-09-03
changes:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# grunt-contrib-jshint v0.11.3 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-jshint.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-jshint) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/j04ik7qgx21ixyfw/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-jshint/branch/master)
# grunt-contrib-jshint v0.12.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-jshint.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-jshint) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/j04ik7qgx21ixyfw/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-jshint/branch/master)

> Validate files with JSHint
Expand Down Expand Up @@ -215,6 +215,7 @@ grunt.initConfig({

## Release History

* 2016-01-17   v0.12.0   Update to JSHint ~2.9.0.
* 2015-09-03   v0.11.3   Update to JSHint ~2.8.0.
* 2015-04-16   v0.11.2   Fix default value of the `reporter` option.
* 2015-03-20   v0.11.1   Fix io.js compatibility issues. Other fixes to pathing.
Expand Down Expand Up @@ -253,4 +254,4 @@ grunt.initConfig({

Task submitted by ["Cowboy" Ben Alman](http://benalman.com/)

*This file was generated on Mon Oct 12 2015 00:56:47.*
*This file was generated on Sun Jan 17 2016 13:06:03.*
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grunt-contrib-jshint",
"description": "Validate files with JSHint",
"version": "0.11.3",
"version": "0.12.0",
"author": {
"name": "Grunt Team",
"url": "http://gruntjs.com/"
Expand All @@ -17,7 +17,7 @@
},
"dependencies": {
"hooker": "^0.2.3",
"jshint": "~2.8.0"
"jshint": "~2.9.1"
},
"devDependencies": {
"grunt": "^0.4.5",
Expand Down
3 changes: 2 additions & 1 deletion tasks/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports = function(grunt) {
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options({
force: false,
reporter: null
reporter: null,
reporterOutputRelative: true
});

// Report JSHint errors but dont fail the task
Expand Down
14 changes: 9 additions & 5 deletions tasks/lib/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,17 @@ exports.init = function(grunt) {
var reporterOutputDir;
// Get reporter output directory for relative paths in reporters
if (options.hasOwnProperty('reporterOutput')) {
reporterOutputDir = path.dirname(options.reporterOutput);
if (options.reporterOutputRelative) {
reporterOutputDir = path.dirname(options.reporterOutput);
}
delete options.reporterOutput;
}

// Select a reporter to use
var reporter = exports.selectReporter(options);

// Remove bad options that may have came in from the cli
['reporter', 'jslint-reporter', 'checkstyle-reporter', 'show-non-errors'].forEach(function(opt) {
['reporter', 'reporterOutputRelative', 'jslint-reporter', 'checkstyle-reporter', 'show-non-errors'].forEach(function(opt) {
if (options.hasOwnProperty(opt)) {
delete options[opt];
}
Expand Down Expand Up @@ -194,9 +196,11 @@ exports.init = function(grunt) {
var allData = [];
cliOptions.args = files;
cliOptions.reporter = function(results, data) {
results.forEach(function(datum) {
datum.file = reporterOutputDir ? path.relative(reporterOutputDir, datum.file) : datum.file;
});
if (reporterOutputDir) {
results.forEach(function(datum) {
datum.file = path.relative(reporterOutputDir, datum.file);
});
}
reporter(results, data, options);
allResults = allResults.concat(results);
allData = allData.concat(data);
Expand Down

0 comments on commit 3b3fed2

Please sign in to comment.