Bug 38546 - prettierrc should set tabWidth and useTabs
Summary: prettierrc should set tabWidth and useTabs
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Victor Grousset/tuxayo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-28 14:51 UTC by Jonathan Druart
Modified: 2025-01-07 14:49 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes Koha's Prettier code formatter configuration file (.prettierrc.js) to set the default indentation to four spaces.
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38546: Set tabWidth and useTabs in prettierrc (744 bytes, patch)
2024-11-28 14:52 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 38546: Set tabWidth and useTabs in prettierrc (790 bytes, patch)
2024-12-24 16:58 UTC, David Nind
Details | Diff | Splinter Review
Bug 38546: Set tabWidth and useTabs in prettierrc (848 bytes, patch)
2025-01-02 17:41 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2024-11-28 14:51:45 UTC
We don't even have the default indentation set to 4 spaces.
Comment 1 Jonathan Druart 2024-11-28 14:52:30 UTC
Created attachment 175017 [details] [review]
Bug 38546: Set tabWidth and useTabs in prettierrc
Comment 2 Jonathan Druart 2024-12-04 13:35:17 UTC
Test plan:
For vi, visual mode, select a block a JS code (in .js or template) and run `!prettier --parser typescript`

With this patch applied the 4-spaces indentation is preserved.
Comment 3 David Nind 2024-12-24 16:58:53 UTC
Created attachment 175935 [details] [review]
Bug 38546: Set tabWidth and useTabs in prettierrc

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2024-12-24 17:06:11 UTC
Testing notes (using KTD):
1. I tested using this file to test the change: koha-tmpl/intranet-tmpl/js/i18n.js
2. To get into visual mode to select text with the down arrow key, press v
3. The block of text I selected was correctly reformatted to use four spaces for indentation (I selected a block a JS code and ran `!prettier --parser typescript`)
Comment 5 Victor Grousset/tuxayo 2025-01-02 17:41:20 UTC
Created attachment 176097 [details] [review]
Bug 38546: Set tabWidth and useTabs in prettierrc

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 6 Victor Grousset/tuxayo 2025-01-02 17:57:52 UTC
Works (on js, ts and vue files), makes sense, QA script happy, code looks good, passing QA :)


Prettier --write was already honoring 4 space indentation.
Somehow it was running from vi/vim that didn't.
Comment 7 Katrin Fischer 2025-01-07 14:49:16 UTC
Pushed for 25.05!

Well done everyone, thank you!