From a80a267cffd63081dde9ceefb76be4563866d0ac Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 23 Oct 2021 15:48:33 +1000 Subject: [PATCH] //ts:format now runs on current working directory, instead of entire repo --- docs/development.md | 24 +++++++++++++++--------- ts/format.sh | 5 +---- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/development.md b/docs/development.md index 1bca914c7..c5df2ed84 100644 --- a/docs/development.md +++ b/docs/development.md @@ -125,8 +125,21 @@ each file save automatically with: ## Fixing formatting -If the format tests fail, most can be fixed by running `format` -in the relevant package: +For formatting issues with .ts, .svelte and .md files, change to the folder +that's causing the problem, and then run + +``` +bazel run //ts:format +``` + +For other packages, change to the folder and run + +``` +bazel run format +``` + +For the latter cases, you can also invoke the formatter from another folder by using +the full path: ``` bazel run //rslib:format @@ -134,16 +147,9 @@ bazel run //rslib:sql_format bazel run //proto:format bazel run //pylib:format bazel run //qt:format -bazel run //ts:format bazel run //pylib/rsbridge:format ``` -If you're in one of those folders, you can use the short form: - -``` -bazel run format -``` - ## Development speedups If you're frequently switching between Anki versions, you can create diff --git a/ts/format.sh b/ts/format.sh index 816699524..2cd4f1a55 100755 --- a/ts/format.sh +++ b/ts/format.sh @@ -1,7 +1,4 @@ # this is a hack to invoke prettier directly from Bazel (cd "${BUILD_WORKSPACE_DIRECTORY}" && node_modules/.bin/prettier \ --config .prettierrc --write \ - ts \ - qt/aqt/data/web/js \ - docs \ - ) + $BUILD_WORKING_DIRECTORY )