如何在 Grunt 中使用 stylelint?

How to use stylelint with Grunt?

我正在尝试替换 grunt-scss-lint (because of its Ruby dependency and silent failure when you don't have the gem installed) with stylelint

我 运行 遇到的问题是以下错误:

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

我认为这是因为 stylelint(它是一个 PostCSS 插件,而不是一个 G运行t 插件)需要 ES6。

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

有什么方法可以让这个工作,我可以 运行 grunt 而不是一些奇怪的解决方法 like this

看来您只需要升级您的 Node.js 版本即可。如果您 运行 0.12 或更高版本,您应该不会遇到地图问题。 (在 0.12+ 中不需要使 "weird workaround" 怪异的 --harmony 标志。)

Node 安装独立于 G运行t。 运行 node -v 看看那里有什么。如果您需要升级,只需使用 nodejs.org 获取最新版本。