2.0.1 Usage Issue?
anthonygreco opened this issue · 1 comments
anthonygreco commented
I have the following versions installed:
$ grunt --version
grunt-cli v0.1.13
grunt v0.4.5
$ node --version
v0.12.7
And when I try the following in my Gruntfile:
jshint: {
options: {
jshintrc: ".jshintrc",
reporter: require("jshint-stylish")
},
all: [
"Gruntfile.js",
"<%= config.app %>/scripts/{,*/}*.js",
"!<%= config.app %>/scripts/vendor/*",
"test/spec/{,*/}*.js"
]
}
I get:
Running "jshint:all" (jshint) task
Warning: Arguments to path.resolve must be strings Use --force to continue.
TypeError: Arguments to path.resolve must be strings
at Object.posix.resolve (path.js:439:13)
at Object.exports.selectReporter (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt-contrib-jshint/tasks/lib/jshint.js:50:31)
at Object.exports.lint (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt-contrib-jshint/tasks/lib/jshint.js:163:28)
at Object.<anonymous> (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt-contrib-jshint/tasks/jshint.js:44:12)
at Object.<anonymous> (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt/lib/grunt/task.js:264:15)
at Object.thisTask.fn (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt/lib/grunt/task.js:82:16)
at Object.task.fn (/Volumes/Data/Users/agreco/repos/dm/node_modules/jit-grunt/lib/jit-grunt.js:122:30)
at Object.<anonymous> (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt/lib/util/task.js:301:30)
at Task.runTaskFn (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt/lib/util/task.js:251:24)
at Task.<anonymous> (/Volumes/Data/Users/agreco/repos/dm/node_modules/grunt/lib/util/task.js:300:12)
After looking at /Volumes/Data/Users/agreco/repos/dm/node_modules/grunt-contrib-jshint/tasks/lib/jshint.js and some logging, I realized I could call toString() on the require("jshint-stylish") and it resolves.
jshint: {
options: {
jshintrc: ".jshintrc",
reporter: require("jshint-stylish").toString()
},
all: [
"Gruntfile.js",
"<%= config.app %>/scripts/{,*/}*.js",
"!<%= config.app %>/scripts/vendor/*",
"test/spec/{,*/}*.js"
]
}
Not sure if you'd classify this is a bug or not, but thought I'd share my findings either way.
sindresorhus commented
Duplicate of #24.