Scoped variables cause an error when sort-order is enabled
See original GitHub issue.form {
$foo: #fff;
$bar: #fff;
}
Produces:
TypeError: a.match is not a function
at sortLeftovers (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb/lib/options/sort-order.js:244:19)
at /Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb/lib/options/sort-order.js:334:24
at Array.sort (native)
at module.exports.process (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb/lib/options/sort-order.js:325:16)
at Object.Node.map (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/gonzales-pe/lib/node.js:111:9)
at /Users/gajus/Documents/dev/gajus/pragmatist/node_modules/gonzales-pe/lib/node.js:117:22
at Array.forEach (native)
at Object.Node.map (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/gonzales-pe/lib/node.js:115:22)
at /Users/gajus/Documents/dev/gajus/pragmatist/node_modules/gonzales-pe/lib/node.js:117:22
at Array.forEach (native)
at Object.Node.map (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/gonzales-pe/lib/node.js:115:22)
at /Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb-core/lib/core.js:132:18
at Array.forEach (native)
at Object.processTree (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb-core/lib/core.js:131:19)
at processString (/Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb-core/lib/core.js:523:22)
at /Users/gajus/Documents/dev/gajus/pragmatist/node_modules/csscomb-core/lib/core.js:449:38
I did a bit of debugging:
This is sortLeftovers
function from sort-order.js
that triggers the error.
var sortLeftovers = function(a, b) {
var prefixes = ['-webkit-', '-moz-', '-ms-', '-o-', ''];
var prefixesRegExp = /^(-webkit-|-moz-|-ms-|-o-)(.*)$/;
// Get property name (i.e. `color`, `-o-animation`):
a = a.node.get(0).get(0).content;
b = b.node.get(0).get(0).content;
console.log(a, b);
The output of console.log
is:
[ { type: 'ident', content: 'foo', start: { line: 2, column: 6 } } ]
[ { type: 'ident', content: 'bar', start: { line: 3, column: 6 } } ]
<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29843200-scoped-variables-cause-an-error-when-sort-order-is-enabled?utm_campaign=plugin&utm_content=tracker%2F214563&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F214563&utm_medium=issues&utm_source=github).
</bountysource-plugin>Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
'sortBook' was not declared in this scope - c++ - Stack Overflow
I think it's just that you have not declared sortBook function anywhere and trying to use it.
Read more >Variables and Scope – A Primer for Computational Biology
This error occurs because variables have scope, and the gc variable's scope is limited, from the time it is defined to the end...
Read more >Variable Scope | Fix error: 'yourVariable' was not declared in ...
Are you getting the error: 'YourVariable' was not declared in this scope? What is variable scope anyway? Arduino not declared in variable scope...
Read more >Scope of Variables in C++ - GeeksforGeeks
The above program displays an error saying “age was not declared in this scope”. The variable age was declared within the function func()...
Read more >Scope of Variables - Julia Documentation
The scope of a variable is the region of code within which a variable is accessible. Variable scoping helps avoid variable naming conflicts....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For me this isn’t fixed. Still get this issue when I use variables or at-rules. 😕
hey @jdalton thanks for fixing the issue. any idea when this will be published?