postcss-less: Problems on parsing root mixins with parameters with Stylelint
I managed to scope this problem out to a compatibility issue with Stylelint. This is the code:
.foo() {
color: #fff;
}
This works with Stylelint. However if I use parameters:
.foo(@bar) {
color: @bar;
}
This immediately returns an error:
TypeError: this[node.type] is not a function
at Stringifier.stringify (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringifier.js:33:24)
at stringify (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringify.js:14:9)
at AtRule.toString (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/node.js:97:9)
at Array.toString (native)
at Stringifier.atrule (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringifier.js:74:35)
at Stringifier.stringify (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringifier.js:33:24)
at Stringifier.body (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringifier.js:93:18)
at Stringifier.root (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringifier.js:37:14)
at Stringifier.stringify (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringifier.js:33:24)
at stringify (/Volumes/g/repos/gaf-stylelint/node_modules/postcss/lib/stringify.js:14:9)
I’ve tested this on both gulp-postcss and PostCSS’s Node API and both returns the same thing when Stylelint is added to the mix. mixinsAsAtRules and innerMixinsAsRules is already set to true.
Also if you change the mixin from a root mixin to be scoped inside another block, the error goes away.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (11 by maintainers)
I was about to suggest the same thing. We need a stylelint focused fork of postcss-less going forward. It just makes more sense because I would like to support the full less syntax here but that means either waiting for stylelint to properly handle things or adding in compatibility hacks as we have been doing.