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

Discussion: should fixes be allowed to cause type errors for invalid code #249

Closed
ajafff opened this issue May 13, 2018 · 1 comment
Closed

Comments

@ajafff
Copy link
Member

ajafff commented May 13, 2018

Currently there are only 100% safe fixes (with the exception of outstanding bug reports). That means:

  • fixes don't introduce parse errors
  • fixes don't alter runtime semantics
  • fixes don't introduce type errors

This is about the last bullet point. Some fixes were even removed because they might cause type errors. Related: #160, #248, #186

Should rules be allowed to autofix such cases and cause type errors on the next compilation?
To be honest, the code is faulty anyway. The programmer should be notified there's something wrong.
The code (before and after autofixing) should not be shipped to production without being looked at.

Due to bullet point #2 rules cannot autofix all cases of "duplicate property" or "unreachable code" because that might change runtime semantics.

For posterity: there's also a proposal to introduce potentially unsafe fixes #207

@ajafff
Copy link
Member Author

ajafff commented Oct 17, 2018

After revisiting #186 and looking at #248 again, I think it's acceptable for fixes to cause compiler errors as long as it doesn't change runtime behavior.

That means those object spread related fixes are fine because the result is still the same (if you ignore the compiler error).
Autofixing return-never-call (#160) on the other hand is not desired. Although the types say a function never returns, it's not guaranteed to be the case when executed. Therefore fixing this should be a suggestion that needs the developer's action to actually apply.

Other rules such as no-useless-escape proposed in #203 should not be autofixed. Such errors need to be looked at by a human to decide the correct action.

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

No branches or pull requests

1 participant