Bug 38546

Summary: prettierrc should set tabWidth and useTabs
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Victor Grousset/tuxayo <victor>
Severity: normal    
Priority: P5 - low CC: david, paul.derscheid, victor
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: 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
Bug 38546: Set tabWidth and useTabs in prettierrc
Bug 38546: Set tabWidth and useTabs in prettierrc

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!