csscomb / csscomb.js

CSS coding style formatter
http://csscomb.com/
MIT License
3.28k stars 460 forks source link

SCSS: exception and hang with scss variables #617

Open rdw opened 4 years ago

rdw commented 4 years ago

repro.scss:

.a-class-name {
  $c: 1;
  $d: 2;
}

.csscomb.json:

{
  "sort-order": ["..."],
  "sort-order-fallback": "abc"
}

Running csscomb with this combination gives the following exception:

(node:1796) UnhandledPromiseRejectionWarning: TypeError: a.match is not a function
    at Plugin._sortLeftovers (./node_modules/csscomb/lib/options/sort-order.js:365:11)
    at nodes.sort (./node_modules/csscomb/lib/options/sort-order.js:394:21)
    at Array.sort (native)
    at Array.sort (./node_modules/csscomb/node_modules/core-js/modules/es6.array.sort.js:21:15)
    at Plugin._sortNodes (./node_modules/csscomb/lib/options/sort-order.js:387:11)
    at Plugin._processBlock (./node_modules/csscomb/lib/options/sort-order.js:313:10)
    at ./node_modules/gonzales-pe/lib/gonzales.js:312:41
    at Node.traverse (./node_modules/gonzales-pe/lib/gonzales.js:292:6)
    at Node.traverse (./node_modules/gonzales-pe/lib/gonzales.js:297:36)
    at Node.traverse (./node_modules/gonzales-pe/lib/gonzales.js:297:36)
(node:1796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and the process then hangs.

Using csscomb 4.3.0, gonzales-pe 4.2.4, node 8.12.0