From 10fba076d44c9e7e4328c20ebe11d06dfb438ce2 Mon Sep 17 00:00:00 2001 From: Adrien Foulon <6115458+Tofandel@users.noreply.github.com> Date: Fri, 28 Aug 2020 16:43:32 +0200 Subject: [PATCH] Fix case where property might be null --- lib/rules/property-sort-order.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/rules/property-sort-order.js b/lib/rules/property-sort-order.js index adbecbf2..854d2025 100644 --- a/lib/rules/property-sort-order.js +++ b/lib/rules/property-sort-order.js @@ -104,18 +104,20 @@ module.exports = { if (block) { block.forEach('declaration', function (dec) { - var prop = dec.first('property'), - name = prop.first('ident'); - - if (name) { - if (parser.options['ignore-custom-properties']) { - if (propertyCheckList.indexOf(name.content) !== -1) { + var prop = dec.first('property') || dec.first('customProperty'); + if (prop) { + var name = prop.first('ident'); + + if (name) { + if (parser.options['ignore-custom-properties']) { + if (propertyCheckList.indexOf(name.content) !== -1) { + properties[name.content] = prop; + } + } + else { properties[name.content] = prop; } } - else { - properties[name.content] = prop; - } } });