1111
1212const { astHelpers } = require ( '../util/stylesheet' ) ;
1313
14- const { getStyleDeclarations, isStyleSheetDeclaration } = astHelpers ;
14+ const {
15+ getStyleDeclarations,
16+ getStylePropertyIdentifier,
17+ isStyleSheetDeclaration,
18+ } = astHelpers ;
1519
1620//------------------------------------------------------------------------------
1721// Rule Definition
@@ -25,8 +29,8 @@ module.exports = (context) => {
2529 const isValidOrder = order === 'asc' ? ( a , b ) => a <= b : ( a , b ) => a >= b ;
2630
2731 function report ( type , node , prev , current ) {
28- const currentName = current . key . name ;
29- const prevName = prev . key . name ;
32+ const currentName = getStylePropertyIdentifier ( current ) ;
33+ const prevName = getStylePropertyIdentifier ( prev ) ;
3034 context . report ( {
3135 node,
3236 message : `Expected ${ type } to be in ${ order } ending order. '${ currentName } ' should be before '${ prevName } '.` ,
@@ -43,7 +47,10 @@ module.exports = (context) => {
4347 return ;
4448 }
4549
46- if ( ! isValidOrder ( previous . key . name , current . key . name ) ) {
50+ const prevName = getStylePropertyIdentifier ( previous ) ;
51+ const currentName = getStylePropertyIdentifier ( current ) ;
52+
53+ if ( ! isValidOrder ( prevName , currentName ) ) {
4754 return report ( arrayName , node , previous , current ) ;
4855 }
4956 }
0 commit comments