magento-coding-standard
magento-coding-standard copied to clipboard
[eslint] Require trailing commas where useful
This is a small part of https://github.com/magento/magento-coding-standard/pull/347 as suggested in https://github.com/magento/magento-coding-standard/pull/347#issuecomment-999512251.
https://eslint.org/docs/rules/comma-dangle
Including a trailing comma when the closing ] or } is on a different line means that it's easier to see what's changed when reviewing code. Adding a new item to an array or property to an object means that only the new line needs to be added, and no existing lines need to be modified; removing an item or property means that only that line needs to be removed with others remaining unchanged.