-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
eslint with --rule option not working properly #419
eslint with --rule option not working properly #419
Comments
@tgreen7 This might be an eslint issue:
To be completely honest, this could also be hiding a |
@sudo-suhas it looks like a bug on our side, TBH. From logs it seems we should not split arguments if they are quoted.
So in this case it should be only 3 arguments instead of 5. Am I right? |
So it seems this one https://github.com/okonet/lint-staged/blob/master/src/findBin.js#L26 is a very naïve implementation. We should probably switch to something more robust. |
@okonet yes, that is a possibility. I say possibility because execa might be handling the arguments being split on single quotes. We should verify that first. However, in this specific case the eslint command, even when run by itself, is not doing what we expect. |
@sudo-suhas not sure what you mean. It works for me on this repo:
|
@tgreen7 BTW thanks for the pointer! I just realized how to use this option to better integrate prettier with eslint so it's less annoying during dev 👍 |
It was a windows specific problem:
|
Is it still a problem? |
The PR you created in #422 fixes it. |
@okonet I am still seeing this issue even after the merge of cli-command-parser |
Not sure why. It works for me. See the PR which integrates it. |
It looks like the args are parsed in the same way and I do have the cli-command-parser package Debug Details
|
@tgreen7 I can confirm this when using single quotes. I'll reopen and try to address it. Meanwhile you can use double quotes. |
Switched to string-argv since cli-command-parser seems to have a bug. Closes #419
Thanks! Double quotes works 👍 |
Switched to string-argv since cli-command-parser seems to have a bug. Closes #419
Steps to reproduce
Here is a example repo: https://github.com/tgreen7/lint-staged-eslint-rule
if you modify index.js, git add index.js, and run yarn precommit then no errors will be logged. However, if you uncomment the line
quotes: [2, 'double']
in the .eslintrc.js file and re-run the precommit then the error will be logged.Also you can try to run yarn lint, which adds that rule in the same way as the precommit, and it does get linted properly.
If I am passing that same rule to the precommit through the eslint --rule option then why is it not getting picked up while running?
Debug Logs
expand to view
Environment
lint-staged
: v7.0.0The text was updated successfully, but these errors were encountered: