Skip to content
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

source.fixAll may have dangerous behaviour #297

Closed
5 tasks done
Dimava opened this issue Oct 24, 2023 · 1 comment · Fixed by #299
Closed
5 tasks done

source.fixAll may have dangerous behaviour #297

Dimava opened this issue Oct 24, 2023 · 1 comment · Fixed by #299

Comments

@Dimava
Copy link
Contributor

Dimava commented Oct 24, 2023

Describe the bug

Using source.fixAll: true may remove unreachable code ( microsoft/vscode#159599 )
This issue is tagged "as-designed", but may be very dangerous, as may randomly cut down a part of function of even a file

function foo(): never { throw 0 }

foo()
// happy debugging
foo() // disappears on save

Suggested solution

Replace

"source.fixAll": "explicit",

with

"source.fixAll.eslint": "explicit",

Reproduction

alert("fine"); throw 0; alert("gets deleted") // save 5 times, 2nd alert gets deleted

System Info

Every VSCode version since `1.70.2` (Aug 2022)

Used Package Manager

n/a

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@antfu
Copy link
Owner

antfu commented Oct 24, 2023

"source.fixAll.eslint": "explicit",

Sure, PR welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants