Skip to content

Commit 112c947

Browse files
committed
Update exit code for scenarios that call showHelp to return 2 (linting not completed) instead of 1 (linting completed with errors).
1 parent 20013e4 commit 112c947

8 files changed

+11
-11
lines changed

markdownlint-cli2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ const main = async (params) => {
862862
);
863863
if ((globPatterns.length === 0) && !nonFileContents) {
864864
showHelp(logMessage);
865-
return 1;
865+
return 2;
866866
}
867867
// Include any file overrides or non-file content
868868
const resolvedFileContents = {};

test/markdownlint-cli2-test-cases.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ const testCases =
118118
testCase({
119119
"name": "no-arguments",
120120
"args": [],
121-
"exitCode": 1,
121+
"exitCode": 2,
122122
"cwd": "no-config"
123123
});
124124

125125
testCase({
126126
"name": "no-arguments-fix",
127127
"script": "markdownlint-cli2-fix.js",
128128
"args": [],
129-
"exitCode": 1,
129+
"exitCode": 2,
130130
"cwd": "no-config",
131131
"usesScript": true
132132
});
@@ -135,7 +135,7 @@ const testCases =
135135
"name": "no-arguments-config",
136136
"script": "markdownlint-cli2-config.js",
137137
"args": [],
138-
"exitCode": 1,
138+
"exitCode": 2,
139139
"cwd": "no-config",
140140
"usesScript": true
141141
});
@@ -144,7 +144,7 @@ const testCases =
144144
"name": "one-argument-config",
145145
"script": "markdownlint-cli2-config.js",
146146
"args": [ "../config-files/cfg/.markdownlint-cli2.jsonc" ],
147-
"exitCode": 1,
147+
"exitCode": 2,
148148
"cwd": "no-config",
149149
"usesScript": true
150150
});

test/snapshots/markdownlint-cli2-test-exec.js.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
99
> Snapshot 1
1010
1111
{
12-
exitCode: 1,
12+
exitCode: 2,
1313
formatterCodeQuality: '',
1414
formatterJson: '',
1515
formatterJunit: '',
@@ -59,7 +59,7 @@ Generated by [AVA](https://avajs.dev).
5959
> Snapshot 1
6060
6161
{
62-
exitCode: 1,
62+
exitCode: 2,
6363
formatterCodeQuality: '',
6464
formatterJson: '',
6565
formatterJunit: '',
@@ -109,7 +109,7 @@ Generated by [AVA](https://avajs.dev).
109109
> Snapshot 1
110110
111111
{
112-
exitCode: 1,
112+
exitCode: 2,
113113
formatterCodeQuality: '',
114114
formatterJson: '',
115115
formatterJunit: '',
@@ -159,7 +159,7 @@ Generated by [AVA](https://avajs.dev).
159159
> Snapshot 1
160160
161161
{
162-
exitCode: 1,
162+
exitCode: 2,
163163
formatterCodeQuality: '',
164164
formatterJson: '',
165165
formatterJunit: '',
Binary file not shown.

test/snapshots/markdownlint-cli2-test-fs.js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
99
> Snapshot 1
1010
1111
{
12-
exitCode: 1,
12+
exitCode: 2,
1313
formatterCodeQuality: '',
1414
formatterJson: '',
1515
formatterJunit: '',
3 Bytes
Binary file not shown.

test/snapshots/markdownlint-cli2-test-main.js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
99
> Snapshot 1
1010
1111
{
12-
exitCode: 1,
12+
exitCode: 2,
1313
formatterCodeQuality: '',
1414
formatterJson: '',
1515
formatterJunit: '',
Binary file not shown.

0 commit comments

Comments
 (0)