Skip to content

Commit ec51d18

Browse files
pattyjogalsindresorhus
authored andcommitted
Make --stdin --fix always return the code even if nothing was fixed (#383)
1 parent 21e7b57 commit ec51d18

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cli-main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ if (options.init) {
159159
} else if (options.stdin) {
160160
getStdin().then(stdin => {
161161
if (options.fix) {
162-
console.log(xo.lintText(stdin, options).results[0].output);
162+
const result = xo.lintText(stdin, options).results[0];
163+
// If there is no output, pass the stdin back out
164+
console.log(result.output || stdin);
163165
return;
164166
}
165167

0 commit comments

Comments
 (0)