Can I use nodemon to lint my javascript? I am not using any build tool e.g. gulp or grunt and want to maximize the use of node and npm.
The output from nodemon can be piped. I want to use this for linting the changed file using eslint.
Here is my package.json
I tried this. But it doesn't work.It gives error.
"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"
},
You can use the exec
option of nodemon
to run your tests as you save code. Here's an example:
nodemon server.js --exec 'npm run test && node'
This will cause nodemon to run npm run test && node server.js
, and it won't start the server until all the tests have run successfully.