Skip to content

Commit e974665

Browse files
authored
Patch for exit code when only warnings are detected (#28)
Fixes #25
1 parent 3d4e061 commit e974665

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
### Removed
1313

14+
## [2.1.1] - 2017-04-10
15+
### Fixed
16+
- CLI so process exit code remains 0 if only warnings are detected
17+
1418
## [2.1.0] - 2017-04-09
1519
### Changed
1620
- CLI process exit code to 2 (non-zero) if issues are detected in the scan

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ First thing first, let's make sure you have the necessary pre-requisites.
4848
| pjl-cli --file <file path> | -f | File path including name. Defaults to package.json |
4949
| pjl-cli --rule <rule name> | -r | Valid rule name to check. Defaults to nothing |
5050
| pjl-cli --rules-file <file path> | -c | File path of .npmpackagejsonlintrc |
51+
| pjl-cli --rule-severity <rule severity> | -s | "error" or "warning". Defaults to "error" |
5152
| pjl-cli --ignore-warnings | -w | Ignore warnings |
5253

5354
### Examples

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "npm-package-json-lint",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "CLI app for linting package.json files.",
55
"keywords": [
66
"lint",

src/cli.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ try {
9494
for (const issueType in output) {
9595
const issues = output[issueType];
9696

97-
if (issues.length > noIssues) {
97+
if (issues.length > noIssues && issueType === 'errors') {
9898
exitCode = issuesDetectedErrorCode;
99-
reporter.write(output[issueType], issueType);
10099
}
100+
101+
reporter.write(output[issueType], issueType);
101102
}
102103

103104
const formattedFileName = chalk.bold.green(filePath);

0 commit comments

Comments
 (0)