-
Notifications
You must be signed in to change notification settings - Fork 44
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
Using no-else-return makes code broken #156
Comments
Likely same reason as #110 |
dummdidumm
pushed a commit
to dummdidumm/eslint-plugin-svelte3
that referenced
this issue
Jan 5, 2022
Fixes don't need to start at the same line where the error message is shown, and they don't need to be at the same line as the start of the error message. Therefore the previous handling of re-adding dedents was flawed. Instead, map the range to positions (line/character) and use them to find the correct dedent offsets. Additionally add indentation after each newline a fix has because the fix doesn't know about the additional indentation. To properly test fixes, the test setup was enhanced. If there's a Fixed.svelte, that one will be compared against a fixed version of Input.svelte. Fixes sveltejs#110 Fixes sveltejs#156 Fixes sveltejs#157
dummdidumm
added a commit
that referenced
this issue
Jan 5, 2022
Fixes don't need to start at the same line where the error message is shown, and they don't need to be at the same line as the start of the error message. Therefore the previous handling of re-adding dedents was flawed. Instead, map the range to positions (line/character) and use them to find the correct dedent offsets. Additionally add indentation after each newline a fix has because the fix doesn't know about the additional indentation. To properly test fixes, the test setup was enhanced. If there's a Fixed.svelte, that one will be compared against a fixed version of Input.svelte. Fixes #110 Fixes #156 Fixes #157
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, everyone!
I was very surprised to found this dangerous case with a single eslint rule. I can reproduce it.
Initial
test.svelte
:After
eslint --fix
And this code no longer valid, because it leaves extra curly brace after second
return
.Congratulations for those who using
--fix
on precomit. ).eslintrc.js
with just one rule:package.json
:Any ideas why it's broken only in
*.svelte
files, not*.js
?By the way, I think
no-lonely-if
also lead to problems in some cases. I wil fill another issue with that.The text was updated successfully, but these errors were encountered: