-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Arguments after files option should be considered files. #13078
Comments
I know that feel, bro. once again convinced that angular-cli sucks tldr; https://angular.io/cli/lint#options - no info about how to use no matter how are you sending files via
wtf?
ugh, c`mon
ah, f*** off angular-cli... |
As @AndreiShostik mentions above, one way is to pass multiple files to the command is via:
However, there is another way to do this that is a bit more succinct. TSLint accepts glob patterns for file paths, so the following works as well:
Notice the argument passed to I think this is a poorly documented CLI command--the feature already exists, so this issue could probably be closed, but ideally the documentation would be updated to clarify what kind of argument is needed for multiple files with examples for globs. |
This bug is an unfortunate consequence of our custom argument parser and ambiguity around options with repeated arguments. Fundamentally there is no way to disambiguate: # Lint `foo.ts` and `bar.ts` file.
ng lint --files foo.ts bar.ts and # Lint `my-app-1` project and `foo.ts` file.
ng lint --files foo.ts my-app-1 In our case requiring We're looking into replacing our custom argument parser with a more standard one specifically due to issues like this one. We shouldn't be in the business of maintaining our own parser and forcing certain conventions onto users. Hopefully once that happens this should become a bit more flexible. In the meantime, I think the easiest solution to the problem here is to use a function in module.exports = {
"*.ts": (files) => `ng lint ${files.map((file) => `--files ${file}`).join(' ')}`,
}; This will include It's a little unfortunate that using |
The main problem isn't that it doesn't work without having a
This is stupid. It seems like the only way to fix this currently is to use the brace-syntax as @headquarters pointed out:
Either the warning message should be removed and the switch renamed to |
I did this way and this command is running
and I get a new error
What I see file path is somehow duplicated Update 1if I remove the path ran this command manually it's working fine, not sure how to do it in
Update 2I fixed it by having this
|
Closing as the tslint builder is deprecated. |
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. |
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
Repro steps
I'm using
lint-staged
to run several cli tools when commiting, including linting. As@angular/cli@6.1.9
I was able to use it as:And in only ran on staged files. However, after upgrading to
@angular/cli@7.1.0
it throwsUnknown option:{// The route of the file that lint-staged passed as an argument}
.The log given by the failure
Desired functionality
I think Angular CLI should be able to parse additional arguments in this scenario.
ng lint --files
should handle the arguments that comes fromlint-staged
.Mention any other details that might be useful
I research, and find a "fix" in
lint-staged#534
. I upgrade the version oflint-staged
and add the--files
argument at the end of the command. Still, this doesn't work, I think because--files
is expecting an array of files. lint-staged has an issue 138(open since March 2017, almost two years) requesting for a way to be able to tell how you want to pass the arguments.The text was updated successfully, but these errors were encountered: