Skip to content

Commit 02cca3c

Browse files
committed
Fix bug with --list for already formatted files
It's supposed to just output nothing if jsfmt would not modify the file. It was cascading down to the final else, and dumping the file to STDOUT instead.
1 parent 1228b57 commit 02cca3c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/run.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ function handleJavascript(fullPath, original) {
148148

149149
if (argv['--diff']) {
150150
handleDiff(fullPath, original, js);
151-
} else if (argv['--list'] && original != js) {
151+
} else if (argv['--list']) {
152152
// Print filenames who differ
153-
console.log(relativePath);
153+
if(original != js) {
154+
console.log(relativePath);
155+
}
154156
} else if (argv['--write']) {
155157
// Overwrite original file
156158
fs.writeFileSync(fullPath, js);

0 commit comments

Comments
 (0)