SVP SVP - 2 years ago 210
Node.js Question

eslint --fix not working when running by npm

eslint --fix option is not working when i run it through npm. Here is my package.json scripts

"start": "nodemon ./server.js --exec babel-node",
"lint": "eslint ./data/* --format html --output-file ./finalresult.html --fix ; exit 0"

when I run it using command npm run lint report is generating but without fixing. But if I am running the same command

eslint ./data/* --format html --output-file ./finalresult.html --fix

from console it is generating report after fix.Why is it so? Am I doing anything wrong? Can Anyone please help me

Answer Source

Check the version of the eslint in your local and global node_modules.

When we run from command line, the global eslint executes while npm uses the one in local node_modules.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download