-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix problem of not loading jshintrc file when not supplied options.
- Loading branch information
1 parent
597c9a6
commit cdc5d5d
Showing
7 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"boss": true, | ||
"eqnull": true, | ||
"node": true, | ||
"es5": true | ||
"maxparams": 3 | ||
} | ||
|
||
/* foo */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* exceeded maxparams(3) | ||
*/ | ||
function foo(a, b, c, d) { | ||
return a + b + c + d; | ||
} | ||
|
||
foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
/** | ||
* #182 the default behavior of JSHint is to look for ".jshintsrc" up the processed file's hierarchy. | ||
* The difference between `.jshintrc` and `test/fixtures/.jshintrc` is maxparams. | ||
* if jshint finds `test/fixtures/.jshintrc` then a maxparams error should occur. | ||
*/ | ||
var fs = require('fs-extra'), | ||
linter = require('../../lib/reporters/jshint'); | ||
|
||
exports['issue_182'] = { | ||
setUp: function(done) { | ||
done(); | ||
}, | ||
|
||
'look for ".jshintsrc" up the processed file hierarchy': function(test) { | ||
|
||
var file = "test/fixtures/issue_182.js", | ||
source = fs.readFileSync(file).toString().trim(), | ||
options = {}, | ||
reportInfo = { | ||
file : 'test/fixtures/issue_182.js', | ||
fileShort : '', | ||
fileSafe : '', | ||
link : '' | ||
}, | ||
report; | ||
|
||
report = linter.process(source, options, reportInfo); | ||
test.equal(report.messages.length, 1, "a maxparams error should occur"); | ||
|
||
report = linter.process(source, options, {}); | ||
test.equal(report.messages.length, 0, "no error"); | ||
|
||
test.done(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters