From 572f48c345bd07d476f90b488e0dcd397d10402c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Gris?= Date: Mon, 29 Dec 2025 17:24:41 +0100 Subject: [PATCH] feat(spotless): prettier json Normalizes json files matching: - `src/**/mcmod.info` - `src/**/*.json` - `src/**/*.mcmeta` Processes only changed files from `origin/master`. Normalizations: - Indent with 2 spaces - Preserves collapsed objects/arrays on same line when it does not exceed 100 chars - Uses unix newline LF - Ends file with a newline character Sample diffs: ```diff --- a/src/main/resources/assets/gtnhintergalactic/textures/items/drones/MiningDroneUMV.png.mcmeta +++ b/src/main/resources/assets/gtnhintergalactic/textures/items/drones/MiningDroneUMV.png.mcmeta @@ -1 +1 @@ -{"animation": {"frametime": 3}} +{ "animation": { "frametime": 3 } } ``` ```diff --- a/src/main/resources/assets/gregtech/textures/blocks/iconsets/BLOCK_SIXPHASEDCOPPER.png.mcmeta +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/BLOCK_SIXPHASEDCOPPER.png.mcmeta @@ -1 +1 @@ -{ "animation": { "frametime": 1, "frames": [ 0, 1, 0, 1, 0, { "index": 2, "time": 75 } ] } } \ No newline at end of file +{ "animation": { "frametime": 1, "frames": [0, 1, 0, 1, 0, { "index": 2, "time": 75 }] } } ``` ```diff --- a/src/main/resources/assets/gtnhintergalactic/textures/blocks/spaceElevator/cable/CableLightBlinking24.pn> +++ b/src/main/resources/assets/gtnhintergalactic/textures/blocks/spaceElevator/cable/CableLightBlinking24.pn> @@ -1,5 +1,4 @@ - - { - "animation": { - "frames": [ - { +{ + "animation": { + "frames": [ + { @@ -8,2 +7,2 @@ - }, - { + }, + { @@ -12,2 +11,2 @@ - }, - { + }, + { @@ -16,5 +15,4 @@ - } - ] - } - } - \ No newline at end of file + } + ] + } +} ``` --- gtnhShared/spotless.gradle | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gtnhShared/spotless.gradle b/gtnhShared/spotless.gradle index c2de74d3..71697884 100644 --- a/gtnhShared/spotless.gradle +++ b/gtnhShared/spotless.gradle @@ -37,4 +37,23 @@ spotless { scalafmt('3.7.15') } + json { + ratchetFrom 'origin/master' // only format files which have changed since origin/master + + target( + 'src/**/mcmod.info', + 'src/**/*.json', + 'src/**/*.mcmeta' + ) + + prettier().config([ + parser: 'json', + printWidth: 100, + tabWidth: 2, + objectWrap: "collapse", + useTabs: false, + endOfLine: 'lf' + ]) + endWithNewline() + } }