-
Notifications
You must be signed in to change notification settings - Fork 45
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 autofix is wrong #93
Comments
I looked into this a bit and unfortunately it is not easy to fix:
Therefore the only way I found to do this correctly is to run ESLint twice - once to report errors/warnings and once to only do the autofix. It's a bit horrible but eh. |
I got it working like this, but you have to add it to
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This took me a while to figure out but the
ESLintLinter
uses the column from ESLint to tell Arc what to fix:However this is the position of the error. It can actually be different to the position of the suggestion. For example with this code:
ESLint will output:
It should use the 9 offset to calculate the column, but it actually uses 18, resulting in this silly patch:
Unfortunately it doesn't look trivial to fix. My suggestion would be to apply all the fixes from the JSON in
ESLintLinter
and then just give the whole file as a single fix in one message.I did want to just use the
--fix
flag but unfortunately it can add or remove lines and then the positions of the other errors are wrong (and Arc freaks out if they are beyond the end of the fixed file).The text was updated successfully, but these errors were encountered: