0

when running ng serve the angular cli watches for changes and recompiles the project. For me it would be helpful if ng lint could be run on a filechange as well. Of course it would be gread if only the changed file gets checked.

MarcS82
  • 1,511
  • 3
  • 19
  • 36

1 Answers1

1

You can define an additional npm script with a watch using nodemon for this.

Install nodemon npm package globally npm i -g nodemon or in your project npm i --save-dev nodemon Define the npm script in package.json (under "scripts"): `

"lint:watch": "nodemon --exec \"npm run lint || exit 1\" --ext ts,html,scss"

Define another script "serve-lint": "npm run serve && npm run lint:watch"

Run npm run serve-lint

Angular-CLI Serve with Lint Watch

Owen Kelvin
  • 12,127
  • 6
  • 32
  • 59