Skip to content

Instantly share code, notes, and snippets.

@Lugribossk
Last active December 18, 2015 02:09
Show Gist options
  • Save Lugribossk/5709321 to your computer and use it in GitHub Desktop.
Save Lugribossk/5709321 to your computer and use it in GitHub Desktop.
JSHint bug with multiple input files and the Checkstyle reporter.
function example(unused) {}
Running "jshint:console_works" (jshint) task
>> 1 file lint free.
Running "jshint:checkstyle_works" (jshint) task
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="Gruntfile.js">
</file>
</checkstyle>
Running "jshint:console_works2" (jshint) task
>> 2 files lint free.
Running "jshint:checkstyle_broken" (jshint) task
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="Gruntfile.js">
</file>
<file name="example.js">
<error line="1" column="0" severity="warning" message="Unused variable: &apos;example&apos;" source="jshint.implied-unuseds" />
</file>
</checkstyle>
/*global module*/
module.exports = function (grunt) {
"use strict";
var singleInput = ["Gruntfile.js"],
multiInput = ["Gruntfile.js", "example.js"],
unused;
grunt.initConfig({
jshint: {
options: {
unused: false
},
console_works: {
src: singleInput
},
checkstyle_works: {
src: singleInput,
options: {
reporter: "checkstyle"
}
},
console_works2: {
src: multiInput
},
checkstyle_broken: {
src: multiInput,
options: {
reporter: "checkstyle"
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.registerTask("default", ["jshint"]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment