You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a name conflict between the "options" passed directly to the JSHint task and the options that grunt appends as command line arguments. I have seen this particularly with the --verbose argument. Some special options provided by grunt-contrib-jshint, such as ignores or reporter, behave correctly.
This behavior can be clearly seen with a task like:
When run, this task will break on the first error, reported as: line 0 col 0 Bad option: 'verbose'. (E001)
Note that it includes the error code, which is only provided when the JSHint command is run with --verbose (I use the stylish reporter in this case because it's verbose output is very easy to identify concisely). This shows that Grunt is correctly appending its task.options to the command being run, in this case --verbose.
This behavior can also be seen by using a .jshintrc file, as the options are no longer passed to the linter, so the verbose flag can be passed to grunt as expected. Because of the behavior of the .jshintrc option, however, it is currently not possible to run in verbose mode and override options in a subtask simultaneously.
While i encountered this when attempting to run in verbose mode, this will also be the case for any flag not explicitly supported by grunt-contrib-jshint (http://www.jshint.com/docs/cli/)
Proposed Solutions
Provide an alternate reserved name where options can be passed to the linter separately from the grunt options (e.g. 'jshint_options'). The pro of this solution is that it does not require any additional "special" flags be considered in the task "options" (as ignores is to --excludes in the current version), and will support any future CLI flags added to JSHint. The con is that this is a breaking change for anyone using a task with the name of the selected reserved name.
Implement special options handling for the missing JSHint CLI options (http://www.jshint.com/docs/cli/): verbose, show-non-errors, extract, help, and version. The only con of this solution is that if these options change or are added to, these changes will need to be reflected in this repo as well.
The text was updated successfully, but these errors were encountered:
Issue
There is a name conflict between the "options" passed directly to the JSHint task and the options that grunt appends as command line arguments. I have seen this particularly with the
--verbose
argument. Some special options provided by grunt-contrib-jshint, such as ignores or reporter, behave correctly.This behavior can be clearly seen with a task like:
When run, this task will break on the first error, reported as:
line 0 col 0 Bad option: 'verbose'. (E001)
Note that it includes the error code, which is only provided when the JSHint command is run with --verbose (I use the stylish reporter in this case because it's verbose output is very easy to identify concisely). This shows that Grunt is correctly appending its task.options to the command being run, in this case --verbose.
This behavior can also be seen by using a .jshintrc file, as the options are no longer passed to the linter, so the verbose flag can be passed to grunt as expected. Because of the behavior of the .jshintrc option, however, it is currently not possible to run in verbose mode and override options in a subtask simultaneously.
While i encountered this when attempting to run in verbose mode, this will also be the case for any flag not explicitly supported by grunt-contrib-jshint (http://www.jshint.com/docs/cli/)
Proposed Solutions
The text was updated successfully, but these errors were encountered: