From e63b4b992723551101554c14e6d61ea52d40027d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 1 Jun 2023 11:11:26 +1000 Subject: [PATCH] Experiment with disabling prettier whitespace sensitivity Prettier by default tries to preserve whitespace around inline tags, which can prevent problems such as a space before the period in 'text.': https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting Unfortunately only standard HTML block elements are excluded from this behaviour, so all of our Svelte components are treated the same way, even if they are block-based, or used in a way where the extra whitespace doesn't matter. This makes the code somewhat harder to read. Changing this option does carry the risk that rogue spaces will creep into our UI in the future as code is formatted, but as there don't appear to be any such issues with this initial reformat, I think the improved readability may justify the relatively small risk. --- .dprint.json | 3 ++- ts/components/CheckBox.svelte | 5 ++++- ts/deck-options/AdvancedOptions.svelte | 19 ++++++++++++------ ts/deck-options/AudioOptions.svelte | 7 +++++-- ts/deck-options/BuryOptions.svelte | 10 +++++++--- ts/deck-options/DailyLimits.svelte | 10 +++++++--- ts/deck-options/DisplayOrder.svelte | 19 +++++++++++++----- ts/deck-options/EnumSelector.svelte | 6 +++--- ts/deck-options/HelpModal.svelte | 6 +++--- ts/deck-options/LapseOptions.svelte | 12 +++++++---- ts/deck-options/NewOptions.svelte | 13 ++++++++---- ts/deck-options/SaveButton.svelte | 17 ++++++++-------- ts/deck-options/TextInputModal.svelte | 18 ++++++++--------- ts/deck-options/TimerOptions.svelte | 8 ++++++-- ts/editor/NoteEditor.svelte | 6 +++--- ts/editor/PlainTextBadge.svelte | 4 +++- ts/editor/RichTextBadge.svelte | 4 +++- ts/editor/StickyBadge.svelte | 4 +++- ts/editor/editor-toolbar/BlockButtons.svelte | 20 +++++++++++++------ ts/editor/editor-toolbar/LatexButton.svelte | 6 +++--- ts/editor/image-overlay/FloatButtons.svelte | 12 ++++++++--- ts/editor/image-overlay/ImageOverlay.svelte | 5 +++-- ts/editor/image-overlay/SizeSelect.svelte | 8 ++++++-- .../mathjax-overlay/MathjaxButtons.svelte | 4 +++- ts/graphs/CardCounts.svelte | 5 ++++- ts/graphs/ReviewsGraph.svelte | 5 ++++- ts/image-occlusion/SideToolbar.svelte | 4 +++- ts/image-occlusion/Toast.svelte | 4 ++-- .../notes-toolbar/MoreTools.svelte | 4 +++- .../notes-toolbar/TextFormatting.svelte | 4 +++- ts/import-csv/Tags.svelte | 8 ++++---- ts/tag-editor/TagDeleteBadge.svelte | 6 +++--- ts/tag-editor/WithAutocomplete.svelte | 6 ++++-- .../TagsSelectedButton.svelte | 14 ++++++------- 34 files changed, 185 insertions(+), 101 deletions(-) diff --git a/.dprint.json b/.dprint.json index f23774ae9..00cf437b2 100644 --- a/.dprint.json +++ b/.dprint.json @@ -11,7 +11,8 @@ "trailingComma": "all", "printWidth": 88, "tabWidth": 4, - "semi": true + "semi": true, + "htmlWhitespaceSensitivity": "ignore" }, "includes": ["**/*.{ts,tsx,js,jsx,cjs,mjs,json,md,toml,svelte}"], "excludes": [ diff --git a/ts/components/CheckBox.svelte b/ts/components/CheckBox.svelte index aa5ddafa0..3038b86f4 100644 --- a/ts/components/CheckBox.svelte +++ b/ts/components/CheckBox.svelte @@ -6,7 +6,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let value: boolean; - +