File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
11
11
12
12
### Removed
13
13
14
+ ## [ 2.1.0] - 2017-04-09
15
+ ### Changed
16
+ - CLI process exit code to 2 (non-zero) if issues are detected in the scan
17
+
14
18
## [ 2.0.2] - 2017-02-18
15
19
### Fixed
16
20
- Issue .npmpackagejsonlintrc.json files that only have a extends value with no rules object
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " npm-package-json-lint" ,
3
- "version" : " 2.0.2 " ,
3
+ "version" : " 2.1.0 " ,
4
4
"description" : " CLI app for linting package.json files." ,
5
5
"keywords" : [
6
6
" lint" ,
33
33
"validator" : " ^6.2.1"
34
34
},
35
35
"devDependencies" : {
36
- "eslint" : " ^3.15 .0" ,
37
- "eslint-config-tc" : " ^1.4 .0" ,
38
- "eslint-formatter-pretty" : " ^1.0 .0" ,
36
+ "eslint" : " ^3.19 .0" ,
37
+ "eslint-config-tc" : " ^1.5 .0" ,
38
+ "eslint-formatter-pretty" : " ^1.1 .0" ,
39
39
"grunt" : " ^1.0.1" ,
40
40
"grunt-bump" : " ^0.8.0" ,
41
41
"grunt-contrib-clean" : " ^1.0.0" ,
48
48
"grunt-jsonlint" : " ^1.1.0" ,
49
49
"grunt-mocha-test" : " ^0.13.2" ,
50
50
"mocha" : " ^3.2.0" ,
51
- "should" : " ^11.2.0 " ,
51
+ "should" : " ^11.2.1 " ,
52
52
"sinon" : " ^1.17.7" ,
53
53
"time-grunt" : " ^1.4.0"
54
54
},
Original file line number Diff line number Diff line change @@ -80,23 +80,29 @@ if (!rulesLoaded) {
80
80
let fileData = null ;
81
81
82
82
try {
83
+ let exitCode = 0 ;
84
+ const noIssues = 0 ;
85
+ const issuesDetectedErrorCode = 2 ;
83
86
const parser = new Parser ( ) ;
84
87
85
88
fileData = parser . parse ( filePath ) ;
86
89
87
90
const npmPackageJsonLint = new NpmPackageJsonLint ( fileData , rulesConfig , options ) ;
88
91
const output = npmPackageJsonLint . lint ( ) ;
89
-
90
92
const reporter = new Reporter ( ) ;
91
93
92
94
for ( const issueType in output ) {
93
95
const issues = output [ issueType ] ;
94
96
95
- reporter . write ( output [ issueType ] , issueType ) ;
97
+ if ( issues . length > noIssues ) {
98
+ exitCode = issuesDetectedErrorCode ;
99
+ reporter . write ( output [ issueType ] , issueType ) ;
100
+ }
96
101
}
97
102
98
103
const formattedFileName = chalk . bold . green ( filePath ) ;
99
104
105
+ process . exitCode = exitCode ;
100
106
console . log ( `${ formattedFileName } check complete` ) ;
101
107
} catch ( err ) {
102
108
handleError ( err ) ;
You can’t perform that action at this time.
0 commit comments