-
Notifications
You must be signed in to change notification settings - Fork 12k
Lint on build + serve #2551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
At least for me, the lint command is fired in my CI process. It's not possible to merge a branch whose CI is failing. Apart from that, I really don't want the lint to slow down the already very slow build or serve commands. (lint takes forever on large projects) Summed up, I don't only find this suggestion unnecessary, but also very disturbing. At least if this would be the default behaviour. |
We actually have I'm not too sure that I'd want linting running on all rebuilds though... it'd slow them down somewhat, which I think is suboptimal but maybe not everyone agrees on that. I'll label it as a discussion. |
I agree it shouldn’t be on by default. My suggestion is only that an option be added to enable linting on auto-rebuid. |
Hello there. Is there in the roadmap (or currently) a way to configure our own commands as the npm one's for the ng-cli? |
@fbobbio please open a new issue instead of asking questions on unrelated issues. |
I totally agree with @diminutivesloop, an option for |
Just to also add to this, I've seen some other Angular 2 / Webpack boilerplates have the linting results be shown in the browser console, that is extremely handy too (along with any compilation errors). |
I'd also be very interested in this - though for now I'll see if I can mimic what @christiandreher is doing. |
Alright, I see a fair amount of interest in it so I'll tag it for work instead of just discussion. It's not a high prio though. |
Totally agree! 👍 |
I'm running beta.24 of the cli and it seems to me, that |
Hmm I also noticed that running |
I noticed that in #4114 , the --lint option was removed from ng test. |
Heya, I have bad news. We don't intend to have it on build/serve for the same reasons as described in #4114. |
What about incremental linting? |
@filipesilva I understand why you would remove the Beside the fact people simply want this, the reasons listed in #4114 are not as relevant to the serve. I think having the option there and disabling it by default would be the best of both worlds. |
I would really appreciate having this built into |
Either NG Serve integration or a way of running ng lint with a watch would be useful to my workflow. I work with pretty strict expanded lint rulesets and while WebStorm does give you context highlighting on TSLint violations when you are inside of a file with violations, it does not give immediate feedback for a solution-level analysis unless you explicitly run TSLint. This means that you may be running development via ng serve and not realize that there are linting errors and must then remember to manually lint your code, which slows down the process. Sure, the CI process catches the error, but you hate to see folks breaking the build when tooling like |
@IntegerMan if your concern is having linting errors in CI, you could give husky a try. |
Hey, thanks @svi3c I'd not heard of that. That just might meet my needs. I'd rather get that feedback from a tool in real-time via serve or a watching lint, but this would meet that concern. I'll try it out over the weekend. |
@IntegerMan my team is working through the exact same issue around ng lint, in that we really want to have tslint running automatically on changes. Our CI process catches the problems if forget to run ng lint ourselves, but would be a big convenience to us have a watch option. |
I think we ultimately just need some more hooks into the serve process in general, or a way of having a watching build that can chain into other steps. We just finished a fairly long project in Angular 4 CLI where we had an MVC page in a production product that hosted the Angular app and passed in information to it via some custom things on a namespace inside of Window. This MVC page also managed script and style includes. Since this was a decently complex thing, we had to effectively ignore index.html inside of the Angular app during development, and as a post:build step we'd copy over the script files (disabling the random filename generation that Angular does). It was a bit of an unusual setup, to be fair. The problem is that since we relied on a post:build step to copy the files over, we couldn't even do a watch to trigger this as the watch would just re-run the actual build. Since we can't get files out of ng serve, that effectively meant that we had to manually build every time, which is a lousy way of building out a product, but we were always testing it inside of an integrated context, which helped catch other issues. Angular 6's build improvements will fix some of these performance headaches, but giving us more flexibility and eventing during the build or serve process would have been nice. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently
ng lint
can only be run as a stand-alone command. This limits its usefulness as developers have to remember to manually run it before committing or install a linting package for their editor. Lint rules are most effective when violating them results in build failure. This makes failure obvious to developers regardless of their editor setup or workflow. While it is currently possible to accomplish this by chainingng lint
andng build
in npm scripts, this solution is not compatible with watcher tasks such asng serve
.To fix this I recommend adding a flag to the
ng serve
andng build
commands that automatically runsng lint
before each build and causes a build failure on any linter rule violation.The text was updated successfully, but these errors were encountered: