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
Include parameter is ignored when no variable is used inside task #106
Comments
Hi @fdipuma , |
Hey @alirezanet , thanks, we are currently using a bad workround, something like this:
But this generates a lot of issues when there are too many staged files:
Do you have any other workaround? Or some idea on when you could look at the issue? I would also like to create a PR if you like, but I'm not 100% sure where to act. |
Hi @fdipuma, |
one potential fix for this would be, if we didn't have any variables in the arguments, we could consider using git staged files for the glob patterns (include/exclude) by default or with a configuration like |
@alirezanet yes, I agree with you that some property is less error prone from the user perspective. But I was thinking an enum could be better than a boolean prop: {
"tasks": [
{
"name": "npx-lint-staged",
"group": "pre-commit",
"command": "npx",
"fallbackFilteringRule": "git-staged", // use this when no param is in the args, this could be an enum and the default value could be "none" if we want to keep compatibility, and other values could be "git-staged", "git-files", "all-files", and so on
"args": [
"lint",
"staged"
],
"include": [
"client/**/*"
]
}
]
} WDYT? |
Version
0.6.4
Details
I was not super sure if to open this as a bug or as a feature request, still I think the expected behavior differs to how it works now.
If I use the
include
parameter inside a task, but no variable (e.g.{staged}
) is used in the command args, the include filter is completely ignored and the task is executed always, even if there are no changes to files matched by the glob pattern.e.g.
If I commit a change in another folder (e.g.
server/test.txt
), the tasknpx-lint-staged
is executed.Is this the intended behavior? I think it really confuses the user right now.
Thanks!
Steps to reproduce
expected: the task created in step 1 is skipped because no file is matched
actual: the task created in step 1 is executed
The text was updated successfully, but these errors were encountered: