Skip to content

ng lint vs tslint command #9750

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

Closed
olivierscheffler opened this issue Feb 23, 2018 · 7 comments
Closed

ng lint vs tslint command #9750

olivierscheffler opened this issue Feb 23, 2018 · 7 comments
Labels

Comments

@olivierscheffler
Copy link

olivierscheffler commented Feb 23, 2018

Versions

1.6.0

Repro steps

It's more a question than a bug, but I want to know what is the exact command behind the command ng lint.
I wand to run manually the command tslint to be able to make ax export in json format.

Observed behavior

When I run tslint -p tsconfig.json -c tslint.json vs ng lint, I don't have the same error on my console.

Desired behavior

I would like to know the exact command behind ng lint to be able to run it without angular-cli.

---- UPDATE ----
I was looking at the source code of angular cli and just see that we can add -t json to output ng lint error in json format.
Was nowhere on documentation..

@filipesilva filipesilva added the area: docs Related to the documentation label Feb 26, 2018
@filipesilva
Copy link
Contributor

@olivierscheffler yes, as you have found you now, you can pass the format to ng lint. We should properly document this. What ng lint does is lint the app, specs and e2e tests in your project. So if you're seeing different errors they might be because of linting the different parts.

@Hotell
Copy link

Hotell commented Mar 19, 2018

related 👉 #10013

@toupeira
Copy link

What ng lint does is lint the app, specs and e2e tests in your project.

@filipesilva how exactly is the linting accomplished? It seems ng lint only checks files that are referenced by the Angular app, and misses some errors reported by tslint -p . (which covers all .ts files in the directory structure).

The background in our case is that we have some example .ts files for components which are not actually executed, but loaded over XHR to be inserted as code samples. Probably a bit of an edge-case, but it's a bit confusing when the docs describe ng lint as a simple wrapper around tslint.

@filipesilva
Copy link
Contributor

@toupeira ng lint runs all targets named lint in your angular.json. Individually For a new project there is a lint target for your app, and one for your e2e suite.

Those lint targets are configured to use the tsconfig.json files for that project but you can change that. You can also add individual files using the files array inside options.

Each of those configs is like running tslint with a project, or with a list of files, while running tslint -p . directly is running it over the root tsconfig. Hope this helps.

@toupeira
Copy link

@filipesilva thanks, that does clear things up! Would be great to add this information to https://github.com/angular/angular-cli/wiki/lint :)

@filipesilva
Copy link
Contributor

We're actually rolling out new docs with 7 soon, you can see a preview here:https://next.angular.io/cli/lint

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants