-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Ignore Warnings" not working #177
Comments
I am seeing the same issue with the following config. jshint: {
options: {
jshintrc: '<%= yeoman.client %>/.jshintrc',
verbose: true
},
server: {
options: {
jshintrc: 'server/.jshintrc'
},
src: [ 'server/{,*/}*.js']
},
all: {
options: {
'-W106': true
},
src: [
'<%= yeoman.client %>/{app,components}/**/*.js',
'!<%= yeoman.client %>/{app,components}/**/*.spec.js',
'!<%= yeoman.client %>/{app,components}/**/*.mock.js'
]
},
test: {
src: [
'<%= yeoman.client %>/{app,components}/**/*.spec.js',
'<%= yeoman.client %>/{app,components}/**/*.mock.js'
]
}
} |
I created my own output formatter, which is actually what is detecting
|
Attached is what I came up with. It's not extensible, but it gets the point Here is what the relevant part of my config looks like: grunt.config.set('jshint', {
options : {
jshintrc : '.jshintrc',
reporter : 'grunt/jshint-reporter.js'
} ,
build : {
// uses default JSHint options
src : [
'**/.jshintrc',
'Gruntfile.js',
'grunt/**/*.js'
]
}, -Luke On Mon, Oct 27, 2014 at 5:04 PM, Lucas Lacroix [email protected]
|
jshint: {
options: {
'-W079': true,
},
all: ['Gruntfile.js', 'client/src/*.js'],
dev: ['client/src/*.js']
} should fix it. |
Any updates on this? |
Just adding "'-W098':true" without changing anything else from the default Yeoman build worked great to get mine to ignore declared but never used errors. Thanks! |
The problem is when you combine the jshintrc file with additional options. On Mon, Nov 23, 2015 at 2:09 PM, JD Smith [email protected] wrote:
|
It seems the usage doc needs to be updated. Right now it has this example: grunt.initConfig({
jshint: {
ignore_warning: {
options: {
'-W015': true,
},
src: ['**/*.js'],
},
},
}); which doesn't work to ignore the warning. |
First, the version is : "grunt-contrib-jshint": "~0.8.0",
I read this issue, but cannot find the perfect answer.
but, but, I need the .jshintrc file. |
I have tested on version 3.2.0, but I guess that this issue can be solved for version before. In fact the answer is quite simple : If you are not using If you are using
|
I am attempting to get the plugin to report success even when JSHint reports particular warnings. For example: I want to warn the developer when they have defined a variable which is never used but I do not want that warning to prevent subsequent tasks from being run. I still want other warnings, such as "variable is undefined" to be treated as an error.
The documentation indicates that I can ignore a particular warning by specifying it in the options prefixed with a '-' and this seems to match what I want the plugin to do. However, this functionality does not appear to work.
Here is the relevant part of my grunt config:
Note: W098 is the "is defined but never used" warning.
The plugin reports the following:
The default reporter does not seem to conditionalize incrementing the error count. In looking at the code, it would appear that these options would be passed to JSHint but only in the absence of the jshintrc option.
At the very least, the documentation is misleading and should indicate that you can only do this in the absence of the jshintrc option. The same should go for the "Specifying JSHint options and globals" section as none of the options would be passed to JSHint.
The text was updated successfully, but these errors were encountered: