-
Notifications
You must be signed in to change notification settings - Fork 11.9k
feat(@angular/cli): support passing files to ng lint, closes #7612 #8052
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
Conversation
Link to original issue. |
if (args.length) { | ||
configs.forEach(config => { | ||
config.files = args; | ||
config.project = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This disables any rule that requires type information. Unfortunately, the underlying issue being worked around here of specifying files that are not part of the program is a blocker for this feature.
I think some further thought on the semantics of passing files on the command line and the interaction with the defined configurations is needed. As well as a more general assessment of the desired behavior when files are specified either in the configuration or command line that are not present within the program (behavior could be different). TSLint has a pending PR that issues an explicitly worded fatal error when this condition occurs. My suggestion would be an additional option that filters out the errant files. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point. Previously I was not aware of tslint using type information for evaluating of some rules, thanks!
Another way to implement this which I was considering is to pass files array deeper where the files are being evaluated and just use them to filter what was retrieved. So if I pass file foo.ts
as args... It will only be used to remove everything which is not foo.ts
but it will not add itself. This should prevent issue when typescript compilation fails as with the issue described in tslint repo.
What are your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about only filtering the output by the files names that we want to have information ?
Like ng lint services ->
Do linting to all the files and report only errors on the files in the filter ?
Any update on this? |
Closing this in favor of the Architect effort; you can now specify which app/lib you want to lint. |
@hansl closing the PR seems to be not reasonable. What the users want is perform linting on target files, but not particular sub projects. |
@hansl The main reasons this feature is requested are:
Your rationale for closing this is a solution that shaves millimeters off of a meter long issue. I was able to achieve the functionality I wanted by going directly through
The |
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. |
This works for the described use cases like with
lint-staged
or anything else which expectsng lint
to accept files as args similarly to tslint.ps: my first PR ever so be kind thank you!