File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,19 @@ module.exports = function (options) {
52
52
try {
53
53
var errors = checker . checkString ( file . contents . toString ( ) , file . relative ) ;
54
54
var errorList = errors . getErrorList ( ) ;
55
- file . jscs = { success : true , errorCount : 0 , errors : [ ] } ;
55
+
56
+ file . jscs = {
57
+ success : true ,
58
+ errorCount : 0 ,
59
+ errors : [ ]
60
+ } ;
61
+
56
62
if ( errorList . length > 0 ) {
57
63
file . jscs . success = false ;
58
64
file . jscs . errorCount = errorList . length ;
59
65
file . jscs . errors = errorList ;
60
66
}
67
+
61
68
errorList . forEach ( function ( err ) {
62
69
out . push ( errors . explainError ( err , true ) ) ;
63
70
} ) ;
Original file line number Diff line number Diff line change @@ -32,17 +32,20 @@ gulp.task('default', function () {
32
32
A ` jscs ` object will be attached to the file object which can be used for custom error reporting. An example with one error might look like this:
33
33
34
34
``` js
35
- { success: false , // or true if no errors
36
- errorCount: 1 , // number of errors in the errors array
37
- errors: [ // an array of jscs error objects
38
- { filename: ' index.js' , // basename of the file
39
- rule: ' requireCamelCaseOrUpperCaseIdentifiers' , // jscs rule which triggered the error
40
- message: ' All identifiers must be camelCase or UPPER_CASE' , // error message returned by the rule
41
- line: 32 , // error line number
42
- column: 7 } // error column
43
- ]};
35
+ {
36
+ success: false , // or true if no errors
37
+ errorCount: 1 , // number of errors in the errors array
38
+ errors: [{ // an array of jscs error objects
39
+ filename: ' index.js' , // basename of the file
40
+ rule: ' requireCamelCaseOrUpperCaseIdentifiers' , // the rule which triggered the error
41
+ message: ' All identifiers must be camelCase or UPPER_CASE' , // error message
42
+ line: 32 , // error line number
43
+ column: 7 // error column
44
+ }]
45
+ };
44
46
```
45
47
48
+
46
49
## API
47
50
48
51
### jscs(options)
You can’t perform that action at this time.
0 commit comments