Skip to content

Commit

Permalink
update prettier cli options in format.py
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Aug 21, 2024
1 parent 8640269 commit 793a098
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/cross/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,13 @@ def clang_format(files: List[str], check: bool = False) -> bool:
def prettier(files: List[str], check: bool = False) -> bool:
cmd = [PRETTIER]
if check:
cmd.append("--check")
# This flag will only print files that require formatting
# and change exit code of the process depending on state.
cmd.append("--list-different")
else:
cmd.append("--write")
# This will only print files that requires formatting.
cmd.append("--log-level=warn")
result = subprocess.run(cmd + files)
return result.returncode == 0

Expand Down

0 comments on commit 793a098

Please sign in to comment.