【发布时间】:2016-04-07 21:45:44
【问题描述】:
我可以使用 nodemon 来检查我的 javascript 吗?我没有使用任何构建工具,例如gulp 或 grunt 并希望最大限度地利用 node 和 npm。
The output from nodemon can be piped。我想用它来使用 eslint 对更改的文件进行 linting。
这是我的 package.json
{
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "nodemon server.js",
"lint": "eslint"
},
"dependencies": {
"MD5": "*",
"clean-css": "*",
"express": "~4.9.0",
"express-handlebars": "~2.0.1",
"express-redis-cache": "*",
"foundation-sites": "~5.5.3",
"fs-extra": "~0.8.1",
"node-rest-client": "~1.5.1",
"node-sass": "*",
"path": "*"
},
"devDependencies": {
"babel-eslint": "^4.1.6",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^2.1.1",
"eslint-config-airbnb-es5": "^1.0.8",
"eslint-plugin-react": "^3.13.1",
"nodemon": "~1.8.1",
"parallelshell": "~2.0.0",
"watch": "~0.17.1"
}
}
我试过这个。但它不起作用。它给出了错误。
"scripts": {
"start": "nodemon({ script: 'server.js' }).on('restart', function () {console.log('nodemon started');}).on('crash', function () {console.log('script crashed for some reason');});",
"lint": "eslint"
},
【问题讨论】:
-
您是否有任何特殊原因要在运行时使用进程管理器而不是直接通过文本编辑器执行 linting?
标签: javascript node.js npm nodemon eslint