-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Auto-fix by default? #374
Comments
I see linters as being checkers. I wouldn't expect them to just go and change my code. Would you detect CI and raise errors rather than fixing? |
Can we change that perception? I see linters as helpers. Fixing my code is just helping me more.
Yes |
Prettier is more easily understood as a formatter. I don't have hard feelings either way. Would be cool if I could disable the auto-fix behavior globally though. |
There are also CI environments to take into account. Depending on what CI you run, you'd have to make sure to run Then there are those cases where you are transitioning an existing code base to Personally it boils down to mentality. I'm a bit wary of tools that make changes to my code without me explicitly telling them to. Oh, didn't refresh the page before commenting. I see @novemberborn brought up the question about CI environments already :). |
I can’t come up with any reason not to do this! |
There are more cases where you only need to verify the code without fixing it:
Most editors can be set to auto-run tools like |
Not sure about this. On one side, I like the idea because like you say, it can only help you. On the other hand, I think there are quite a lot of edge cases, some already mentioned by others where it works against you instead of with you. A way to test this would be to publish some kind of pre-release version with |
The idea has grown on me, is this worth a try in the wild? If you can reliably detect CI, git and text editors plugins, the most common automated use cases won't be affected, so probably a try wouldn't ruin a lot of people's day 😅
To counter my own point, |
@bfred-it I'm not ready to experiment with this yet. I have too many things to deal with and I expect this to require a lot of follow up and tweaks. |
I don't like the idea - i use |
If I make changes to index.js and run |
How can we formate the code only without changing the code? |
Most user's workflow; run
npm test
, encounter linter errors, then manually runxo --fix
.Is there any good reason not to just make XO default to
--fix
? And instead have axo --no-fix
flag to opt-out. Are there any downsides in doing this?This could be problematic for a few rules, like
ava/no-skip-test
, as its auto-fixer would remove theskip
before running the test, but we could have a list of things to not auto-fix by default.The text was updated successfully, but these errors were encountered: