There are a lot of reasons to leave a job, I won't focus on the reasons in this article.
I will focus on the best way to handle the transition from the old job to the new job.
“I just found out that a dev from my team totally screwed us, I was already vacant in another company without notifying anyone for two weeks, waited for the salary to drop and said it was going to leak the next day, and it was for him to start on a new project today”, by coproduto on twitter
This probably happened in your company or in your team before. Let's try to understand why this happens more than it should.
Hanlon's Razor
Hanlon’s Razor is a mental model that we should not attribute malice for a given action which is more easily explained by stupidity.
I do believe that most people leave companies in bad ways because there is not much-written content about it, or they don't know how to properly handle this situation.
Begin Fair
I think the transition should be fair to both sides: the old and the new company.
Fair is a simple concept that is hard to describe.
How to be fair with the old company?
For the old company, you need to give enough time to let them hire someone else to be in your place. I think 15 days is a good time frame.
You should also transfer your knowledge to the ones that you maintain the project.
You should write down all the implicit knowledge that you have about the code and project.
How to be fair with the new company?
The new company wants you to start right out away, but you should talk to them that you need to be fair to the old company. If the company does not give you an option, it seems like a red flag.
You can start the onboarding process of the new company while finishing the last period with the old company after hours.
Reasoning behind this
The world is small. The world turns. You should not close any “doors” that you are going to need in the future.