/** | |
* notabs.js | |
* | |
* A reporter that discards all warnings about mixed tabs and errors. | |
* This file was based on our default reporter so output is the same. | |
* | |
* Usage: | |
* jshint myfile.js --reporter=notabs.js | |
*/ | |
module.exports = { | |
reporter: function (results) { | |
var len = results.length; | |
var str = ""; | |
results.forEach(function (result) { | |
var file = result.file; | |
var error = result.error; | |
if (error.reason === "Mixed spaces and tabs.") { | |
return; | |
} | |
str += file + ': line ' + error.line + ', col ' + | |
error.character + ', ' + error.reason + '\n'; | |
}); | |
if (str) { | |
process.stdout.write(str + "\n" + len + ' error' + ((len === 1) ? '' : 's') + "\n"); | |
} | |
} | |
}; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
nym
commented
Oct 24, 2012
Why is this external to JSHint? It seems like a common request to supress mixed tabs and spaces. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
yuricamara
commented
Feb 27, 2013
Hi. How do I use it in Sublime Text 2 with SublimeLinter extension? Tks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
PatrickOsborne
commented
Mar 5, 2013
I agree this should just be a config option. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
jlgrall
Apr 5, 2013
There are 2 other solutions, choose the one that best suits your needs:
- set the option
smarttabs: true
to true. (http://www.emacswiki.org/emacs/SmartTabs) - set to ignore that specific warning, with the option
"-W099": true
(See: Ability to ignore any warnings.)
jlgrall
commented
Apr 5, 2013
There are 2 other solutions, choose the one that best suits your needs:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
mildmojo
Jun 22, 2013
Since it wasn't clear to me, @jlgrall's suggested options can be dropped into your ~/.jshintrc
config file or (I think) SublimeLinter's jshint_options
config block.
// .jshintrc
{
"smarttabs": true
}
// .jshintrc
{
"-W099": true
}
// SublimeLinter.sublime-settings
{
"jshint_options":
{
"-W099": true
}
}
mildmojo
commented
Jun 22, 2013
Since it wasn't clear to me, @jlgrall's suggested options can be dropped into your // .jshintrc
{
"smarttabs": true
} // .jshintrc
{
"-W099": true
} // SublimeLinter.sublime-settings
{
"jshint_options":
{
"-W099": true
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why is this external to JSHint? It seems like a common request to supress mixed tabs and spaces.