Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use stylelint with Grunt?

I'm trying to replace grunt-scss-lint (because of its Ruby dependency and silent failure when you don't have the gem installed) with stylelint.

The problem I'm running into is the following error:

$ grunt                                                                        
Loading "Gruntfile.js" tasks...ERROR
>> ReferenceError: Map is not defined

I assume this is because stylelint (which is a PostCSS plugin, not a Grunt plugin) requires ES6.

Here's the code that's throwing the Map is not defined error.

Is there any way to get this to work where I can just run grunt and not some weird workaround like this?

like image 447
Trey Piepmeier Avatar asked Jul 30 '15 15:07

Trey Piepmeier


1 Answers

Looks like you just need to upgrade your version of Node. If you run 0.12 or higher, you shouldn't have troubles with Map. (The --harmony flag that makes that "weird workaround" weird is not required in 0.12+.)

The Node installation is independent of Grunt. Run node -v to see what's there. And if you need an upgrade, just use nodejs.org to get the latest.

like image 154
davidtheclark Avatar answered Sep 27 '22 16:09

davidtheclark