admin管理员组文章数量:1355697
I'm setting up stylelint for a project, everything works as expected when run from the cli:
$ stylelint 'css/**/*.css' --fix
css/style.css
20:18 × Expected newline after ":" with a multi-line declaration declaration-colon-newline-after
...
...
However, when run as an npm script
no output appears (beyond logging the mand) and the errors seem to be ignored:
$ npm run stylelint
> project lint:css path/project
> stylelint 'css/**/*.css' --fix
package.json
"scripts": {
...
"stylelint": "stylelint 'css/**/*.css' --fix"
},
Any idea how to get the console output AND exit on errors when stylelint is run as an npm script?
I'm setting up stylelint for a project, everything works as expected when run from the cli:
$ stylelint 'css/**/*.css' --fix
css/style.css
20:18 × Expected newline after ":" with a multi-line declaration declaration-colon-newline-after
...
...
However, when run as an npm script
no output appears (beyond logging the mand) and the errors seem to be ignored:
$ npm run stylelint
> project lint:css path/project
> stylelint 'css/**/*.css' --fix
package.json
"scripts": {
...
"stylelint": "stylelint 'css/**/*.css' --fix"
},
Any idea how to get the console output AND exit on errors when stylelint is run as an npm script?
Share Improve this question edited Aug 22, 2018 at 19:44 Vinnie James asked Aug 22, 2018 at 19:35 Vinnie JamesVinnie James 6,0726 gold badges46 silver badges54 bronze badges 2-
It actually seems
> stylelint 'css/**/*.css' --fix
doesnt run at all vianpm
regardless of the fact it logs out to the console – Vinnie James Commented Aug 22, 2018 at 20:00 -
The issue is with the globstar pattern, as
"stylelint": "stylelint 'css/file.css' --fix"
runs as expected via npm – Vinnie James Commented Aug 22, 2018 at 20:07
2 Answers
Reset to default 10The issue turned out to be the quotes around the globstar pattern. Most other scripts allow you to wrap the globstar in single quotes '
, however stylelint seems to require escaped double quotes:
"stylelint": "stylelint \"src/**/*.css\" --fix"
Seems like appending ; exit 0
also does the trick:
"stylelint": "stylelint 'css/**/*.css' --fix; exit 0"
本文标签: javascriptStylelint failing silently as npm scriptStack Overflow
版权声明:本文标题:javascript - Stylelint failing silently as npm script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744031082a2578919.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论