PHPStorm keeps adding a trailing comma to composer.json line

I have an odd one. For some reason PHPStorm is adding a trailing comma to my composer.json.

My composer.json with all the (hopefully) irrelevant stuff removed:

{
    "require": {
        "composer/installers": "^2.0",
        "cweagans/composer-patches": "^2@dev",
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "allow-plugins": {
            "cweagans/composer-patches": true
        },
        "sort-packages": true
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
            "drupal/module": {
                "desc": "https://www.drupal.org/files/issues/<date>/patchfile"

            }
        }
    }
}

Specifically, the `extra.patches.drupal/module[].desc` line. When I save the file, a comma is added at the end of the line. Which is invalid according to composer.

I couldn't find any trailing comma setting to turn off in the code style settings. I also tried turning off and on prettier, eslint, and a few other similar settings. 

I don't have any file watches on for json files, so I shouldn't have anything outside of PHPStorm modifying the file.

I tried modifying a couple of the default Drupal 10 dot files to, I think, disable trailing commas, but none of those settings made any difference. And I'd think they'd only apply if I was running eslint or prettier, and since both are disabled…

Annoyingly I remember having this issue a while back, but so far my searches haven't turned up anything.

Ultimately I just modified the file in a different app, but I'd really rather not have this issue popping up…

Anyone have any ideas?

PHPStorm version: 2024.2.0.1 on Ubuntu linux.

 

1

Please sign in to leave a comment.