Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update prettier and clang-format cli options in format.py #2576

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
alias b := build
alias t := test
alias f := format

default:
@just --list
Expand All @@ -26,3 +27,6 @@ test *args="//...":

test-asan *args="//...":
just test {{args}} --config=asan

format:
python3 tools/cross/format.py
7 changes: 3 additions & 4 deletions tools/cross/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def filter_files_by_exts(


def clang_format(files: List[str], check: bool = False) -> bool:
cmd = [CLANG_FORMAT, "--verbose"]
cmd = [CLANG_FORMAT]
if check:
cmd += ["--dry-run", "--Werror"]
else:
Expand All @@ -95,7 +95,7 @@ def clang_format(files: List[str], check: bool = False) -> bool:


def prettier(files: List[str], check: bool = False) -> bool:
cmd = [PRETTIER]
cmd = [PRETTIER, "--log-level=warn"]
if check:
cmd.append("--check")
else:
Expand Down Expand Up @@ -164,10 +164,9 @@ class FormatConfig:
),
FormatConfig(
directory="src",
extensions=(".js", ".ts", ".cjs", ".ejs", ".mjs"),
extensions=(".js", ".ts", ".cjs", ".ejs", ".mjs", ".json"),
formatter=prettier,
),
FormatConfig(directory="src", extensions=(".json",), formatter=prettier),
FormatConfig(directory=".", extensions=(".py",), formatter=ruff),
# TODO: lint bazel files
]
Expand Down
Loading